List of usage examples for org.apache.commons.math3.geometry.euclidean.threed Vector3D Vector3D
public Vector3D(double x, double y, double z)
From source file:org.orekit.orbits.CartesianParametersTest.java
@Test public void testShiftCircular() { Vector3D position = new Vector3D(-29536113.0, 30329259.0, -100125.0); Vector3D velocity = new Vector3D(FastMath.sqrt(mu / position.getNorm()), position.orthogonal()); PVCoordinates pvCoordinates = new PVCoordinates(position, velocity); CartesianOrbit orbit = new CartesianOrbit(pvCoordinates, FramesFactory.getEME2000(), date, mu); testShift(orbit, new CircularOrbit(orbit), 1.0e-15); }
From source file:org.orekit.orbits.CartesianParametersTest.java
@Test public void testShiftHyperbolic() { Vector3D position = new Vector3D(-29536113.0, 30329259.0, -100125.0); Vector3D velocity = new Vector3D(3 * FastMath.sqrt(mu / position.getNorm()), position.orthogonal()); PVCoordinates pvCoordinates = new PVCoordinates(position, velocity); CartesianOrbit orbit = new CartesianOrbit(pvCoordinates, FramesFactory.getEME2000(), date, mu); testShift(orbit, new KeplerianOrbit(orbit), 1.0e-15); }
From source file:org.orekit.orbits.CartesianParametersTest.java
@Test public void testNumericalIssue135() throws OrekitException { Vector3D position = new Vector3D(-6.7884943832e7, -2.1423006112e7, -3.1603915377e7); Vector3D velocity = new Vector3D(-4732.55, -2472.086, -3022.177); PVCoordinates pvCoordinates = new PVCoordinates(position, velocity); CartesianOrbit orbit = new CartesianOrbit(pvCoordinates, FramesFactory.getEME2000(), date, 324858598826460.);/*from w w w . j a va2s. c o m*/ testShift(orbit, new KeplerianOrbit(orbit), 3.0e-15); }
From source file:org.orekit.orbits.CartesianParametersTest.java
@Test(expected = IllegalArgumentException.class) public void testNonInertialFrame() throws IllegalArgumentException { Vector3D position = new Vector3D(-26655470.0, 29881667.0, -113657.0); Vector3D velocity = new Vector3D(-1125.0, -1122.0, 195.0); PVCoordinates pvCoordinates = new PVCoordinates(position, velocity); double mu = 3.9860047e14; new CartesianOrbit(pvCoordinates, new Frame(FramesFactory.getEME2000(), Transform.IDENTITY, "non-inertial", false), date, mu); }
From source file:org.orekit.orbits.CartesianParametersTest.java
@Test public void testJacobianReference() throws OrekitException { Vector3D position = new Vector3D(-29536113.0, 30329259.0, -100125.0); Vector3D velocity = new Vector3D(-2194.0, -2141.0, -8.0); PVCoordinates pvCoordinates = new PVCoordinates(position, velocity); CartesianOrbit orbit = new CartesianOrbit(pvCoordinates, FramesFactory.getEME2000(), date, mu); double[][] jacobian = new double[6][6]; orbit.getJacobianWrtCartesian(PositionAngle.MEAN, jacobian); for (int i = 0; i < jacobian.length; i++) { double[] row = jacobian[i]; for (int j = 0; j < row.length; j++) { Assert.assertEquals((i == j) ? 1 : 0, row[j], 1.0e-15); }/*from w ww . jav a 2 s . c o m*/ } }
From source file:org.orekit.orbits.CartesianParametersTest.java
@Test public void testInterpolation() throws OrekitException { final double ehMu = 3.9860047e14; final double ae = 6.378137e6; final double c20 = -1.08263e-3; final double c30 = 2.54e-6; final double c40 = 1.62e-6; final double c50 = 2.3e-7; final double c60 = -5.5e-7; final AbsoluteDate date = AbsoluteDate.J2000_EPOCH.shiftedBy(584.); final Vector3D position = new Vector3D(3220103., 69623., 6449822.); final Vector3D velocity = new Vector3D(6414.7, -2006., -3180.); final CartesianOrbit initialOrbit = new CartesianOrbit(new PVCoordinates(position, velocity), FramesFactory.getEME2000(), date, ehMu); EcksteinHechlerPropagator propagator = new EcksteinHechlerPropagator(initialOrbit, ae, ehMu, c20, c30, c40, c50, c60);/*from w ww .ja va 2 s . c o m*/ // set up a 5 points sample List<Orbit> sample = new ArrayList<Orbit>(); for (double dt = 0; dt < 251.0; dt += 60.0) { sample.add(propagator.propagate(date.shiftedBy(dt)).getOrbit()); } // well inside the sample, interpolation should be much better than Keplerian shift // this is bacause we take the full non-Keplerian acceleration into account in // the Cartesian parameters, which in this case is preserved by the // Eckstein-Hechler propagator double maxShiftPError = 0; double maxInterpolationPError = 0; double maxShiftVError = 0; double maxInterpolationVError = 0; for (double dt = 0; dt < 240.0; dt += 1.0) { AbsoluteDate t = initialOrbit.getDate().shiftedBy(dt); PVCoordinates propagated = propagator.propagate(t).getPVCoordinates(); PVCoordinates shiftError = new PVCoordinates(propagated, initialOrbit.shiftedBy(dt).getPVCoordinates()); PVCoordinates interpolationError = new PVCoordinates(propagated, initialOrbit.interpolate(t, sample).getPVCoordinates()); maxShiftPError = FastMath.max(maxShiftPError, shiftError.getPosition().getNorm()); maxInterpolationPError = FastMath.max(maxInterpolationPError, interpolationError.getPosition().getNorm()); maxShiftVError = FastMath.max(maxShiftVError, shiftError.getVelocity().getNorm()); maxInterpolationVError = FastMath.max(maxInterpolationVError, interpolationError.getVelocity().getNorm()); } Assert.assertTrue(maxShiftPError > 390.0); Assert.assertTrue(maxInterpolationPError < 3.0e-8); Assert.assertTrue(maxShiftVError > 3.0); Assert.assertTrue(maxInterpolationVError < 2.0e-9); // if we go far past sample end, interpolation becomes worse than Keplerian shift maxShiftPError = 0; maxInterpolationPError = 0; maxShiftVError = 0; maxInterpolationVError = 0; for (double dt = 500.0; dt < 650.0; dt += 1.0) { AbsoluteDate t = initialOrbit.getDate().shiftedBy(dt); PVCoordinates propagated = propagator.propagate(t).getPVCoordinates(); PVCoordinates shiftError = new PVCoordinates(propagated, initialOrbit.shiftedBy(dt).getPVCoordinates()); PVCoordinates interpolationError = new PVCoordinates(propagated, initialOrbit.interpolate(t, sample).getPVCoordinates()); maxShiftPError = FastMath.max(maxShiftPError, shiftError.getPosition().getNorm()); maxInterpolationPError = FastMath.max(maxInterpolationPError, interpolationError.getPosition().getNorm()); maxShiftVError = FastMath.max(maxShiftVError, shiftError.getVelocity().getNorm()); maxInterpolationVError = FastMath.max(maxInterpolationVError, interpolationError.getVelocity().getNorm()); } Assert.assertTrue(maxShiftPError < 2500.0); Assert.assertTrue(maxInterpolationPError > 6000.0); Assert.assertTrue(maxShiftVError < 7.0); Assert.assertTrue(maxInterpolationVError > 170.0); }
From source file:org.orekit.orbits.CircularOrbit.java
/** {@inheritDoc} */ protected TimeStampedPVCoordinates initPVCoordinates() { // get equinoctial parameters final double equEx = getEquinoctialEx(); final double equEy = getEquinoctialEy(); final double hx = getHx(); final double hy = getHy(); final double lE = getLE(); // inclination-related intermediate parameters final double hx2 = hx * hx; final double hy2 = hy * hy; final double factH = 1. / (1 + hx2 + hy2); // reference axes defining the orbital plane final double ux = (1 + hx2 - hy2) * factH; final double uy = 2 * hx * hy * factH; final double uz = -2 * hy * factH; final double vx = uy; final double vy = (1 - hx2 + hy2) * factH; final double vz = 2 * hx * factH; // eccentricity-related intermediate parameters final double exey = equEx * equEy; final double ex2 = equEx * equEx; final double ey2 = equEy * equEy; final double e2 = ex2 + ey2; final double eta = 1 + FastMath.sqrt(1 - e2); final double beta = 1. / eta; // eccentric latitude argument final double cLe = FastMath.cos(lE); final double sLe = FastMath.sin(lE); final double exCeyS = equEx * cLe + equEy * sLe; // coordinates of position and velocity in the orbital plane final double x = a * ((1 - beta * ey2) * cLe + beta * exey * sLe - equEx); final double y = a * ((1 - beta * ex2) * sLe + beta * exey * cLe - equEy); final double factor = FastMath.sqrt(getMu() / a) / (1 - exCeyS); final double xdot = factor * (-sLe + beta * equEy * exCeyS); final double ydot = factor * (cLe - beta * equEx * exCeyS); final Vector3D position = new Vector3D(x * ux + y * vx, x * uy + y * vy, x * uz + y * vz); final double r2 = position.getNormSq(); final Vector3D velocity = new Vector3D(xdot * ux + ydot * vx, xdot * uy + ydot * vy, xdot * uz + ydot * vz); final Vector3D acceleration = new Vector3D(-getMu() / (r2 * FastMath.sqrt(r2)), position); return new TimeStampedPVCoordinates(getDate(), position, velocity, acceleration); }
From source file:org.orekit.orbits.CircularParametersTest.java
@Test public void testAnomalyEll() { // elliptic orbit Vector3D position = new Vector3D(7.0e6, 1.0e6, 4.0e6); Vector3D velocity = new Vector3D(-500.0, 8000.0, 1000.0); PVCoordinates pvCoordinates = new PVCoordinates(position, velocity); CircularOrbit p = new CircularOrbit(pvCoordinates, FramesFactory.getEME2000(), date, mu); KeplerianOrbit kep = new KeplerianOrbit(p); double e = p.getE(); double eRatio = FastMath.sqrt((1 - e) / (1 + e)); double raan = kep.getRightAscensionOfAscendingNode(); double paPraan = kep.getPerigeeArgument() + raan; double lv = 1.1; // formulations for elliptic case double lE = 2 * FastMath.atan(eRatio * FastMath.tan((lv - paPraan) / 2)) + paPraan; double lM = lE - e * FastMath.sin(lE - paPraan); p = new CircularOrbit(p.getA(), p.getCircularEx(), p.getCircularEy(), p.getRightAscensionOfAscendingNode(), p.getAlphaV(), lv - raan, PositionAngle.TRUE, p.getFrame(), date, mu); Assert.assertEquals(p.getAlphaV() + raan, lv, Utils.epsilonAngle * FastMath.abs(lv)); Assert.assertEquals(p.getAlphaE() + raan, lE, Utils.epsilonAngle * FastMath.abs(lE)); Assert.assertEquals(p.getAlphaM() + raan, lM, Utils.epsilonAngle * FastMath.abs(lM)); p = new CircularOrbit(p.getA(), p.getCircularEx(), p.getCircularEy(), p.getRightAscensionOfAscendingNode(), p.getAlphaV(), 0, PositionAngle.TRUE, p.getFrame(), date, mu); p = new CircularOrbit(p.getA(), p.getCircularEx(), p.getCircularEy(), p.getRightAscensionOfAscendingNode(), p.getAlphaV(), lE - raan, PositionAngle.ECCENTRIC, p.getFrame(), date, mu); Assert.assertEquals(p.getAlphaV() + raan, lv, Utils.epsilonAngle * FastMath.abs(lv)); Assert.assertEquals(p.getAlphaE() + raan, lE, Utils.epsilonAngle * FastMath.abs(lE)); Assert.assertEquals(p.getAlphaM() + raan, lM, Utils.epsilonAngle * FastMath.abs(lM)); p = new CircularOrbit(p.getA(), p.getCircularEx(), p.getCircularEy(), p.getRightAscensionOfAscendingNode(), p.getAlphaV(), 0, PositionAngle.TRUE, p.getFrame(), date, mu); p = new CircularOrbit(p.getA(), p.getCircularEx(), p.getCircularEy(), p.getRightAscensionOfAscendingNode(), p.getAlphaV(), lM - raan, PositionAngle.MEAN, p.getFrame(), date, mu); Assert.assertEquals(p.getAlphaV() + raan, lv, Utils.epsilonAngle * FastMath.abs(lv)); Assert.assertEquals(p.getAlphaE() + raan, lE, Utils.epsilonAngle * FastMath.abs(lE)); Assert.assertEquals(p.getAlphaM() + raan, lM, Utils.epsilonAngle * FastMath.abs(lM)); }
From source file:org.orekit.orbits.CircularParametersTest.java
@Test public void testAnomalyCirc() { Vector3D position = new Vector3D(7.0e6, 1.0e6, 4.0e6); Vector3D velocity = new Vector3D(-500.0, 8000.0, 1000.0); PVCoordinates pvCoordinates = new PVCoordinates(position, velocity); CircularOrbit p = new CircularOrbit(pvCoordinates, FramesFactory.getEME2000(), date, mu); double raan = p.getRightAscensionOfAscendingNode(); // circular orbit p = new CircularOrbit(p.getA(), 0, 0, p.getRightAscensionOfAscendingNode(), p.getAlphaV(), p.getAlphaV(), PositionAngle.TRUE, p.getFrame(), date, mu); double lv = 1.1; double lE = lv; double lM = lE; p = new CircularOrbit(p.getA(), p.getCircularEx(), p.getCircularEy(), p.getRightAscensionOfAscendingNode(), p.getAlphaV(), lv - raan, PositionAngle.TRUE, p.getFrame(), date, mu); Assert.assertEquals(p.getAlphaV() + raan, lv, Utils.epsilonAngle * FastMath.abs(lv)); Assert.assertEquals(p.getAlphaE() + raan, lE, Utils.epsilonAngle * FastMath.abs(lE)); Assert.assertEquals(p.getAlphaM() + raan, lM, Utils.epsilonAngle * FastMath.abs(lM)); p = new CircularOrbit(p.getA(), p.getCircularEx(), p.getCircularEy(), p.getRightAscensionOfAscendingNode(), p.getAlphaV(), 0, PositionAngle.TRUE, p.getFrame(), date, mu); p = new CircularOrbit(p.getA(), p.getCircularEx(), p.getCircularEy(), p.getRightAscensionOfAscendingNode(), p.getAlphaV(), lE - raan, PositionAngle.ECCENTRIC, p.getFrame(), date, mu); Assert.assertEquals(p.getAlphaV() + raan, lv, Utils.epsilonAngle * FastMath.abs(lv)); Assert.assertEquals(p.getAlphaE() + raan, lE, Utils.epsilonAngle * FastMath.abs(lE)); Assert.assertEquals(p.getAlphaM() + raan, lM, Utils.epsilonAngle * FastMath.abs(lM)); p = new CircularOrbit(p.getA(), p.getCircularEx(), p.getCircularEy(), p.getRightAscensionOfAscendingNode(), p.getAlphaV(), 0, PositionAngle.TRUE, p.getFrame(), date, mu); p = new CircularOrbit(p.getA(), p.getCircularEx(), p.getCircularEy(), p.getRightAscensionOfAscendingNode(), p.getAlphaV(), lM - raan, PositionAngle.MEAN, p.getFrame(), date, mu); Assert.assertEquals(p.getAlphaV() + raan, lv, Utils.epsilonAngle * FastMath.abs(lv)); Assert.assertEquals(p.getAlphaE() + raan, lE, Utils.epsilonAngle * FastMath.abs(lE)); Assert.assertEquals(p.getAlphaM() + raan, lM, Utils.epsilonAngle * FastMath.abs(lM)); }
From source file:org.orekit.orbits.CircularParametersTest.java
@Test public void testNumericalIssue25() throws OrekitException { Vector3D position = new Vector3D(3782116.14107698, 416663.11924914, 5875541.62103057); Vector3D velocity = new Vector3D(-6349.7848910501, 288.4061811651, 4066.9366759691); CircularOrbit orbit = new CircularOrbit(new PVCoordinates(position, velocity), FramesFactory.getEME2000(), new AbsoluteDate("2004-01-01T23:00:00.000", TimeScalesFactory.getUTC()), 3.986004415E14); Assert.assertEquals(0.0, orbit.getE(), 2.0e-14); }