Recursively draw the Vicsek fractal at the specified position, with the specified length and depth.
(x: float, y: float, length: float, depth: float)
| 35 | |
| 36 | |
| 37 | def draw_fractal_recursive(x: float, y: float, length: float, depth: float): |
| 38 | """ |
| 39 | Recursively draw the Vicsek fractal at the specified position, with the |
| 40 | specified length and depth. |
| 41 | """ |
| 42 | if depth == 0: |
| 43 | draw_cross(x, y, length) |
| 44 | return |
| 45 | |
| 46 | draw_fractal_recursive(x, y, length / 3, depth - 1) |
| 47 | draw_fractal_recursive(x + length / 3, y, length / 3, depth - 1) |
| 48 | draw_fractal_recursive(x - length / 3, y, length / 3, depth - 1) |
| 49 | draw_fractal_recursive(x, y + length / 3, length / 3, depth - 1) |
| 50 | draw_fractal_recursive(x, y - length / 3, length / 3, depth - 1) |
| 51 | |
| 52 | |
| 53 | def set_color(rgb: str): |
no test coverage detected