S
S
sergosar2020-08-03 17:20:45
Mathematics
sergosar, 2020-08-03 17:20:45

How to construct an equation for an ellipse with a given center that touches two given segments at given points?

Hello.

There is the following task.

Given two segments (given by two points), the tangent points of the ellipse and the segments, and the coordinates of the center of the ellipse, it is required to construct the ellipse itself, i.e. find find all the coefficients of the equation of the ellipse Ax2 + Bxy + Cy2 + Dx + Ey = 1.

Can someone tell me the solution method or where to dig. thanks in advance

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
Wataru, 2020-08-04
@sergosar

First, move the center of the coordinate system to the center of the ellipse - subtract it from all coordinates of the touch points. At the very end, you will need to make a reverse transition and substitute x=x-x0, y=y-y0 into the equation.
When choosing the correct coordinate system, the ellipse becomes a circle, because its equation is x^2/a^2+y^2/b^2=1. Everything else is from moving the center of coordinates and rotating the ellipse.
Let's reshape our coordinate system by rotating it by some angle and shrinking along the x-axis to get a circle.
c- cos(angle), s=sin(angle) k- compression factor.
Then the new coordinate system is {kc,ks}, {s,-c}. Let's transform the points of contact and the vector of tangents into this coordinate system. They will remain tangent to our ellipse, because the rotation and contraction transformations will leave the straight lines straight, and the ellipse an ellipse (or circle).
If x1,y1 is a tangent point and {xv, yv} is a tangent vector, then:
x1' = x1*kc+y1*ks
y1' = x1*s-y1*c
xv' = xv*kc+yv*ks
yv' = xv*s-yv*c
These are just conversion formulas between coordinate systems. The same can be done for x2', y2', xw,' yw'.
Now let's set up the equations. We want to find a transformation in which our ellipse will be a circle. First, the distances to the touch points must be the same. Second, the tangent vectors must be perpendicular to the vectors from the origin to the tangent points.
If you carefully write x1'*x1'+y1'*y1'-x2'*x2'-y2'*y2' = 0, and replace c^2=1-s^2, then it will be:
(y1*y1-y2 *y2-x1*x1+x2*x2)*kkss + (2*x1*y1-2*x2*y2)kkcs + (x1*x1-x2*x2-y1*y1+y2*y2)ss +(2 *x2*y2-2*x1*y1)*cs +(x1*x1-x2*x2)*kk+(y1*y1-y2*y2)=0
I advise you not to believe me here with the coefficients, but to check them yourself.
Similar equations for tangents x1'*xv'+y1'*yv' = 0:
(y1*yv-x1*xv)*kkss + (x1*yv+y1*xv)kkcs + (x1*xv-y1*yv) ss +(-x1*yv-y1*xv)*cs +(x1*xv)*kk-y1*yv=0
It is important to note that we have here 3 equations of the form:
A*kkss+B*kkcs-Ass-Bcs+Ckk+D=0, where constant coefficients A,B,C,D (different in three equations) and 3 variables k, s,c. There is also an additional condition s*s+c*c=1, these are the sines/cosines of the angle, and k!=0. k can also be negative, which would mean reflection and contraction of the coordinate system. Suitable for our purposes.
Please note that the 3rd and 4th terms come with the same coefficients as the 1st and 2nd, but with the opposite signs. You can choose such coefficients for the first two equations that if you add them to the third equation, then the coefficients in front of kkss, kkcs, ss, cs - all become equal to zero. It is necessary to solve a system of two linear equations.
Let the coefficients in the equations A1,A2,A3,B1,B2,B3,C1, etc. (I remind you that these are constants calculated through the given coordinates of points and touch vectors). Let's introduce 2 variables x, y - coefficients with which to add the first 2 equations to the third one. Conditions: A1*x+A2*y+A3=0, B1*x+B2*y+B3=0. Solving this system of equations, finding the coefficients and adding the first 2 equations to the third one, you will get an equation of the form
C4*k*k+D4=0
Elementarily solving it, you will find k. Substituting it into the 2 previous equations you get 2 equations of the form: A4* ss
+B4*cs + D4 = 0 *cs+D4*cc = 0.
Now it remains to divide both parts by c^2 and solve the square equation for tan (). Still, however, it is necessary to consider whether c=0,s=1 is suitable (s=-1 is not necessary to consider, After all, it doesn’t matter which way to rotate 90 degrees, the compression axis will still be the same).
Now, knowing the tangent, find the cosine and sine (school trigonometric formulas, like c=sqrt(1/(1+t^2)).
That's it, we know k, c, s. Substituting them into the formulas for x1', y1' we find out radius of the circle (distance to zero) Let the radius be r
Now the equation of the ellipse is x'^2+y'^2 = r^2
Substitute the transformation:
x'=x*k*s+y*k*c, y' = x*sy*c Then don't forget to change x<-x-x0, y<-y-y0 to return the center of the ellipse to the given location.
All these substitutions must be carefully substituted and open the brackets in the equation x'^2+y'^2 = r^2 and get your coefficients in the equation Ax2 + Bxy + Cy2 + Dx + Ey = F. Then divide both parts by F.
This is the solution it is impossible to paint analytically on paper to the end, because there are too many substitutions and stages - there will be just monster formulas. But, in the algorithm, doing it step by step, introducing variables and coefficients is not difficult to do.
Edit:
There is a potential problem here - you need to solve a system of linear equations and 2 quadratic equations in the process of solving. I cannot prove, but I believe with all my heart that if the ellipse exists, then all these equations will be solved in real numbers, without dividing by 0 and square roots from negative numbers.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question