use of org.hipparchus.geometry.euclidean.twod.Vector2D in project Orekit by CS-SI.
the class OneAxisEllipsoidTest method transformOldIterative.
/**
* Transform a Cartesian point to a surface-relative point.
* <p>
* This method was the implementation used in the main Orekit library
* as of version 8.0. It has been replaced as of 9.0 with a new version
* using faster iterations, so it is now used only as a test reference
* with an implementation which is different from the one in the main library.
* </p>
* @param point Cartesian point
* @param frame frame in which Cartesian point is expressed
* @param date date of the computation (used for frames conversions)
* @return point at the same location but as a surface-relative point
* @exception OrekitException if point cannot be converted to body frame
*/
private GeodeticPoint transformOldIterative(final OneAxisEllipsoid model, final Vector3D point, final Frame frame, final AbsoluteDate date) throws OrekitException {
// transform point to body frame
final Vector3D pointInBodyFrame = frame.getTransformTo(model.getBodyFrame(), date).transformPosition(point);
final double r2 = pointInBodyFrame.getX() * pointInBodyFrame.getX() + pointInBodyFrame.getY() * pointInBodyFrame.getY();
final double r = FastMath.sqrt(r2);
final double z = pointInBodyFrame.getZ();
// set up the 2D meridian ellipse
final Ellipse meridian = new Ellipse(Vector3D.ZERO, new Vector3D(pointInBodyFrame.getX() / r, pointInBodyFrame.getY() / r, 0), Vector3D.PLUS_K, model.getA(), model.getC(), model.getBodyFrame());
// project point on the 2D meridian ellipse
final Vector2D ellipsePoint = meridian.projectToEllipse(new Vector2D(r, z));
// relative position of test point with respect to its ellipse sub-point
final double dr = r - ellipsePoint.getX();
final double dz = z - ellipsePoint.getY();
final double ae2 = model.getA() * model.getA();
final double f = model.getFlattening();
final double g = 1.0 - f;
final double g2 = g * g;
final double insideIfNegative = g2 * (r2 - ae2) + z * z;
return new GeodeticPoint(FastMath.atan2(ellipsePoint.getY(), g2 * ellipsePoint.getX()), FastMath.atan2(pointInBodyFrame.getY(), pointInBodyFrame.getX()), FastMath.copySign(FastMath.hypot(dr, dz), insideIfNegative));
}
Aggregations