main/src/georegression/geometry/UtilEllipse_F64.java
public static EllipseRotated_F64 convert( EllipseQuadratic_F64 input , EllipseRotated_F64 output ) {
		if( output == null )
			output = new EllipseRotated_F64();

		double a11 = input.A;
		double a12 = input.B;
		double a22 = input.C;
		double b1  = 2*input.D;
		double b2  = 2*input.E;
		double c = input.F;

		output.center.x = (a22*b1-a12*b2)/(2*(a12*a12 - a11*a22));
		output.center.y = (a11*b2-a12*b1)/(2*(a12*a12 - a11*a22));

		double k1 = output.center.x;
		double k2 = output.center.y;

		double mu = 1.0/(a11*k1*k1 + 2*a12*k1*k2 + a22*k2*k2 - c);
		double m11 = mu*a11;
		double m12 = mu*a12;
		double m22 = mu*a22;

		double inner = Math.sqrt((m11-m22)*(m11-m22) + 4*m12*m12);
		double l1 = ((m11+m22) + inner)/2.0;
		double l2 = ((m11+m22) - inner)/2.0;

		output.b = 1/(double)Math.sqrt(l1);
		output.a = 1/(double)Math.sqrt(l2);

		// direction of minor axis
		double dx,dy;
		if( m11 >= m22 ) {
			dx = l1-m22;
			dy = m12;
		} else {
			dx = m12;
			dy = l1-m11;
		}

		// direction of major axis
		output.phi = Math.atan2(-dx,dy);
		if( output.phi < -GrlConstants.PId2 ) {
			output.phi += (double)Math.PI;
		} else if( output.phi > GrlConstants.PId2 ) {
			output.phi -= (double)Math.PI;
		}

		return output;
	}
public static EllipseRotated_F64 convert( EllipseQuadratic_F64 input , EllipseRotated_F64 output ) {
		if( output == null )
			output = new EllipseRotated_F64();

		double a11 = input.A;
		double a12 = input.B;
		double a22 = input.C;
		double b1  = 2*input.D;
		double b2  = 2*input.E;
		double c = input.F;

		output.center.x = (a22*b1-a12*b2)/(2*(a12*a12 - a11*a22));
		output.center.y = (a11*b2-a12*b1)/(2*(a12*a12 - a11*a22));

		double k1 = output.center.x;
		double k2 = output.center.y;

		double mu = 1.0/(a11*k1*k1 + 2*a12*k1*k2 + a22*k2*k2 - c);
		double m11 = mu*a11;
		double m12 = mu*a12;
		double m22 = mu*a22;

		double inner = Math.sqrt((m11-m22)*(m11-m22) + 4*m12*m12);
		double l1 = ((m11+m22) + inner)/2.0;
		double l2 = ((m11+m22) - inner)/2.0;

		output.b = 1/(double)Math.sqrt(l1);
		output.a = 1/(double)Math.sqrt(l2);

		// direction of minor axis
		double dx,dy;
		if( m11 >= m22 ) {
			dx = l1-m22;
			dy = m12;
		} else {
			dx = m12;
			dy = l1-m11;
		}

		// direction of major axis
		output.phi = Math.atan2(-dx,dy);
		if( output.phi < -GrlConstants.PId2 ) {
			output.phi += (double)Math.PI;
		} else if( output.phi > GrlConstants.PId2 ) {
			output.phi -= (double)Math.PI;
		}

		return output;
	}
public static EllipseRotated_F64 convert ( EllipseQuadratic_F64 input , EllipseRotated_F64 output ) { if ( output == null ) output = new EllipseRotated_F64 ( ) ; double a11 = input . A ; double a12 = input . B ; double a22 = input . C ; double b1 = 2 * input . D ; double b2 = 2 * input . E ; double c = input . F ; output . center . x = ( a22 * b1 - a12 * b2 ) / ( 2 * ( a12 * a12 - a11 * a22 ) ) ; output . center . y = ( a11 * b2 - a12 * b1 ) / ( 2 * ( a12 * a12 - a11 * a22 ) ) ; double k1 = output . center . x ; double k2 = output . center . y ; double mu = 1.0 / ( a11 * k1 * k1 + 2 * a12 * k1 * k2 + a22 * k2 * k2 - c ) ; double m11 = mu * a11 ; double m12 = mu * a12 ; double m22 = mu * a22 ; double inner = Math . sqrt ( ( m11 - m22 ) * ( m11 - m22 ) + 4 * m12 * m12 ) ; double l1 = ( ( m11 + m22 ) + inner ) / 2.0 ; double l2 = ( ( m11 + m22 ) - inner ) / 2.0 ; output . b = 1 / ( double ) Math . sqrt ( l1 ) ; output . a = 1 / ( double ) Math . sqrt ( l2 ) ; // direction of minor axis double dx , dy ; if ( m11 >= m22 ) { dx = l1 - m22 ; dy = m12 ; } else { dx = m12 ; dy = l1 - m11 ; } // direction of major axis output . phi = Math . atan2 ( - dx , dy ) ; if ( output . phi < - GrlConstants . PId2 ) { output . phi += ( double ) Math . PI ; } else if ( output . phi > GrlConstants . PId2 ) { output . phi -= ( double ) Math . PI ; } return output ; }
<p>
Convert from quadratic to rotated formats.  Equations taken from [1].
</p>

<p>
[1] David Eberly "Information About Ellipses", Geometric Tools, LLC 2011
</p>

@param input Input in quadratic format.
@param output (Optional) Storage for converted format.  Can be null.
@return Ellipse in rotated format.
<p > Convert from quadratic to rotated formats . Equations taken from [ 1 ] . < / p >