def curve(t, radiusX, radiusY):
x = sin(t*pi/2) * radiusX
y = cos(t*pi/2) * radiusY
return (x,y)
Following Python pseudo-code will draw a part 1/4 of an ellipse.
However, I am looking to stop drawing at given Y, as I don't need full 1/4 of this ellipse.
Can this function be parametrized such that it will stop drawing at given Y, without affecting the curve < Y?
An alternative approach is to draw using the current function and then cut the resulting object to given max height from the bottom, which I am trying to simplify.
I think the direction of the solution is to keep y at constant step using y = t * radiusY while x should be a transformed formula that will tell us what's the proper x given our y?
Use
and now
phirepresents the polar angle of the ellipse, with0at the 12 o'clock positon and moving clockwise. So if you only want 1/4 of an ellipse usephi = 0..pi/2This follows the polar coordinate definition for a centered, axis-aligned ellipse
$$r(\theta)=\frac{1}{\sqrt{\frac{\sin^{2}\theta}{a^{2}}+\frac{\cos^{2}\theta}{b^{2}}}}$$
and then $x = r \sin \theta$ and $y = r \cos \theta$.