List of usage examples for org.apache.commons.math3.geometry.euclidean.threed Rotation Rotation
public Rotation(Vector3D u, Vector3D v) throws MathArithmeticException
From source file:org.orekit.utils.TimeStampedAngularCoordinatesTest.java
@Test public void testInterpolationWithoutAcceleration() throws OrekitException { AbsoluteDate date = AbsoluteDate.GALILEO_EPOCH; double alpha0 = 0.5 * FastMath.PI; double omega = 0.05 * FastMath.PI; final TimeStampedAngularCoordinates reference = new TimeStampedAngularCoordinates(date, new Rotation(Vector3D.PLUS_K, alpha0), new Vector3D(omega, Vector3D.MINUS_K), Vector3D.ZERO); double[] errors = interpolationErrors(reference, 1.0); Assert.assertEquals(0.0, errors[0], 1.0e-15); Assert.assertEquals(0.0, errors[1], 3.0e-15); Assert.assertEquals(0.0, errors[2], 3.0e-14); }
From source file:org.orekit.utils.TimeStampedAngularCoordinatesTest.java
@Test public void testInterpolationWithAcceleration() throws OrekitException { AbsoluteDate date = AbsoluteDate.GALILEO_EPOCH; double alpha0 = 0.5 * FastMath.PI; double omega = 0.05 * FastMath.PI; double eta = 0.005 * FastMath.PI; final TimeStampedAngularCoordinates reference = new TimeStampedAngularCoordinates(date, new Rotation(Vector3D.PLUS_K, alpha0), new Vector3D(omega, Vector3D.MINUS_K), new Vector3D(eta, Vector3D.PLUS_J)); double[] errors = interpolationErrors(reference, 1.0); Assert.assertEquals(0.0, errors[0], 3.0e-5); Assert.assertEquals(0.0, errors[1], 2.0e-4); Assert.assertEquals(0.0, errors[2], 4.6e-3); }
From source file:org.orekit.utils.TimeStampedAngularCoordinatesTest.java
@Test public void testInterpolationRotationOnly() throws OrekitException { AbsoluteDate date = AbsoluteDate.GALILEO_EPOCH; double alpha0 = 0.5 * FastMath.PI; double omega = 0.5 * FastMath.PI; TimeStampedAngularCoordinates reference = new TimeStampedAngularCoordinates(date, new Rotation(Vector3D.PLUS_K, alpha0), new Vector3D(omega, Vector3D.MINUS_K), Vector3D.ZERO); List<TimeStampedAngularCoordinates> sample = new ArrayList<TimeStampedAngularCoordinates>(); for (double dt : new double[] { 0.0, 0.2, 0.4, 0.6, 0.8, 1.0 }) { Rotation r = reference.shiftedBy(dt).getRotation(); sample.add(new TimeStampedAngularCoordinates(date.shiftedBy(dt), r, Vector3D.ZERO, Vector3D.ZERO)); }/*from www .j a v a2 s.c o m*/ for (double dt = 0; dt < 1.0; dt += 0.001) { TimeStampedAngularCoordinates interpolated = TimeStampedAngularCoordinates .interpolate(date.shiftedBy(dt), AngularDerivativesFilter.USE_R, sample); Rotation r = interpolated.getRotation(); Vector3D rate = interpolated.getRotationRate(); Assert.assertEquals(0.0, Rotation.distance(reference.shiftedBy(dt).getRotation(), r), 3.0e-4); Assert.assertEquals(0.0, Vector3D.distance(reference.shiftedBy(dt).getRotationRate(), rate), 1.0e-2); } }
From source file:org.orekit.utils.TimeStampedAngularCoordinatesTest.java
@Test public void testInterpolationTooSmallSample() throws OrekitException { AbsoluteDate date = AbsoluteDate.GALILEO_EPOCH; double alpha0 = 0.5 * FastMath.PI; double omega = 0.5 * FastMath.PI; TimeStampedAngularCoordinates reference = new TimeStampedAngularCoordinates(date, new Rotation(Vector3D.PLUS_K, alpha0), new Vector3D(omega, Vector3D.MINUS_K), Vector3D.ZERO); List<TimeStampedAngularCoordinates> sample = new ArrayList<TimeStampedAngularCoordinates>(); Rotation r = reference.shiftedBy(0.2).getRotation(); sample.add(new TimeStampedAngularCoordinates(date.shiftedBy(0.2), r, Vector3D.ZERO, Vector3D.ZERO)); try {//from w ww .j a v a 2 s . c om TimeStampedAngularCoordinates.interpolate(date.shiftedBy(0.3), AngularDerivativesFilter.USE_R, sample); Assert.fail("an exception should have been thrown"); } catch (OrekitException oe) { Assert.assertEquals(OrekitMessages.NOT_ENOUGH_DATA_FOR_INTERPOLATION, oe.getSpecifier()); Assert.assertEquals(1, ((Integer) oe.getParts()[0]).intValue()); } }
From source file:sceneGraph.Rot.java
public Rot(DVector v, double t) { Vector3D axis = new Vector3D((double) v.x, (double) v.y, (double) v.z); double angle = (double) t; try {//from www . ja v a2s.c om rotation = new Rotation(axis, angle); } catch (Exception e) { rotation = new Rotation(new Vector3D(1, 0, 0), 0d); } }
From source file:sceneGraph.Rot.java
public Rot(DVector v, DVector u) { Vector3D begin = new Vector3D((double) v.x, (double) v.y, (double) v.z); Vector3D end = new Vector3D((double) u.x, (double) u.y, (double) u.z); try {/*from www .jav a2 s .co m*/ rotation = new Rotation(begin, end); } catch (Exception e) { rotation = new Rotation(new Vector3D(1, 0, 0), 0d); } }
From source file:sceneGraph.Rot.java
public Rot(PVector v, double t) { Vector3D axis = new Vector3D((double) v.x, (double) v.y, (double) v.z); double angle = (double) t; try {/*ww w.j a v a2s.co m*/ rotation = new Rotation(axis, angle); } catch (Exception e) { rotation = new Rotation(new Vector3D(1, 0, 0), 0d); } }
From source file:sceneGraph.Rot.java
public Rot(PVector v, PVector u) { Vector3D begin = new Vector3D((double) v.x, (double) v.y, (double) v.z); Vector3D end = new Vector3D((double) u.x, (double) u.y, (double) u.z); try {// w ww . ja v a 2 s. co m rotation = new Rotation(begin, end); } catch (Exception e) { rotation = new Rotation(new Vector3D(1, 0, 0), 0d); } }
From source file:shapeCompare.ResultsFromEvaluateCost.java
@Override public int hashCode() { float unit = 3 * algoParameters.getCELL_DIMENSION_OF_THE_PROBABILITY_MAP_ANGSTROM(); RealVector trans = this.getTranslationVector(); double x = trans.getEntry(0); double y = trans.getEntry(1); double z = trans.getEntry(2); int xInt = (int) Math.round(x / unit); int yInt = (int) Math.round(y / unit); int zInt = (int) Math.round(z / unit); RealMatrix rotMat = this.getRotationMatrix(); Rotation rotation = new Rotation(rotMat.getData(), 0.01); int unitAngleDegrees = 8; double angle = rotation.getAngle(); int angleInt = (int) Math.round((angle * 180 / Math.PI) / unitAngleDegrees); int hashcode = xInt; hashcode = hashcode * 71 + yInt;//from w w w . ja v a2 s . com hashcode = hashcode * 71 + zInt; hashcode = hashcode * 71 + angleInt; return hashcode; }