Equation of ellipse from its focus , directrix , and eccentricity | Java program to find equation of an ellipse using focus and directrix . ; Function to find equation of ellipse . ; Driver Code
import java . util . * ; class solution { static void equation_ellipse ( float x1 , float y1 , float a , float b , float c , float e ) { float t = a * a + b * b ; float a1 = t - e * ( a * a ) ; float b1 = t - e * ( b * b ) ; float c1 = ( - 2 * t * x1 ) - ( 2 * e * c * a ) ; float d1 = ( - 2 * t * y1 ) - ( 2 * e * c * b ) ; float e1 = - 2 * e * a * b ; float f1 = ( - e * c * c ) + ( t * x1 * x1 ) + ( t * y1 * y1 ) ; System . out . println ( " Equation ▁ of ▁ ellipse ▁ is ▁ " ) ; System . out . print ( a1 + " ▁ x ^ 2 ▁ + ▁ " + b1 + " ▁ y ^ 2 ▁ + ▁ " + c1 + " ▁ x ▁ + ▁ " + d1 + " ▁ y ▁ + ▁ " + e1 + " ▁ xy ▁ + ▁ " + f1 + " ▁ = ▁ 0" ) ; } public static void main ( String arr [ ] ) { float x1 = 1 , y1 = 1 , a = 1 , b = - 1 , c = 3 , e = ( float ) 0.5 * ( float ) 0.5 ; equation_ellipse ( x1 , y1 , a , b , c , e ) ; } }