List of usage examples for org.apache.commons.math3.geometry.euclidean.threed Vector3D MINUS_J
Vector3D MINUS_J
To view the source code for org.apache.commons.math3.geometry.euclidean.threed Vector3D MINUS_J.
Click Source Link
From source file:org.orekit.frames.TransformTest.java
@Test public void testShift() { // the following transform corresponds to a frame moving along the line x=1 and rotating around its -z axis // the linear motion velocity is (0, +1, 0), the angular rate is PI/2 // at t = -1 the frame origin is at (1, -1, 0), its X axis is equal to Xref and its Y axis is equal to Yref // at t = 0 the frame origin is at (1, 0, 0), its X axis is equal to -Yref and its Y axis is equal to Xref // at t = +1 the frame origin is at (1, +1, 0), its X axis is equal to -Xref and its Y axis is equal to -Yref AbsoluteDate date = AbsoluteDate.GALILEO_EPOCH; double alpha0 = 0.5 * FastMath.PI; double omega = 0.5 * FastMath.PI; Transform t = new Transform(date, new Transform(date, Vector3D.MINUS_I, Vector3D.MINUS_J, Vector3D.ZERO), new Transform(date, new Rotation(Vector3D.PLUS_K, alpha0), new Vector3D(omega, Vector3D.MINUS_K))); for (double dt = -10.0; dt < 10.0; dt += 0.125) { Transform shifted = t.shiftedBy(dt); // the following point should always remain at moving frame origin PVCoordinates expectedFixedPoint = shifted.transformPVCoordinates( new PVCoordinates(new Vector3D(1, dt, 0), Vector3D.PLUS_J, Vector3D.ZERO)); checkVector(expectedFixedPoint.getPosition(), Vector3D.ZERO, 1.0e-14); checkVector(expectedFixedPoint.getVelocity(), Vector3D.ZERO, 1.0e-14); checkVector(expectedFixedPoint.getAcceleration(), Vector3D.ZERO, 1.0e-14); // fixed frame origin apparent motion in moving frame PVCoordinates expectedApparentMotion = shifted.transformPVCoordinates(PVCoordinates.ZERO); double c = FastMath.cos(alpha0 + omega * dt); double s = FastMath.sin(alpha0 + omega * dt); Vector3D referencePosition = new Vector3D(-c + dt * s, -s - dt * c, 0); Vector3D referenceVelocity = new Vector3D((1 + omega) * s + dt * omega * c, -(1 + omega) * c + dt * omega * s, 0); Vector3D referenceAcceleration = new Vector3D(omega * (2 + omega) * c - dt * omega * omega * s, omega * (2 + omega) * s + dt * omega * omega * c, 0); checkVector(expectedApparentMotion.getPosition(), referencePosition, 1.0e-14); checkVector(expectedApparentMotion.getVelocity(), referenceVelocity, 1.0e-14); checkVector(expectedApparentMotion.getAcceleration(), referenceAcceleration, 1.0e-14); }/*from w ww. j av a 2s. c o m*/ }
From source file:org.orekit.utils.AngularCoordinatesTest.java
@Test public void testCancellingDerivatives() throws OrekitException { PVCoordinates u1 = new PVCoordinates( new Vector3D(-0.4466591282528639, -0.009657376949231283, -0.894652087807798), new Vector3D(-8.897296517803556E-4, 2.7825250920407674E-4, 4.411979658413134E-4), new Vector3D(4.753127475302486E-7, 1.0209400376727623E-8, 9.515403756524403E-7)); PVCoordinates u2 = new PVCoordinates( new Vector3D(0.23723907259910096, 0.9628700806685033, -0.1288364474275361), new Vector3D(-7.98741002062555E-24, 2.4979687659429984E-24, 3.9607863426704016E-24), new Vector3D(-3.150541868418562E-23, 9.856329862034835E-24, 1.5648124883326986E-23)); PVCoordinates v1 = new PVCoordinates(Vector3D.PLUS_K, Vector3D.ZERO, Vector3D.ZERO); PVCoordinates v2 = new PVCoordinates(Vector3D.MINUS_J, Vector3D.ZERO, Vector3D.ZERO); AngularCoordinates ac = new AngularCoordinates(u1, u2, v1, v2, 1.0e-9); PVCoordinates v1Computed = ac.applyTo(u1); PVCoordinates v2Computed = ac.applyTo(u2); Assert.assertEquals(0, Vector3D.distance(v1.getPosition(), v1Computed.getPosition()), 1.0e-15); Assert.assertEquals(0, Vector3D.distance(v2.getPosition(), v2Computed.getPosition()), 1.0e-15); Assert.assertEquals(0, Vector3D.distance(v1.getVelocity(), v1Computed.getVelocity()), 1.0e-15); Assert.assertEquals(0, Vector3D.distance(v2.getVelocity(), v2Computed.getVelocity()), 1.0e-15); Assert.assertEquals(0, Vector3D.distance(v1.getAcceleration(), v1Computed.getAcceleration()), 1.0e-15); Assert.assertEquals(0, Vector3D.distance(v2.getAcceleration(), v2Computed.getAcceleration()), 1.0e-15); }