Drawing an ellipse (move/turn loop)

228
0
Publicado 2021-05-24
This project paints an ellipse with pen, using a single 'move and turn' loop. Turn angle is fixed (1°), move distance varies. That sounds easy, but the formula for the move distance is quite a beast. There are easier ways to draw an ellipse; I was just curious about this alternate approach.

I'm pretty sure the shape is a correct ellipse, though there will be some inaccuracy due to the limited number of steps taken (360).

I have a similar project with a much simpler formula, but that one does not draw a mathematically correct ellipse.
https://scratch.mit.edu/projects/532445590/

I got the idea for this project after receiving an invitation for @s_federici's studio "Simplest ellipse drawing algorithm":
https://scratch.mit.edu/studios/29609673/

The background image was created using mathcha.io.

I found the formula as follows:
(1) given tangent's angle t, y = b*sin(arctan(b/a*tan(t))
(2) taking steps dt, y = integral of f(t)*cos(t)*dt
(3) solve equality between derivative y' of (1) and (2)