List of usage examples for org.apache.commons.math3.geometry.euclidean.threed Vector3D getNorm
public double getNorm()
From source file:org.orekit.forces.SphericalSpacecraft.java
/** {@inheritDoc} */ public Vector3D dragAcceleration(final AbsoluteDate date, final Frame frame, final Vector3D position, final Rotation rotation, final double mass, final double density, final Vector3D relativeVelocity) { return new Vector3D(relativeVelocity.getNorm() * density * dragCoeff * crossSection / (2 * mass), relativeVelocity);//from w w w . java 2s . c o m }
From source file:org.orekit.forces.SphericalSpacecraft.java
/** {@inheritDoc} */ public FieldVector3D<DerivativeStructure> dragAcceleration(final AbsoluteDate date, final Frame frame, final Vector3D position, final Rotation rotation, final double mass, final double density, final Vector3D relativeVelocity, final String paramName) throws OrekitException { if (!DRAG_COEFFICIENT.equals(paramName)) { throw new OrekitException(OrekitMessages.UNSUPPORTED_PARAMETER_NAME, paramName, DRAG_COEFFICIENT); }// w ww . j a v a 2 s. c o m final DerivativeStructure dragCoeffDS = new DerivativeStructure(1, 1, 0, dragCoeff); return new FieldVector3D<DerivativeStructure>( dragCoeffDS.multiply(relativeVelocity.getNorm() * density * crossSection / (2 * mass)), relativeVelocity); }
From source file:org.orekit.forces.SphericalSpacecraftTest.java
@Test public void testRadiationPressure() throws OrekitException { AbsoluteDate date = new AbsoluteDate(new DateComponents(2008, 04, 07), TimeComponents.H00, TimeScalesFactory.getTAI()); // Satellite position as circular parameters final double mu = 3.9860047e14; final double raan = 270.; Orbit circ = new CircularOrbit(7178000.0, 0.5e-4, -0.5e-4, FastMath.toRadians(50.), FastMath.toRadians(raan), FastMath.toRadians(5.300 - raan), PositionAngle.MEAN, FramesFactory.getEME2000(), date, mu); SpacecraftState state = new SpacecraftState(circ); double surface = 5.0; double kA = 0.9; double kR = 0.1; SphericalSpacecraft s = new SphericalSpacecraft(surface, 0.0, kA, kR); Vector3D flux = new Vector3D(36.0, 48.0, 80.0); Vector3D computedAcceleration = s.radiationPressureAcceleration(state.getDate(), state.getFrame(), state.getPVCoordinates().getPosition(), state.getAttitude().getRotation(), state.getMass(), flux); Vector3D d = flux.normalize(); double f = flux.getNorm(); double p = (1 - kA) * (1 - kR); Vector3D expectedAcceleration = new Vector3D(surface * f * (1 + 4 * p / 9) / state.getMass(), d); Assert.assertEquals(0.0, computedAcceleration.subtract(expectedAcceleration).getNorm(), 1.0e-15); }
From source file:org.orekit.frames.EME2000ProviderTest.java
private void checkPV(PVCoordinates reference, PVCoordinates result, double positionThreshold, double velocityThreshold) { Vector3D dP = result.getPosition().subtract(reference.getPosition()); Vector3D dV = result.getVelocity().subtract(reference.getVelocity()); Assert.assertEquals(0, dP.getNorm(), positionThreshold); Assert.assertEquals(0, dV.getNorm(), velocityThreshold); }
From source file:org.orekit.frames.FrameTest.java
@Test public void testH0m9() throws OrekitException { AbsoluteDate h0 = new AbsoluteDate("2010-07-01T10:42:09", TimeScalesFactory.getUTC()); Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true); Frame rotatingPadFrame = new TopocentricFrame( new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, itrf),/*from www . j av a 2 s.co m*/ new GeodeticPoint(FastMath.toRadians(5.0), FastMath.toRadians(-100.0), 0.0), "launch pad"); // create a new inertially oriented frame that is aligned with ITRF2005 at h0 - 9 seconds AbsoluteDate h0M9 = h0.shiftedBy(-9.0); Frame eme2000 = FramesFactory.getEME2000(); Frame frozenLaunchFrame = rotatingPadFrame.getFrozenFrame(eme2000, h0M9, "launch frame"); // check velocity module is unchanged Vector3D pEme2000 = new Vector3D(-29536113.0, 30329259.0, -100125.0); Vector3D vEme2000 = new Vector3D(-2194.0, -2141.0, -8.0); PVCoordinates pvEme2000 = new PVCoordinates(pEme2000, vEme2000); PVCoordinates pvH0m9 = eme2000.getTransformTo(frozenLaunchFrame, h0M9).transformPVCoordinates(pvEme2000); Assert.assertEquals(vEme2000.getNorm(), pvH0m9.getVelocity().getNorm(), 1.0e-6); // this frame is fixed with respect to EME2000 but rotates with respect to the non-frozen one // the following loop should have a fixed angle a1 and an evolving angle a2 double minA1 = Double.POSITIVE_INFINITY; double maxA1 = Double.NEGATIVE_INFINITY; double minA2 = Double.POSITIVE_INFINITY; double maxA2 = Double.NEGATIVE_INFINITY; double dt; for (dt = 0; dt < 86164; dt += 300.0) { AbsoluteDate date = h0M9.shiftedBy(dt); double a1 = frozenLaunchFrame.getTransformTo(eme2000, date).getRotation().getAngle(); double a2 = frozenLaunchFrame.getTransformTo(rotatingPadFrame, date).getRotation().getAngle(); minA1 = FastMath.min(minA1, a1); maxA1 = FastMath.max(maxA1, a1); minA2 = FastMath.min(minA2, a2); maxA2 = FastMath.max(maxA2, a2); } Assert.assertEquals(0, maxA1 - minA1, 1.0e-12); Assert.assertEquals(FastMath.PI, maxA2 - minA2, 0.01); }
From source file:org.orekit.frames.GTODProviderTest.java
private void checkPV(PVCoordinates reference, PVCoordinates result, double expectedPositionError, double expectedVelocityError) { Vector3D dP = result.getPosition().subtract(reference.getPosition()); Vector3D dV = result.getVelocity().subtract(reference.getVelocity()); Assert.assertEquals(expectedPositionError, dP.getNorm(), 0.01 * expectedPositionError); Assert.assertEquals(expectedVelocityError, dV.getNorm(), 0.01 * expectedVelocityError); }
From source file:org.orekit.frames.HelmertTransformation.java
/** Compute the transform at some date. * @param date date at which the transform is desired * @return computed transform at specified date */// w ww. ja v a 2s. c o m public Transform getTransform(final AbsoluteDate date) { // compute parameters evolution since reference epoch final double dt = date.durationFrom(epoch); final Vector3D dR = new Vector3D(1, rotationVector, dt, rotationRate); // build translation part final Transform translationTransform = new Transform(date, cartesian.shiftedBy(dt)); // build rotation part final double angle = dR.getNorm(); final Transform rotationTransform = new Transform(date, (angle < Precision.SAFE_MIN) ? Rotation.IDENTITY : new Rotation(dR, angle), rotationRate); // combine both parts return new Transform(date, translationTransform, rotationTransform); }
From source file:org.orekit.frames.HelmertTransformationTest.java
@Test public void testHelmert20052008() throws OrekitException { Frame itrf2008 = FramesFactory.getITRF(IERSConventions.IERS_2010, true); Frame itrf2005 = HelmertTransformation.Predefined.ITRF_2008_TO_ITRF_2005.createTransformedITRF(itrf2008, "2005"); Vector3D pos2005 = new Vector3D(1234567.8, 2345678.9, 3456789.0); // check the Helmert transformation as per http://itrf.ign.fr/ITRF_solutions/2008/tp_08-05.php AbsoluteDate date = new AbsoluteDate(2005, 1, 1, 12, 0, 0, TimeScalesFactory.getTT()); Vector3D pos2008 = itrf2005.getTransformTo(itrf2008, date).transformPosition(pos2005); Vector3D generalOffset = pos2005.subtract(pos2008); Vector3D linearOffset = computeOffsetLinearly(-0.5, -0.9, -4.7, 0.000, 0.000, 0.000, 0.3, 0.0, 0.0, 0.000, 0.000, 0.000, pos2005, 0.0); Vector3D error = generalOffset.subtract(linearOffset); Assert.assertEquals(0.0, error.getNorm(), 2.0e-13 * pos2005.getNorm()); date = date.shiftedBy(Constants.JULIAN_YEAR); pos2008 = itrf2005.getTransformTo(itrf2008, date).transformPosition(pos2005); generalOffset = pos2005.subtract(pos2008); linearOffset = computeOffsetLinearly(-0.5, -0.9, -4.7, 0.000, 0.000, 0.000, 0.3, 0.0, 0.0, 0.000, 0.000, 0.000, pos2005, 1.0);/* w w w. ja v a 2 s .c o m*/ error = generalOffset.subtract(linearOffset); Assert.assertEquals(0.0, error.getNorm(), 2.0e-13 * pos2005.getNorm()); }
From source file:org.orekit.frames.HelmertTransformationTest.java
@Test public void testHelmert20002005() throws OrekitException { Frame itrf2008 = FramesFactory.getITRF(IERSConventions.IERS_2010, true); Frame itrf2000 = HelmertTransformation.Predefined.ITRF_2008_TO_ITRF_2000.createTransformedITRF(itrf2008, "2000"); Frame itrf2005 = HelmertTransformation.Predefined.ITRF_2008_TO_ITRF_2005.createTransformedITRF(itrf2008, "2005"); Vector3D pos2000 = new Vector3D(1234567.8, 2345678.9, 3456789.0); // check the Helmert transformation as per http://itrf.ign.fr/ITRF_solutions/2005/tp_05-00.php AbsoluteDate date = AbsoluteDate.J2000_EPOCH; Vector3D pos2005 = itrf2000.getTransformTo(itrf2005, date).transformPosition(pos2000); Vector3D generalOffset = pos2000.subtract(pos2005); Vector3D linearOffset = computeOffsetLinearly(0.1, -0.8, -5.8, 0.000, 0.000, 0.000, -0.2, 0.1, -1.8, 0.000, 0.000, 0.000, pos2000, 0.0); Vector3D error = generalOffset.subtract(linearOffset); Assert.assertEquals(0.0, error.getNorm(), FastMath.ulp(pos2000.getNorm())); date = date.shiftedBy(Constants.JULIAN_YEAR); pos2005 = itrf2000.getTransformTo(itrf2005, date).transformPosition(pos2000); generalOffset = pos2000.subtract(pos2005); linearOffset = computeOffsetLinearly(0.1, -0.8, -5.8, 0.000, 0.000, 0.000, -0.2, 0.1, -1.8, 0.000, 0.000, 0.000, pos2000, 1.0);/*from w w w. j a v a 2 s.c o m*/ error = generalOffset.subtract(linearOffset); Assert.assertEquals(0.0, error.getNorm(), FastMath.ulp(pos2000.getNorm())); }
From source file:org.orekit.frames.HelmertTransformationTest.java
@Test public void testHelmert19972000() throws OrekitException { Frame itrf2008 = FramesFactory.getITRF(IERSConventions.IERS_2010, true); Frame itrf2000 = HelmertTransformation.Predefined.ITRF_2008_TO_ITRF_2000.createTransformedITRF(itrf2008, "2000"); Frame itrf97 = HelmertTransformation.Predefined.ITRF_2008_TO_ITRF_97.createTransformedITRF(itrf2008, "97"); Vector3D pos97 = new Vector3D(1234567.8, 2345678.9, 3456789.0); // check the Helmert transformation as per ftp://itrf.ensg.ign.fr/pub/itrf/ITRF.TP AbsoluteDate date = new AbsoluteDate(1997, 1, 1, 12, 0, 0, TimeScalesFactory.getTT()); Vector3D pos2000 = itrf97.getTransformTo(itrf2000, date).transformPosition(pos97); Vector3D generalOffset = pos97.subtract(pos2000); Vector3D linearOffset = computeOffsetLinearly(6.7, 6.1, -18.5, 0.000, 0.000, 0.000, 0.0, -0.6, -1.4, 0.000, 0.000, 0.002, pos2000, 0.0); Vector3D error = generalOffset.subtract(linearOffset); Assert.assertEquals(0.0, error.getNorm(), 2.0e-11 * pos97.getNorm()); date = date.shiftedBy(Constants.JULIAN_YEAR); pos2000 = itrf97.getTransformTo(itrf2000, date).transformPosition(pos97); generalOffset = pos97.subtract(pos2000); linearOffset = computeOffsetLinearly(6.7, 6.1, -18.5, 0.000, 0.000, 0.000, 0.0, -0.6, -1.4, 0.000, 0.000, 0.002, pos2000, 1.0);/* www . j a v a 2 s .c om*/ error = generalOffset.subtract(linearOffset); Assert.assertEquals(0.0, error.getNorm(), 6.0e-11 * pos97.getNorm()); }