Search in sources :

Example 11 with Well1024a

use of org.hipparchus.random.Well1024a in project Orekit by CS-SI.

the class AngularCoordinatesTest method testRoundTripNoOp.

@Test
public void testRoundTripNoOp() {
    RandomGenerator random = new Well1024a(0x1e610cfe89306669l);
    for (int i = 0; i < 100; ++i) {
        Rotation r1 = randomRotation(random);
        Vector3D o1 = randomVector(random, 1.0e-2);
        Vector3D oDot1 = randomVector(random, 1.0e-2);
        AngularCoordinates ac1 = new AngularCoordinates(r1, o1, oDot1);
        Rotation r2 = randomRotation(random);
        Vector3D o2 = randomVector(random, 1.0e-2);
        Vector3D oDot2 = randomVector(random, 1.0e-2);
        AngularCoordinates ac2 = new AngularCoordinates(r2, o2, oDot2);
        AngularCoordinates roundTripSA = ac1.subtractOffset(ac2).addOffset(ac2);
        Assert.assertEquals(0.0, Rotation.distance(ac1.getRotation(), roundTripSA.getRotation()), 5.0e-16);
        Assert.assertEquals(0.0, Vector3D.distance(ac1.getRotationRate(), roundTripSA.getRotationRate()), 2.0e-17);
        Assert.assertEquals(0.0, Vector3D.distance(ac1.getRotationAcceleration(), roundTripSA.getRotationAcceleration()), 2.0e-17);
        AngularCoordinates roundTripAS = ac1.addOffset(ac2).subtractOffset(ac2);
        Assert.assertEquals(0.0, Rotation.distance(ac1.getRotation(), roundTripAS.getRotation()), 5.0e-16);
        Assert.assertEquals(0.0, Vector3D.distance(ac1.getRotationRate(), roundTripAS.getRotationRate()), 2.0e-17);
        Assert.assertEquals(0.0, Vector3D.distance(ac1.getRotationAcceleration(), roundTripAS.getRotationAcceleration()), 2.0e-17);
    }
}
Also used : Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) RandomGenerator(org.hipparchus.random.RandomGenerator) Well1024a(org.hipparchus.random.Well1024a) Test(org.junit.Test)

Example 12 with Well1024a

use of org.hipparchus.random.Well1024a in project Orekit by CS-SI.

the class AngularCoordinatesTest method testRandomInverseCrossProducts.

@Test
public void testRandomInverseCrossProducts() throws OrekitException {
    RandomGenerator generator = new Well1024a(0x52b29d8f6ac2d64bl);
    for (int i = 0; i < 10000; ++i) {
        Vector3D omega = randomVector(generator, 10 * generator.nextDouble() + 1.0);
        Vector3D v1 = randomVector(generator, 10 * generator.nextDouble() + 1.0);
        Vector3D v2 = randomVector(generator, 10 * generator.nextDouble() + 1.0);
        checkInverse(omega, v1, v2);
    }
}
Also used : Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) RandomGenerator(org.hipparchus.random.RandomGenerator) Well1024a(org.hipparchus.random.Well1024a) Test(org.junit.Test)

Example 13 with Well1024a

use of org.hipparchus.random.Well1024a in project Orekit by CS-SI.

the class AngularCoordinatesTest method testDerivativesStructures0.

@Test
public void testDerivativesStructures0() throws OrekitException {
    RandomGenerator random = new Well1024a(0x18a0a08fd63f047al);
    Rotation r = randomRotation(random);
    Vector3D o = randomVector(random, 1.0e-2);
    Vector3D oDot = randomVector(random, 1.0e-2);
    AngularCoordinates ac = new AngularCoordinates(r, o, oDot);
    AngularCoordinates rebuilt = new AngularCoordinates(ac.toDerivativeStructureRotation(0));
    Assert.assertEquals(0.0, Rotation.distance(ac.getRotation(), rebuilt.getRotation()), 1.0e-15);
    Assert.assertEquals(0.0, rebuilt.getRotationRate().getNorm(), 1.0e-15);
    Assert.assertEquals(0.0, rebuilt.getRotationAcceleration().getNorm(), 1.0e-15);
}
Also used : Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) RandomGenerator(org.hipparchus.random.RandomGenerator) Well1024a(org.hipparchus.random.Well1024a) Test(org.junit.Test)

Example 14 with Well1024a

use of org.hipparchus.random.Well1024a in project Orekit by CS-SI.

the class AngularCoordinatesTest method testRandomPVCoordinates.

@Test
public void testRandomPVCoordinates() throws OrekitException {
    RandomGenerator generator = new Well1024a(0x49eb5b92d1f94b89l);
    for (int i = 0; i < 100; ++i) {
        Rotation r = randomRotation(generator);
        Vector3D omega = randomVector(generator, 10 * generator.nextDouble() + 1.0);
        Vector3D omegaDot = randomVector(generator, 0.1 * generator.nextDouble() + 0.01);
        AngularCoordinates ref = new AngularCoordinates(r, omega, omegaDot);
        AngularCoordinates inv = ref.revert();
        for (int j = 0; j < 100; ++j) {
            PVCoordinates v1 = randomPVCoordinates(generator, 1000, 1.0, 0.001);
            PVCoordinates v2 = randomPVCoordinates(generator, 1000, 1.0, 0.0010);
            PVCoordinates u1 = inv.applyTo(v1);
            PVCoordinates u2 = inv.applyTo(v2);
            AngularCoordinates rebuilt = new AngularCoordinates(u1, u2, v1, v2, 1.0e-9);
            Assert.assertEquals(0.0, Rotation.distance(r, rebuilt.getRotation()), 4.0e-14);
            Assert.assertEquals(0.0, Vector3D.distance(omega, rebuilt.getRotationRate()), 3.0e-12 * omega.getNorm());
            Assert.assertEquals(0.0, Vector3D.distance(omegaDot, rebuilt.getRotationAcceleration()), 2.0e-6 * omegaDot.getNorm());
        }
    }
}
Also used : Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) RandomGenerator(org.hipparchus.random.RandomGenerator) Well1024a(org.hipparchus.random.Well1024a) Test(org.junit.Test)

Example 15 with Well1024a

use of org.hipparchus.random.Well1024a 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)

Aggregations

Well1024a (org.hipparchus.random.Well1024a)28 Test (org.junit.Test)28 RandomGenerator (org.hipparchus.random.RandomGenerator)27 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)17 Rotation (org.hipparchus.geometry.euclidean.threed.Rotation)13 DerivativeStructure (org.hipparchus.analysis.differentiation.DerivativeStructure)9 GeodeticPoint (org.orekit.bodies.GeodeticPoint)2 ArrayList (java.util.ArrayList)1 ExecutorService (java.util.concurrent.ExecutorService)1 DSFactory (org.hipparchus.analysis.differentiation.DSFactory)1 S2Point (org.hipparchus.geometry.spherical.twod.S2Point)1 UnitSphereRandomVectorGenerator (org.hipparchus.random.UnitSphereRandomVectorGenerator)1 OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)1 OrekitException (org.orekit.errors.OrekitException)1 AbsoluteDate (org.orekit.time.AbsoluteDate)1