Search in sources :

Example 31 with GeodeticPoint

use of org.orekit.bodies.GeodeticPoint in project Orekit by CS-SI.

the class TopocentricFrameTest method testZero.

@Test
public void testZero() {
    final GeodeticPoint point = new GeodeticPoint(0., 0., 0.);
    final TopocentricFrame topoFrame = new TopocentricFrame(earthSpheric, point, "zero");
    // Check that frame directions are aligned
    final double xDiff = Vector3D.dotProduct(topoFrame.getEast(), Vector3D.PLUS_J);
    final double yDiff = Vector3D.dotProduct(topoFrame.getNorth(), Vector3D.PLUS_K);
    final double zDiff = Vector3D.dotProduct(topoFrame.getZenith(), Vector3D.PLUS_I);
    Assert.assertEquals(1., xDiff, Utils.epsilonTest);
    Assert.assertEquals(1., yDiff, Utils.epsilonTest);
    Assert.assertEquals(1., zDiff, Utils.epsilonTest);
}
Also used : GeodeticPoint(org.orekit.bodies.GeodeticPoint) Test(org.junit.Test)

Example 32 with GeodeticPoint

use of org.orekit.bodies.GeodeticPoint in project Orekit by CS-SI.

the class TopocentricFrameTest method testPointAtDistance.

@Test
public void testPointAtDistance() throws OrekitException {
    RandomGenerator random = new Well1024a(0xa1e6bd5cd0578779l);
    final OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, itrf);
    final AbsoluteDate date = AbsoluteDate.J2000_EPOCH;
    for (int i = 0; i < 20; ++i) {
        // we don't need uniform point on the sphere, just a few different test configurations
        double latitude = FastMath.PI * (0.5 - random.nextDouble());
        double longitude = 2 * FastMath.PI * random.nextDouble();
        TopocentricFrame topo = new TopocentricFrame(earth, new GeodeticPoint(latitude, longitude, 0.0), "topo");
        Transform transform = earth.getBodyFrame().getTransformTo(topo, date);
        for (int j = 0; j < 20; ++j) {
            double elevation = FastMath.PI * (0.5 - random.nextDouble());
            double azimuth = 2 * FastMath.PI * random.nextDouble();
            double range = 500000.0 * (1.0 + random.nextDouble());
            Vector3D absolutePoint = earth.transform(topo.pointAtDistance(azimuth, elevation, range));
            Vector3D relativePoint = transform.transformPosition(absolutePoint);
            double rebuiltElevation = topo.getElevation(relativePoint, topo, AbsoluteDate.J2000_EPOCH);
            double rebuiltAzimuth = topo.getAzimuth(relativePoint, topo, AbsoluteDate.J2000_EPOCH);
            double rebuiltRange = topo.getRange(relativePoint, topo, AbsoluteDate.J2000_EPOCH);
            Assert.assertEquals(elevation, rebuiltElevation, 1.0e-12);
            Assert.assertEquals(azimuth, MathUtils.normalizeAngle(rebuiltAzimuth, azimuth), 1.0e-12);
            Assert.assertEquals(range, rebuiltRange, 1.0e-12 * range);
        }
    }
}
Also used : OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) GeodeticPoint(org.orekit.bodies.GeodeticPoint) RandomGenerator(org.hipparchus.random.RandomGenerator) AbsoluteDate(org.orekit.time.AbsoluteDate) GeodeticPoint(org.orekit.bodies.GeodeticPoint) Well1024a(org.hipparchus.random.Well1024a) Test(org.junit.Test)

Example 33 with GeodeticPoint

use of org.orekit.bodies.GeodeticPoint in project Orekit by CS-SI.

the class TopocentricFrameTest method testSiteAtZenith.

@Test
public void testSiteAtZenith() throws OrekitException {
    // Surface point at latitude 45°
    final GeodeticPoint point = new GeodeticPoint(FastMath.toRadians(45.), FastMath.toRadians(30.), 0.);
    final TopocentricFrame topoFrame = new TopocentricFrame(earthSpheric, point, "lon 30 lat 45");
    // Point at 800 km over zenith
    final GeodeticPoint satPoint = new GeodeticPoint(FastMath.toRadians(45.), FastMath.toRadians(30.), 800000.);
    // Zenith point elevation = 90 deg
    final double site = topoFrame.getElevation(earthSpheric.transform(satPoint), earthSpheric.getBodyFrame(), date);
    Assert.assertEquals(FastMath.PI / 2., site, Utils.epsilonAngle);
    // Zenith point range = defined altitude
    final double range = topoFrame.getRange(earthSpheric.transform(satPoint), earthSpheric.getBodyFrame(), date);
    Assert.assertEquals(800000., range, 1e-8);
}
Also used : GeodeticPoint(org.orekit.bodies.GeodeticPoint) Test(org.junit.Test)

