Commit b6af0ac3 by Bryan Cazabonne

Improved sine and cosine calculation.

parent e12fa0ea
Pipeline #796 passed with stage
in 31 minutes and 54 seconds
 ... ... @@ -21,6 +21,9 @@ Updated Hipparchus version to 1.8 and updated code with new functionalities. Added Knocke's Earth rediffused radiation pressure force model. ... ...
 ... ... @@ -22,6 +22,7 @@ import org.hipparchus.geometry.euclidean.threed.Vector3D; import org.hipparchus.geometry.euclidean.twod.Vector2D; import org.hipparchus.util.FastMath; import org.hipparchus.util.MathArrays; import org.hipparchus.util.SinCos; import org.orekit.frames.Frame; import org.orekit.utils.TimeStampedPVCoordinates; ... ... @@ -158,7 +159,8 @@ public class Ellipse implements Serializable { * @return ellipse point at theta, in underlying ellipsoid frame */ public Vector3D pointAt(final double theta) { return toSpace(new Vector2D(a * FastMath.cos(theta), b * FastMath.sin(theta))); final SinCos scTheta = FastMath.sinCos(theta); return toSpace(new Vector2D(a * scTheta.cos(), b * scTheta.sin())); } /** Create a point from its ellipse-relative coordinates. ... ...
 ... ... @@ -22,6 +22,7 @@ import org.hipparchus.RealFieldElement; import org.hipparchus.geometry.euclidean.threed.FieldVector3D; import org.hipparchus.util.CompositeFormat; import org.hipparchus.util.FastMath; import org.hipparchus.util.FieldSinCos; import org.hipparchus.util.MathUtils; /** Point location relative to a 2D body surface, using {@link RealFieldElement}. ... ... @@ -112,13 +113,11 @@ public class FieldGeodeticPoint> { */ public FieldVector3D getZenith() { if (zenith == null) { final T cosLat = latitude.cos(); final T sinLat = latitude.sin(); final T cosLon = longitude.cos(); final T sinLon = longitude.sin(); zenith = new FieldVector3D<>(cosLon.multiply(cosLat), sinLon.multiply(cosLat), sinLat); final FieldSinCos scLat = FastMath.sinCos(latitude); final FieldSinCos scLon = FastMath.sinCos(longitude); zenith = new FieldVector3D<>(scLon.cos().multiply(scLat.cos()), scLon.sin().multiply(scLat.cos()), scLat.sin()); } return zenith; } ... ... @@ -143,13 +142,11 @@ public class FieldGeodeticPoint> { */ public FieldVector3D getNorth() { if (north == null) { final T cosLat = latitude.cos(); final T sinLat = latitude.sin(); final T cosLon = longitude.cos(); final T sinLon = longitude.sin(); north = new FieldVector3D<>(cosLon.multiply(sinLat).negate(), sinLon.multiply(sinLat).negate(), cosLat); final FieldSinCos scLat = FastMath.sinCos(latitude); final FieldSinCos scLon = FastMath.sinCos(longitude); north = new FieldVector3D<>(scLon.cos().multiply(scLat.sin()).negate(), scLon.sin().multiply(scLat.sin()).negate(), scLat.cos()); } return north; } ... ... @@ -174,8 +171,9 @@ public class FieldGeodeticPoint> { */ public FieldVector3D getEast() { if (east == null) { east = new FieldVector3D<>(longitude.sin().negate(), longitude.cos(), final FieldSinCos scLon = FastMath.sinCos(longitude); east = new FieldVector3D<>(scLon.sin().negate(), scLon.cos(), longitude.getField().getZero()); } return east; ... ...
 ... ... @@ -23,6 +23,7 @@ import org.hipparchus.geometry.euclidean.threed.Vector3D; import org.hipparchus.util.CompositeFormat; import org.hipparchus.util.FastMath; import org.hipparchus.util.MathUtils; import org.hipparchus.util.SinCos; /** Point location relative to a 2D body surface. *

Instance of this class are guaranteed to be immutable.

... ... @@ -122,11 +123,9 @@ public class GeodeticPoint implements Serializable { */ public Vector3D getZenith() { if (zenith == null) { final double cosLat = FastMath.cos(latitude); final double sinLat = FastMath.sin(latitude); final double cosLon = FastMath.cos(longitude); final double sinLon = FastMath.sin(longitude); zenith = new Vector3D(cosLon * cosLat, sinLon * cosLat, sinLat); final SinCos scLat = FastMath.sinCos(latitude); final SinCos scLon = FastMath.sinCos(longitude); zenith = new Vector3D(scLon.cos() * scLat.cos(), scLon.sin() * scLat.cos(), scLat.sin()); } return zenith; } ... ... @@ -151,11 +150,9 @@ public class GeodeticPoint implements Serializable { */ public Vector3D getNorth() { if (north == null) { final double cosLat = FastMath.cos(latitude); final double sinLat = FastMath.sin(latitude); final double cosLon = FastMath.cos(longitude); final double sinLon = FastMath.sin(longitude); north = new Vector3D(-cosLon * sinLat, -sinLon * sinLat, cosLat); final SinCos scLat = FastMath.sinCos(latitude); final SinCos scLon = FastMath.sinCos(longitude); north = new Vector3D(-scLon.cos() * scLat.sin(), -scLon.sin() * scLat.sin(), scLat.cos()); } return north; } ... ... @@ -180,7 +177,8 @@ public class GeodeticPoint implements Serializable { */ public Vector3D getEast() { if (east == null) { east = new Vector3D(-FastMath.sin(longitude), FastMath.cos(longitude), 0); final SinCos scLon = FastMath.sinCos(longitude); east = new Vector3D(-scLon.sin(), scLon.cos(), 0); } return east; } ... ...
 ... ... @@ -26,7 +26,9 @@ import org.hipparchus.geometry.euclidean.threed.Line; import org.hipparchus.geometry.euclidean.threed.Vector3D; import org.hipparchus.geometry.euclidean.twod.Vector2D; import org.hipparchus.util.FastMath; import org.hipparchus.util.FieldSinCos; import org.hipparchus.util.MathArrays; import org.hipparchus.util.SinCos; import org.orekit.frames.FieldTransform; import org.orekit.frames.Frame; import org.orekit.frames.Transform; ... ... @@ -308,15 +310,13 @@ public class OneAxisEllipsoid extends Ellipsoid implements BodyShape { /** {@inheritDoc} */ public Vector3D transform(final GeodeticPoint point) { final double longitude = point.getLongitude(); final double cLambda = FastMath.cos(longitude); final double sLambda = FastMath.sin(longitude); final SinCos scLambda = FastMath.sinCos(longitude); final double latitude = point.getLatitude(); final double cPhi = FastMath.cos(latitude); final double sPhi = FastMath.sin(latitude); final SinCos scPhi = FastMath.sinCos(latitude); final double h = point.getAltitude(); final double n = getA() / FastMath.sqrt(1.0 - e2 * sPhi * sPhi); final double r = (n + h) * cPhi; return new Vector3D(r * cLambda, r * sLambda, (g2 * n + h) * sPhi); final double n = getA() / FastMath.sqrt(1.0 - e2 * scPhi.sin() * scPhi.sin()); final double r = (n + h) * scPhi.cos(); return new Vector3D(r * scLambda.cos(), r * scLambda.sin(), (g2 * n + h) * scPhi.sin()); } /** {@inheritDoc} */ ... ... @@ -326,10 +326,12 @@ public class OneAxisEllipsoid extends Ellipsoid implements BodyShape { final T longitude = point.getLongitude(); final T altitude = point.getAltitude(); final T cLambda = longitude.cos(); final T sLambda = longitude.sin(); final T cPhi = latitude.cos(); final T sPhi = latitude.sin(); final FieldSinCos scLambda = FastMath.sinCos(longitude); final FieldSinCos scPhi = FastMath.sinCos(latitude); final T cLambda = scLambda.cos(); final T sLambda = scLambda.sin(); final T cPhi = scPhi.cos(); final T sPhi = scPhi.sin(); final T n = sPhi.multiply(sPhi).multiply(e2).subtract(1.0).negate().sqrt().reciprocal().multiply(getA()); final T r = n.add(altitude).multiply(cPhi); ... ...