main/src/georegression/geometry/algs/TangentLinesTwoEllipses_F64.java
boolean selectTangent( Point2D_F64 a , Point2D_F64 previousTangent ,
						   EllipseRotated_F64 ellipse, Point2D_F64 tangent ,
						   boolean cross )
	{
		if( !tangentLines(a,ellipse,temp0,temp1) )
			return false;

		tempLine.a = a;

		tempLine.b = temp0;
		boolean crossed0 = Intersection2D_F64.intersection(centerLine,tempLine,junk) != null;
		tempLine.b = temp1;
		boolean crossed1 = Intersection2D_F64.intersection(centerLine,tempLine,junk) != null;

		if( crossed0 == crossed1 )
			throw new RuntimeException("Well this didn't work");

		if( cross == crossed0 ) {
			sumDifference += previousTangent.distance2(temp0);
			tangent.set(temp0);
		} else {
			sumDifference += previousTangent.distance2(temp1);
			tangent.set(temp1);
		}

		return true;
	}
boolean selectTangent( Point2D_F64 a , Point2D_F64 previousTangent ,
						   EllipseRotated_F64 ellipse, Point2D_F64 tangent ,
						   boolean cross )
	{
		if( !tangentLines(a,ellipse,temp0,temp1) )
			return false;

		tempLine.a = a;

		tempLine.b = temp0;
		boolean crossed0 = Intersection2D_F64.intersection(centerLine,tempLine,junk) != null;
		tempLine.b = temp1;
		boolean crossed1 = Intersection2D_F64.intersection(centerLine,tempLine,junk) != null;

		if( crossed0 == crossed1 )
			throw new RuntimeException("Well this didn't work");

		if( cross == crossed0 ) {
			sumDifference += previousTangent.distance2(temp0);
			tangent.set(temp0);
		} else {
			sumDifference += previousTangent.distance2(temp1);
			tangent.set(temp1);
		}

		return true;
	}
boolean selectTangent ( Point2D_F64 a , Point2D_F64 previousTangent , EllipseRotated_F64 ellipse , Point2D_F64 tangent , boolean cross ) { if ( ! tangentLines ( a , ellipse , temp0 , temp1 ) ) return false ; tempLine . a = a ; tempLine . b = temp0 ; boolean crossed0 = Intersection2D_F64 . intersection ( centerLine , tempLine , junk ) != null ; tempLine . b = temp1 ; boolean crossed1 = Intersection2D_F64 . intersection ( centerLine , tempLine , junk ) != null ; if ( crossed0 == crossed1 ) throw new RuntimeException ( "Well this didn't work" ) ; if ( cross == crossed0 ) { sumDifference += previousTangent . distance2 ( temp0 ) ; tangent . set ( temp0 ) ; } else { sumDifference += previousTangent . distance2 ( temp1 ) ; tangent . set ( temp1 ) ; } return true ; }
Selects a tangent point on the ellipse which is closest to the original source point of A.
@param a Point that the tangent lines pass through
@param previousTangent Source point which generated 'a'
@param ellipse Ellipse which the lines will be tangent to
@param tangent (Output) Storage for the selected tangent point
@return true if everything went well or false if finding tangent lines barfed
Selects a tangent point on the ellipse which is closest to the original source point of A .