2. A Fractal. The symbol is called a tilde. We are going to create a fractal that resembles this picture, so we will cal
Posted: Tue Jul 12, 2022 8:17 am
And a tilde fractal of depth 5 looks like this: The middle fractals are shifted over one-quarter of the way from (xo.y) to (x,y), shifted up or down the same amount, and one-quarter as big as the full-size fractal. Exercise Write a function tilde (canvas, x0, x1, y., depth). canvas is an ipycanvas. Canvas object. x0, x1, and y are float values, and depth is an int. The function should draw on canvas a tilde fractal between points (xo.y) and (x₁.y). It is not easy to automatically test this function. Run it with different values of depth, and verify by eye that it looks like the examples shown above. Make sure the left corner is (xo.y), and that the right corner is (x₁, y). This code will help you get started: import ipycanvas def tilde (canvas: ipycanvas. Canvas, x0: float, xl: float, y: float, depth: int) -> None: canvas = ipycanvas.Canvas (size=(320,320)) ## Run your function with different values to verify it works. tilde (canvas, 40.0, 280.0, 160.0, 3) display (canvas) Use nothing from ipycanvas. Canvas except canvas.stroke_line(x1, yl, x2, y2).