Solutions for y for rotated ellipse

I want to build an ellipse using scanline, which will find the values ​​for y for each x value.

For a simple ellipse, the formula is trivial to find: y = Sqrt [b ^ 2 - (b ^ 2 x ^ 2) / a ^ 2]

But when the ellipse axes rotate, I could never figure out how to calculate y (and possibly the extents x)

+3
source share
1 answer

In parametric form

x[t]= a Cos[t] Cos[psi] - b Sin[t] Sin[psi]

y[t]= b Cos[psi] Sin[t] + a Cos[t] Sin[psi]

Where psi is the rotation angle, a and b are the axle shafts.

The parameter t goes from 0 to 2 Pi.

Or, if you prefer in Cartesian nonparametric form:

(a x^2+b y^2) Cos[psi]^2 + (b x^2 +a y^2) Sin[psi]^2 + (a-b) x y Sin[2 psi]==1

This gives two possible solutions for y [x], which is equivalent to two solutions for the square root in the non-rotating case:

y -> (-(Sqrt[2]*Sqrt[a + b - 2*a*b*x^2 + (-a + b)*Cos[2*psi]]) + 
       (-a + b)*x*Sin[2*psi]) / (2*(b*Cos[psi]^2 + a*Sin[psi]^2))

y ->   (Sqrt[2]*Sqrt[a + b - 2*a*b*x^2 + (-a + b)*Cos[2*psi]] + 
       (-a + b)*x*Sin[2*psi])/ (2*(b*Cos[psi]^2 + a*Sin[psi]^2))

Well, you asked him :)

:

enter image description here

x:

LimitX= +/- Sqrt[a + b + (-a + b)*Cos[2*psi]]/(Sqrt[2]*Sqrt[a]*Sqrt[b])
+12

Source: https://habr.com/ru/post/1780803/


All Articles