Example 34 with GeodeticPoint

use of org.orekit.bodies.GeodeticPoint in project Orekit by CS-SI.

the class TopocentricFrameTest method testNormalLatitudes.

@Test
public void testNormalLatitudes() {
    // First point at latitude 45°
    final GeodeticPoint point1 = new GeodeticPoint(FastMath.toRadians(45.), FastMath.toRadians(30.), 0.);
    final TopocentricFrame topoFrame1 = new TopocentricFrame(earthSpheric, point1, "lat 45");
    // Second point at latitude -45° and same longitude
    final GeodeticPoint point2 = new GeodeticPoint(FastMath.toRadians(-45.), FastMath.toRadians(30.), 0.);
    final TopocentricFrame topoFrame2 = new TopocentricFrame(earthSpheric, point2, "lat -45");
    // Check that frame North and Zenith directions are all normal to each other, and East are the same
    final double xDiff = Vector3D.dotProduct(topoFrame1.getEast(), topoFrame2.getEast());
    final double yDiff = Vector3D.dotProduct(topoFrame1.getNorth(), topoFrame2.getNorth());
    final double zDiff = Vector3D.dotProduct(topoFrame1.getZenith(), topoFrame2.getZenith());
    Assert.assertEquals(1., xDiff, Utils.epsilonTest);
    Assert.assertEquals(0., yDiff, Utils.epsilonTest);
    Assert.assertEquals(0., zDiff, Utils.epsilonTest);
}
Also used : GeodeticPoint(org.orekit.bodies.GeodeticPoint) Test(org.junit.Test)

Example 35 with GeodeticPoint

use of org.orekit.bodies.GeodeticPoint in project Orekit by CS-SI.

the class TopocentricFrameTest method testEllipticEarth.

