Given focus(x, y), directrix(ax + by + c) and eccentricity e of an ellipse, the task is to find the equation of ellipse using its focus, directrix, and eccentricity.
Input: x1 = 1, y1 = 1, a = 1, b = -1, c = 3, e = 0.5 Output: 1.75 x^2 + 1.75 y^2 + -5.50 x + -2.50 y + 0.50 xy + 1.75 = 0 Input: x1 = -1, y1 = 1, a = 1, b = -1, c = 3, e = 0.5 Output: 1.75 x^2 + 1.75 y^2 + 2.50 x + -2.50 y + 0.50 xy + 1.75 = 0
Let P(x, y) be any point on the ellipse whose focus S(x1, y1), directrix is the straight line ax + by + c = 0 and eccentricity is e.
Draw PM perpendicular from P on the directrix. Then by definition of ellipse distance SP = e * PM => SP^2 = (e * PM)^2
(x – x1)^2 + (y – y1)^2 = e * ( ( a*x + b*y + c ) / (sqrt( a*a + b*b )) ) ^ 2
let ( a*a + b*b ) = t
x^2 + x1^2 – 2*x1*x + y^2 + y1^2 – 2*y1*y = e * ( ( a*x + b*y + c ) ^ 2 )/ t
on cross multiplying above we get
t*x^2 + t*x1^2 – 2*t*x1*x + t*y^2 + t*y1^2 – 2*t*y1*y = e * ( ( a*x + b*y + c ) ^ 2 )
t*x^2 + t*x1^2 – 2*t*x1*x + t*y^2 + t*y1^2 – 2*t*y1*y = e*a^2*x^2 + e*b^2*y^2 + 2*e*a*x*b*y + e*c^2 + 2*e*c*(a*x + b*y)
t*x^2 + t*x1^2 – 2*t*x1*x + t*y^2 + t*y1^2 – 2*t*y1*y = e*a^2*x^2 + e*b^2*y^2 + 2*e*a*x*b*y + e*c^2 + 2*e*c*a*x + 2*e*c*b*y
t*x^2 – e*a^2*x^2 + t*y^2 – e*b^2*y^2 – 2*t*x1*x – 2*e*c*a*x – 2*t*y1*y – 2*e*c*b*y – 2*e*a*x*b*y – e*c^2 + t*x1^2 + t*y1^2 =0
This can be compared with a general form that is:
a*x^2 + 2*h*x*y + b*y^2 + 2*g*x + 2*f*y + c = 0
Below is the implementation of the above approach:
Equation of ellipse is 1.75 x^2 + 1.75 y^2 + -5.50 x + -2.50 y + 0.50 xy + 1.75 = 0
- Equation of parabola from its focus and directrix
- Finding the vertex, focus and directrix of a parabola
- Perimeter of an Ellipse
- Largest triangle that can be inscribed in an ellipse
- Check if a point is inside, outside or on the ellipse
- Program to find the Area of an Ellipse
- Midpoint ellipse drawing algorithm
- Area of Largest rectangle that can be inscribed in an Ellipse
- Area of the Largest square that can be inscribed in an ellipse
- Area of the biggest ellipse inscribed within a rectangle
- Find the area of largest circle inscribed in ellipse
- Find the missing value from the given equation a + b = c
- Number of solutions for the equation x + y + z <= n
- Print values of 'a' in equation (a+b) <= n and a+b is divisible by x
- Find the number of solutions to the given equation
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.