How to find the angle of rotation of the major axis of an ellipse taking into account its bounding rectangle?

I have an ellipse centered at (0,0), and the bounding box is x = [-5,5], y = [-6,6]. The ellipse intersects the rectangle at (-5,3), (-2,5,6), (2,5, -6) and (5, -3)

I don't know anything about the ellipse, but the only thing I need to know is which angle the main axis rotates.

it seems like the answer should be very simple, but I just don't see it ... thanks for the help!

+4
source share
3 answers

The gradient of the ellipse is identical to the gradient of intersections with the bounding rectangle along one side of the ellipse. In your case, that line is from (-2.5,6) to (5, -3), the upper side of your ellipse. This line has a vertical drop of 9 and a horizontal stroke of 7.5.

So we get the next right triangle.

(-2.5,6) *----- |\x | \ | \ 9 | \ | \ | x\ +------* (5,-3) 7.5 

The angle we are looking for is x in both places.

We can calculate it as:

  -1 tan (9/7.5) 

which gives us an angle of -50.19 degrees

+3
source

If (0, 0) is the center than the equation of your ellipse:

F (x, y) = Ax ^ 2 + By ^ 2 + Cxy + D = 0

For any given ellipse, not all coefficients A, B, C, and D are uniquely determined. You can multiply the equation by any nonzero constant and get a new equation of the same ellipse.

4 points. You have 4 equations, but since these points are two pairs of symmetrical points, these equations will not be independent. You will get 2 independent equations. You can get 2 more equations using the fact that the ellipse touches the rectangle at the points of the hose (which I understand).

So, if F (x, y) = Ax ^ 2 + By ^ 2 + Cxy + D your conditions:
dF / dx = 0 at points (-2.5.6) and (2.5, -6)
dF / dy = 0 at points (-5.3) and (5, -3)

Here are four linear equations that you get

 F(5, -3) = 5^2 * A + (-3)^2 * B + (-15) * C + D = 0 F(2.5, -6) = (2.5)^2 * A + (-6)^2 * B + (-15) * C + D = 0 dF(2.5, -6)/dx = 2*(2.5) * A + (-6) * C = 0 dF(5, -3)/dy = 2*(-3) * B + 5 * C = 0 

After a little cleaning:

  25A + 9B - 15C + D = 0 //1 6.25A + 36B - 15C + D = 0 //2 5A - 6C = 0 //3 - 6B + 5C = 0 //4 

Still not all 4 equations are independent and that’s good. The set is homogeneous and if they are independent, you will get a unique but useless solution A = 0, B = 0, C = 0, D = 0.

As I said, the coefficients are not determined unambiguously, so you can set one of the coefficients as you wish and get rid of one equation. for instance

  25A + 9B - 15C = 1 //1 5A - 6C = 0 //3 - 6B + 5C = 0 //4 

From this you get: A = 4/75, B = 1/27, C = 2/45 (D, of course, -1)

Now, to get to the corner, apply the coordinate transformation:

 x = ξcos(φ) - ηsin(φ) y = ξsin(φ) + ηcos(φ) 

(I just could not resist using these letters :))
to the equation F (x, y) = 0

 F(x(ξ, η), y(ξ, η)) = G(ξ, η) = A (ξ^2cos^2(φ) + η^2sin^2(φ) - 2ξηcos(φ)sin(φ)) + B (ξ^2sin^2(φ) + η^2cos^2(φ) + 2ξηcos(φ)sin(φ)) + C (ξ^2cos(φ)sin(φ) - η^2cos(φ)sin(φ) + ξη(cos^2(φ) - sin^2(φ))) + D 

Using these two identities:

 2cos(φ)sin(φ) = sin(2φ) cos^2(φ) - sin^2(φ) = cos(2φ) 

You get the coefficient C ', which costs the product of ξη in G (ξ, η) as:

C '= (BA) sin (2φ) + Ccos (2φ)

Now your question: for what angle φ does the coefficient C 'disappear (equal to zero)
There is more than one angle φ, since there is more than one axis. In the case of the main axis B '> A'

+2
source
  • Set the ellipse angle = 0
  • Calculate 4 intersection points
  • Make a mistake between the calculated intersection points and the desired ones (i.e. add up 4 distances).
  • If the error is too large, use the secant method or Newton-Rhapson to work out a new angle for the ellipse and go to 2.

I used a similar approach to solve another ellipse problem:

http://successfulsoftware.net/2008/07/18/a-mathematical-digression/

http://successfulsoftware.net/2008/08/25/a-mathematical-digression-revisited/

See also:

http://en.wikipedia.org/wiki/Secant_method

http://en.wikipedia.org/wiki/Newton_Rhapson

0
source

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


All Articles