@Test
public void testEllipticEarth() throws OrekitException {
    // Elliptic earth shape
    final OneAxisEllipsoid earthElliptic = new OneAxisEllipsoid(6378136.460, 1 / 298.257222101, itrf);
    // Satellite point
    // Caution !!! Sat point target shall be the same whatever earth shape chosen !!
    final GeodeticPoint satPointGeo = new GeodeticPoint(FastMath.toRadians(30.), FastMath.toRadians(15.), 800000.);
    final Vector3D satPoint = earthElliptic.transform(satPointGeo);
    // ****************************
    // Test at equatorial position
    // ****************************
    GeodeticPoint point = new GeodeticPoint(FastMath.toRadians(0.), FastMath.toRadians(5.), 0.);
    TopocentricFrame topoElliptic = new TopocentricFrame(earthElliptic, point, "elliptic, equatorial lon 5");
    TopocentricFrame topoSpheric = new TopocentricFrame(earthSpheric, point, "spheric, equatorial lon 5");
    // Compare azimuth/elevation/range of satellite point : shall be strictly identical
    // ***************************************************
    double aziElli = topoElliptic.getAzimuth(satPoint, earthElliptic.getBodyFrame(), date);
    double aziSphe = topoSpheric.getAzimuth(satPoint, earthSpheric.getBodyFrame(), date);
    Assert.assertEquals(aziElli, aziSphe, Utils.epsilonAngle);
    double eleElli = topoElliptic.getElevation(satPoint, earthElliptic.getBodyFrame(), date);
    double eleSphe = topoSpheric.getElevation(satPoint, earthSpheric.getBodyFrame(), date);
    Assert.assertEquals(eleElli, eleSphe, Utils.epsilonAngle);
    double disElli = topoElliptic.getRange(satPoint, earthElliptic.getBodyFrame(), date);
    double disSphe = topoSpheric.getRange(satPoint, earthSpheric.getBodyFrame(), date);
    Assert.assertEquals(disElli, disSphe, Utils.epsilonTest);
    // Infinite point separated by -20 deg in longitude
    // *************************************************
    GeodeticPoint infPointGeo = new GeodeticPoint(FastMath.toRadians(0.), FastMath.toRadians(-15.), 1000000000.);
    Vector3D infPoint = earthElliptic.transform(infPointGeo);
    // Azimuth = pi/2
    aziElli = topoElliptic.getAzimuth(infPoint, earthElliptic.getBodyFrame(), date);
    Assert.assertEquals(3 * FastMath.PI / 2., aziElli, Utils.epsilonAngle);
    // Site = pi/2 - longitude difference
    eleElli = topoElliptic.getElevation(infPoint, earthElliptic.getBodyFrame(), date);
    Assert.assertEquals(FastMath.PI / 2. - FastMath.abs(point.getLongitude() - infPointGeo.getLongitude()), eleElli, 1.e-2);
    // Infinite point separated by +20 deg in longitude
    // *************************************************
    infPointGeo = new GeodeticPoint(FastMath.toRadians(0.), FastMath.toRadians(25.), 1000000000.);
    infPoint = earthElliptic.transform(infPointGeo);
    // Azimuth = pi/2
    aziElli = topoElliptic.getAzimuth(infPoint, earthElliptic.getBodyFrame(), date);
    Assert.assertEquals(FastMath.PI / 2., aziElli, Utils.epsilonAngle);
    // Site = pi/2 - longitude difference
    eleElli = topoElliptic.getElevation(infPoint, earthElliptic.getBodyFrame(), date);
    Assert.assertEquals(FastMath.PI / 2. - FastMath.abs(point.getLongitude() - infPointGeo.getLongitude()), eleElli, 1.e-2);
    // ************************
    // Test at polar position
    // ************************
    point = new GeodeticPoint(FastMath.toRadians(89.999), FastMath.toRadians(0.), 0.);
    topoSpheric = new TopocentricFrame(earthSpheric, point, "lon 0 lat 90");
    topoElliptic = new TopocentricFrame(earthElliptic, point, "lon 0 lat 90");
    // Compare azimuth/elevation/range of satellite point : slight difference due to earth flatness
    // ***************************************************
    aziElli = topoElliptic.getAzimuth(satPoint, earthElliptic.getBodyFrame(), date);
    aziSphe = topoSpheric.getAzimuth(satPoint, earthSpheric.getBodyFrame(), date);
    Assert.assertEquals(aziElli, aziSphe, 1.e-7);
    eleElli = topoElliptic.getElevation(satPoint, earthElliptic.getBodyFrame(), date);
    eleSphe = topoSpheric.getElevation(satPoint, earthSpheric.getBodyFrame(), date);
    Assert.assertEquals(eleElli, eleSphe, 1.e-2);
    disElli = topoElliptic.getRange(satPoint, earthElliptic.getBodyFrame(), date);
    disSphe = topoSpheric.getRange(satPoint, earthSpheric.getBodyFrame(), date);
    Assert.assertEquals(disElli, disSphe, 20.e+3);
    // *********************
    // Test at any position
    // *********************
    point = new GeodeticPoint(FastMath.toRadians(60), FastMath.toRadians(30.), 0.);
    topoSpheric = new TopocentricFrame(earthSpheric, point, "lon 10 lat 45");
    topoElliptic = new TopocentricFrame(earthElliptic, point, "lon 10 lat 45");
    // Compare azimuth/elevation/range of satellite point : slight difference
    // ***************************************************
    aziElli = topoElliptic.getAzimuth(satPoint, earthElliptic.getBodyFrame(), date);
    aziSphe = topoSpheric.getAzimuth(satPoint, earthSpheric.getBodyFrame(), date);
    Assert.assertEquals(aziElli, aziSphe, 1.e-2);
    eleElli = topoElliptic.getElevation(satPoint, earthElliptic.getBodyFrame(), date);
    eleSphe = topoSpheric.getElevation(satPoint, earthSpheric.getBodyFrame(), date);
    Assert.assertEquals(eleElli, eleSphe, 1.e-2);
    disElli = topoElliptic.getRange(satPoint, earthElliptic.getBodyFrame(), date);
    disSphe = topoSpheric.getRange(satPoint, earthSpheric.getBodyFrame(), date);
    Assert.assertEquals(disElli, disSphe, 20.e+3);
}
Also used : OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) GeodeticPoint(org.orekit.bodies.GeodeticPoint) Test(org.junit.Test)

Aggregations

GeodeticPoint (org.orekit.bodies.GeodeticPoint)133 Test (org.junit.Test)78 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)67 OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)61 AbsoluteDate (org.orekit.time.AbsoluteDate)45 TopocentricFrame (org.orekit.frames.TopocentricFrame)35 Frame (org.orekit.frames.Frame)34 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)27 SpacecraftState (org.orekit.propagation.SpacecraftState)26 Propagator (org.orekit.propagation.Propagator)24 OrekitException (org.orekit.errors.OrekitException)23 KeplerianPropagator (org.orekit.propagation.analytical.KeplerianPropagator)23 FieldVector3D (org.hipparchus.geometry.euclidean.threed.FieldVector3D)22 PVCoordinates (org.orekit.utils.PVCoordinates)20 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)19 BodyShape (org.orekit.bodies.BodyShape)17 Orbit (org.orekit.orbits.Orbit)15 Rotation (org.hipparchus.geometry.euclidean.threed.Rotation)13 ArrayList (java.util.ArrayList)12 FieldGeodeticPoint (org.orekit.bodies.FieldGeodeticPoint)12