main/src/georegression/fitting/curves/ClosestPointEllipseAngle_F64.java
public void process( Point2D_F64 point ) {
		// put point into ellipse's coordinate system
		double xc = point.x - ellipse.center.x;
		double yc = point.y - ellipse.center.y;
//
		double x =  ce*xc + se*yc;
		double y = -se*xc + ce*yc;

		// initial guess for the angle
		theta = Math.atan2( ellipse.a*y , ellipse.b*x);

		double a2_m_b2 = ellipse.a*ellipse.a - ellipse.b*ellipse.b;

		// use Newton's Method to find the solution
		int i = 0;
		for(; i < maxIterations; i++ ) {
			double c = Math.cos(theta);
			double s = Math.sin(theta);

			double f = a2_m_b2*c*s - x*ellipse.a*s + y*ellipse.b*c;
			if( Math.abs(f) < tol )
				break;

			double d = a2_m_b2*(c*c - s*s) - x*ellipse.a*c - y*ellipse.b*s;

			theta = theta - f/d;
		}

		// compute solution in ellipse coordinate frame
		x = ellipse.a*(double)Math.cos(theta);
		y = ellipse.b*(double)Math.sin(theta);

		// put back into original coordinate system
		closest.x = ce*x - se*y + ellipse.center.x;
		closest.y = se*x + ce*y + ellipse.center.y;
	}
public void process( Point2D_F64 point ) {
		// put point into ellipse's coordinate system
		double xc = point.x - ellipse.center.x;
		double yc = point.y - ellipse.center.y;
//
		double x =  ce*xc + se*yc;
		double y = -se*xc + ce*yc;

		// initial guess for the angle
		theta = Math.atan2( ellipse.a*y , ellipse.b*x);

		double a2_m_b2 = ellipse.a*ellipse.a - ellipse.b*ellipse.b;

		// use Newton's Method to find the solution
		int i = 0;
		for(; i < maxIterations; i++ ) {
			double c = Math.cos(theta);
			double s = Math.sin(theta);

			double f = a2_m_b2*c*s - x*ellipse.a*s + y*ellipse.b*c;
			if( Math.abs(f) < tol )
				break;

			double d = a2_m_b2*(c*c - s*s) - x*ellipse.a*c - y*ellipse.b*s;

			theta = theta - f/d;
		}

		// compute solution in ellipse coordinate frame
		x = ellipse.a*(double)Math.cos(theta);
		y = ellipse.b*(double)Math.sin(theta);

		// put back into original coordinate system
		closest.x = ce*x - se*y + ellipse.center.x;
		closest.y = se*x + ce*y + ellipse.center.y;
	}
public void process ( Point2D_F64 point ) { // put point into ellipse's coordinate system double xc = point . x - ellipse . center . x ; double yc = point . y - ellipse . center . y ; // double x = ce * xc + se * yc ; double y = - se * xc + ce * yc ; // initial guess for the angle theta = Math . atan2 ( ellipse . a * y , ellipse . b * x ) ; double a2_m_b2 = ellipse . a * ellipse . a - ellipse . b * ellipse . b ; // use Newton's Method to find the solution int i = 0 ; for ( ; i < maxIterations ; i ++ ) { double c = Math . cos ( theta ) ; double s = Math . sin ( theta ) ; double f = a2_m_b2 * c * s - x * ellipse . a * s + y * ellipse . b * c ; if ( Math . abs ( f ) < tol ) break ; double d = a2_m_b2 * ( c * c - s * s ) - x * ellipse . a * c - y * ellipse . b * s ; theta = theta - f / d ; } // compute solution in ellipse coordinate frame x = ellipse . a * ( double ) Math . cos ( theta ) ; y = ellipse . b * ( double ) Math . sin ( theta ) ; // put back into original coordinate system closest . x = ce * x - se * y + ellipse . center . x ; closest . y = se * x + ce * y + ellipse . center . y ; }
Find the closest point on the ellipse to the specified point.  To get the solution call {@link #getClosest()}

@param point Point which it is being fit to
Find the closest point on the ellipse to the specified point . To get the solution call { @link #getClosest () }