@Test public void testFarPoint() throws OrekitException { AbsoluteDate date = AbsoluteDate.J2000_EPOCH; Frame frame = FramesFactory.getITRF(IERSConventions.IERS_2010, true); OneAxisEllipsoid model = new OneAxisEllipsoid(90.0, 5.0 / 9.0, frame); Vector3D point = new Vector3D(1.0e15, 2.0e15, -1.0e12); GeodeticPoint gp = model.transform(point, frame, date); Vector3D rebuilt = model.transform(gp); Assert.assertEquals(0.0, rebuilt.distance(point), 1.0e-15 * point.getNorm()); }
@Test public void testEquatorialInside() throws OrekitException { AbsoluteDate date = AbsoluteDate.J2000_EPOCH; Frame frame = FramesFactory.getITRF(IERSConventions.IERS_2010, true); OneAxisEllipsoid model = new OneAxisEllipsoid(90.0, 5.0 / 9.0, frame); for (double rho = 0; rho < model.getEquatorialRadius(); rho += 0.01) { Vector3D point = new Vector3D(rho, 0.0, 0.0); GeodeticPoint gp = model.transform(point, frame, date); Vector3D rebuilt = model.transform(gp); Assert.assertEquals(0.0, rebuilt.distance(point), 1.0e-10); } }
@Test public void testOnSurface() throws OrekitException { Vector3D surfacePoint = new Vector3D(-1092200.775949484, -3944945.7282234835, 4874931.946956173); OneAxisEllipsoid earthShape = new OneAxisEllipsoid( 6378136.460, 1 / 298.257222101, FramesFactory.getITRF(IERSConventions.IERS_2010, true)); GeodeticPoint gp = earthShape.transform(surfacePoint, earthShape.getBodyFrame(), AbsoluteDate.J2000_EPOCH); Vector3D rebuilt = earthShape.transform(gp); Assert.assertEquals(0, rebuilt.distance(surfacePoint), 3.0e-9); }
@Test public void testIssue141() throws OrekitException { AbsoluteDate date = new AbsoluteDate("2002-03-06T20:50:20.44188731559965033", TimeScalesFactory.getUTC()); Frame frame = FramesFactory.getGTOD(IERSConventions.IERS_1996, true); OneAxisEllipsoid model = new OneAxisEllipsoid( Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, frame); Vector3D point = new Vector3D(-6838696.282102453, -2148321.403361013, -0.011907944179711194); GeodeticPoint gp = model.transform(point, frame, date); Vector3D rebuilt = model.transform(gp); Assert.assertEquals(0.0, rebuilt.distance(point), 1.0e-15 * point.getNorm()); }
@Test public void testLineIntersection() throws OrekitException { AbsoluteDate date = AbsoluteDate.J2000_EPOCH; Frame frame = FramesFactory.getITRF(IERSConventions.IERS_2010, true); OneAxisEllipsoid model = new OneAxisEllipsoid(100.0, 0.9, frame); Vector3D point = new Vector3D(0.0, 93.7139699, 3.5930796); Vector3D direction = new Vector3D(0.0, 1.0, 1.0); Line line = new Line(point, point.add(direction), 1.0e-10); GeodeticPoint gp = model.getIntersectionPoint(line, point, frame, date); Assert.assertEquals(gp.getAltitude(), 0.0, 1.0e-12); Assert.assertTrue(line.contains(model.transform(gp))); model = new OneAxisEllipsoid(100.0, 0.9, frame); point = new Vector3D(0.0, -93.7139699, -3.5930796); direction = new Vector3D(0.0, -1.0, -1.0); line = new Line(point, point.add(direction), 1.0e-10).revert(); gp = model.getIntersectionPoint(line, point, frame, date); Assert.assertTrue(line.contains(model.transform(gp))); model = new OneAxisEllipsoid(100.0, 0.9, frame); point = new Vector3D(0.0, -93.7139699, 3.5930796); direction = new Vector3D(0.0, -1.0, 1.0); line = new Line(point, point.add(direction), 1.0e-10); gp = model.getIntersectionPoint(line, point, frame, date); Assert.assertTrue(line.contains(model.transform(gp))); model = new OneAxisEllipsoid(100.0, 0.9, frame); point = new Vector3D(-93.7139699, 0.0, 3.5930796); direction = new Vector3D(-1.0, 0.0, 1.0); line = new Line(point, point.add(direction), 1.0e-10); gp = model.getIntersectionPoint(line, point, frame, date); Assert.assertTrue(line.contains(model.transform(gp))); Assert.assertFalse(line.contains(new Vector3D(0, 0, 7000000))); point = new Vector3D(0.0, 0.0, 110); direction = new Vector3D(0.0, 0.0, 1.0); line = new Line(point, point.add(direction), 1.0e-10); gp = model.getIntersectionPoint(line, point, frame, date); Assert.assertEquals(gp.getLatitude(), FastMath.PI / 2, 1.0e-12); point = new Vector3D(0.0, 110, 0); direction = new Vector3D(0.0, 1.0, 0.0); line = new Line(point, point.add(direction), 1.0e-10); gp = model.getIntersectionPoint(line, point, frame, date); Assert.assertEquals(gp.getLatitude(), 0, 1.0e-12); }
@Test public void testGeoCar() throws OrekitException { OneAxisEllipsoid model = new OneAxisEllipsoid( 6378137.0, 1.0 / 298.257222101, FramesFactory.getITRF(IERSConventions.IERS_2010, true)); GeodeticPoint nsp = new GeodeticPoint(0.852479154923577, 0.0423149994747243, 111.6); Vector3D p = model.transform(nsp); Assert.assertEquals(4201866.69291890, p.getX(), 1.0e-6); Assert.assertEquals(177908.184625686, p.getY(), 1.0e-6); Assert.assertEquals(4779203.64408617, p.getZ(), 1.0e-6); }
@Test public void testGroundProjectionPosition() throws OrekitException { OneAxisEllipsoid model = new OneAxisEllipsoid( Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true)); TimeStampedPVCoordinates initPV = new TimeStampedPVCoordinates( AbsoluteDate.J2000_EPOCH.shiftedBy(584.), new Vector3D(3220103., 69623., 6449822.), new Vector3D(6414.7, -2006., -3180.), Vector3D.ZERO); Frame eme2000 = FramesFactory.getEME2000(); Orbit orbit = new EquinoctialOrbit(initPV, eme2000, Constants.EIGEN5C_EARTH_MU); for (double dt = 0; dt < 3600.0; dt += 60.0) { TimeStampedPVCoordinates pv = orbit.getPVCoordinates(orbit.getDate().shiftedBy(dt), eme2000); TimeStampedPVCoordinates groundPV = model.projectToGround(pv, eme2000); Vector3D groundP = model.projectToGround(pv.getPosition(), pv.getDate(), eme2000); // check methods projectToGround and transform are consistent with each other Assert.assertEquals( model.transform(pv.getPosition(), eme2000, pv.getDate()).getLatitude(), model.transform(groundPV.getPosition(), eme2000, pv.getDate()).getLatitude(), 1.0e-10); Assert.assertEquals( model.transform(pv.getPosition(), eme2000, pv.getDate()).getLongitude(), model.transform(groundPV.getPosition(), eme2000, pv.getDate()).getLongitude(), 1.0e-10); Assert.assertEquals( 0.0, Vector3D.distance(groundP, groundPV.getPosition()), 1.0e-15 * groundP.getNorm()); } }
private void checkCartesianToEllipsoidic( double ae, double f, double x, double y, double z, double longitude, double latitude, double altitude) throws OrekitException { AbsoluteDate date = AbsoluteDate.J2000_EPOCH; Frame frame = FramesFactory.getITRF(IERSConventions.IERS_2010, true); OneAxisEllipsoid model = new OneAxisEllipsoid(ae, f, frame); GeodeticPoint gp = model.transform(new Vector3D(x, y, z), frame, date); Assert.assertEquals(longitude, MathUtils.normalizeAngle(gp.getLongitude(), longitude), 1.0e-10); Assert.assertEquals(latitude, gp.getLatitude(), 1.0e-10); Assert.assertEquals(altitude, gp.getAltitude(), 1.0e-10 * FastMath.abs(ae)); Vector3D rebuiltNadir = Vector3D.crossProduct(gp.getSouth(), gp.getWest()); Assert.assertEquals(0, rebuiltNadir.subtract(gp.getNadir()).getNorm(), 1.0e-15); }
@Test public void testIntersectionFromPoints() throws OrekitException { AbsoluteDate date = new AbsoluteDate( new DateComponents(2008, 03, 21), TimeComponents.H12, TimeScalesFactory.getUTC()); Frame frame = FramesFactory.getITRF(IERSConventions.IERS_2010, true); OneAxisEllipsoid earth = new OneAxisEllipsoid(6378136.460, 1 / 298.257222101, frame); // Satellite on polar position // *************************** final double mu = 3.9860047e14; CircularOrbit circ = new CircularOrbit( 7178000.0, 0.5e-4, 0., FastMath.toRadians(90.), FastMath.toRadians(60.), FastMath.toRadians(90.), PositionAngle.MEAN, FramesFactory.getEME2000(), date, mu); // Transform satellite position to position/velocity parameters in EME2000 and ITRF200B PVCoordinates pvSatEME2000 = circ.getPVCoordinates(); PVCoordinates pvSatItrf = frame.getTransformTo(FramesFactory.getEME2000(), date).transformPVCoordinates(pvSatEME2000); Vector3D pSatItrf = pvSatItrf.getPosition(); // Test first visible surface points GeodeticPoint geoPoint = new GeodeticPoint(FastMath.toRadians(70.), FastMath.toRadians(60.), 0.); Vector3D pointItrf = earth.transform(geoPoint); Line line = new Line(pSatItrf, pointItrf, 1.0e-10); GeodeticPoint geoInter = earth.getIntersectionPoint(line, pSatItrf, frame, date); Assert.assertEquals(geoPoint.getLongitude(), geoInter.getLongitude(), Utils.epsilonAngle); Assert.assertEquals(geoPoint.getLatitude(), geoInter.getLatitude(), Utils.epsilonAngle); // Test second visible surface points geoPoint = new GeodeticPoint(FastMath.toRadians(65.), FastMath.toRadians(-120.), 0.); pointItrf = earth.transform(geoPoint); line = new Line(pSatItrf, pointItrf, 1.0e-10); geoInter = earth.getIntersectionPoint(line, pSatItrf, frame, date); Assert.assertEquals(geoPoint.getLongitude(), geoInter.getLongitude(), Utils.epsilonAngle); Assert.assertEquals(geoPoint.getLatitude(), geoInter.getLatitude(), Utils.epsilonAngle); // Test non visible surface points geoPoint = new GeodeticPoint(FastMath.toRadians(30.), FastMath.toRadians(60.), 0.); pointItrf = earth.transform(geoPoint); line = new Line(pSatItrf, pointItrf, 1.0e-10); geoInter = earth.getIntersectionPoint(line, pSatItrf, frame, date); // For polar satellite position, intersection point is at the same longitude but different // latitude Assert.assertEquals(1.04437199, geoInter.getLongitude(), Utils.epsilonAngle); Assert.assertEquals(1.36198012, geoInter.getLatitude(), Utils.epsilonAngle); // Satellite on equatorial position // ******************************** circ = new CircularOrbit( 7178000.0, 0.5e-4, 0., FastMath.toRadians(1.e-4), FastMath.toRadians(0.), FastMath.toRadians(0.), PositionAngle.MEAN, FramesFactory.getEME2000(), date, mu); // Transform satellite position to position/velocity parameters in EME2000 and ITRF200B pvSatEME2000 = circ.getPVCoordinates(); pvSatItrf = frame.getTransformTo(FramesFactory.getEME2000(), date).transformPVCoordinates(pvSatEME2000); pSatItrf = pvSatItrf.getPosition(); // Test first visible surface points geoPoint = new GeodeticPoint(FastMath.toRadians(5.), FastMath.toRadians(0.), 0.); pointItrf = earth.transform(geoPoint); line = new Line(pSatItrf, pointItrf, 1.0e-10); Assert.assertTrue(line.toSubSpace(pSatItrf).getX() < 0); geoInter = earth.getIntersectionPoint(line, pSatItrf, frame, date); Assert.assertEquals(geoPoint.getLongitude(), geoInter.getLongitude(), Utils.epsilonAngle); Assert.assertEquals(geoPoint.getLatitude(), geoInter.getLatitude(), Utils.epsilonAngle); // With the point opposite to satellite point along the line GeodeticPoint geoInter2 = earth.getIntersectionPoint( line, line.toSpace(new Vector1D(-line.toSubSpace(pSatItrf).getX())), frame, date); Assert.assertTrue( FastMath.abs(geoInter.getLongitude() - geoInter2.getLongitude()) > FastMath.toRadians(0.1)); Assert.assertTrue( FastMath.abs(geoInter.getLatitude() - geoInter2.getLatitude()) > FastMath.toRadians(0.1)); // Test second visible surface points geoPoint = new GeodeticPoint(FastMath.toRadians(-5.), FastMath.toRadians(0.), 0.); pointItrf = earth.transform(geoPoint); line = new Line(pSatItrf, pointItrf, 1.0e-10); geoInter = earth.getIntersectionPoint(line, pSatItrf, frame, date); Assert.assertEquals(geoPoint.getLongitude(), geoInter.getLongitude(), Utils.epsilonAngle); Assert.assertEquals(geoPoint.getLatitude(), geoInter.getLatitude(), Utils.epsilonAngle); // Test non visible surface points geoPoint = new GeodeticPoint(FastMath.toRadians(40.), FastMath.toRadians(0.), 0.); pointItrf = earth.transform(geoPoint); line = new Line(pSatItrf, pointItrf, 1.0e-10); geoInter = earth.getIntersectionPoint(line, pSatItrf, frame, date); Assert.assertEquals(-0.00768481, geoInter.getLongitude(), Utils.epsilonAngle); Assert.assertEquals(0.32180410, geoInter.getLatitude(), Utils.epsilonAngle); // Satellite on any position // ************************* circ = new CircularOrbit( 7178000.0, 0.5e-4, 0., FastMath.toRadians(50.), FastMath.toRadians(0.), FastMath.toRadians(90.), PositionAngle.MEAN, FramesFactory.getEME2000(), date, mu); // Transform satellite position to position/velocity parameters in EME2000 and ITRF200B pvSatEME2000 = circ.getPVCoordinates(); pvSatItrf = frame.getTransformTo(FramesFactory.getEME2000(), date).transformPVCoordinates(pvSatEME2000); pSatItrf = pvSatItrf.getPosition(); // Test first visible surface points geoPoint = new GeodeticPoint(FastMath.toRadians(40.), FastMath.toRadians(90.), 0.); pointItrf = earth.transform(geoPoint); line = new Line(pSatItrf, pointItrf, 1.0e-10); geoInter = earth.getIntersectionPoint(line, pSatItrf, frame, date); Assert.assertEquals(geoPoint.getLongitude(), geoInter.getLongitude(), Utils.epsilonAngle); Assert.assertEquals(geoPoint.getLatitude(), geoInter.getLatitude(), Utils.epsilonAngle); // Test second visible surface points geoPoint = new GeodeticPoint(FastMath.toRadians(60.), FastMath.toRadians(90.), 0.); pointItrf = earth.transform(geoPoint); line = new Line(pSatItrf, pointItrf, 1.0e-10); geoInter = earth.getIntersectionPoint(line, pSatItrf, frame, date); Assert.assertEquals(geoPoint.getLongitude(), geoInter.getLongitude(), Utils.epsilonAngle); Assert.assertEquals(geoPoint.getLatitude(), geoInter.getLatitude(), Utils.epsilonAngle); // Test non visible surface points geoPoint = new GeodeticPoint(FastMath.toRadians(0.), FastMath.toRadians(90.), 0.); pointItrf = earth.transform(geoPoint); line = new Line(pSatItrf, pointItrf, 1.0e-10); geoInter = earth.getIntersectionPoint(line, pSatItrf, frame, date); Assert.assertEquals( FastMath.toRadians(89.5364061088196), geoInter.getLongitude(), Utils.epsilonAngle); Assert.assertEquals( FastMath.toRadians(35.555543683351125), geoInter.getLatitude(), Utils.epsilonAngle); }