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.frames.TransformTest.java
private Transform evolvingTransform(final AbsoluteDate t0, final double dt) { // the following transform corresponds to a frame moving along the circle r = 1 // with its x axis always pointing to the reference frame center final double omega = 0.2; final AbsoluteDate date = t0.shiftedBy(dt); final double cos = FastMath.cos(omega * dt); final double sin = FastMath.sin(omega * dt); return new Transform(date, new Transform(date, new Vector3D(-cos, -sin, 0), new Vector3D(omega * sin, -omega * cos, 0), new Vector3D(omega * omega * cos, omega * omega * sin, 0)), new Transform(date, new Rotation(Vector3D.PLUS_K, FastMath.PI - omega * dt), new Vector3D(omega, Vector3D.PLUS_K))); }
From source file:org.orekit.frames.TransformTest.java
private Vector3D randomVector(double scale, RandomGenerator random) { return new Vector3D(random.nextDouble() * scale, random.nextDouble() * scale, random.nextDouble() * scale); }
From source file:org.orekit.frames.VEISFrameTest.java
@Test public void testRefLEO() throws OrekitException { AbsoluteDate date0 = new AbsoluteDate(new DateComponents(2004, 04, 06), new TimeComponents(07, 51, 28.386009), TimeScalesFactory.getUTC()); Transform t0 = FramesFactory.getEME2000().getTransformTo(FramesFactory.getVeis1950(), date0); // J2000// w w w .j a v a 2 s .c om PVCoordinates pvJ2000 = new PVCoordinates(new Vector3D(5102509.6000, 6123011.5200, 6378136.3000), new Vector3D(-4743.219600, 790.536600, 5533.756190)); // the following result were obtained using this code in mslib Fortran library // model = pm_lieske_wahr // jul1950%jour = 19819 ! 2004-04-06 // jul1950%sec = 28288.386009_pm_reel ! 07:51:28.386009 // delta_tu1 = 0.0_pm_reel ! 0.0 dtu1 as here we don't use EOP corrections // delta_tai = 32.0_pm_reel ! TAI - UTC // pos_J2000(1) = 5102509.6000_pm_reel // pos_J2000(2) = 6123011.5200_pm_reel // pos_J2000(3) = 6378136.3000_pm_reel // vit_J2000(1) = -4743.219600_pm_reel // vit_J2000(2) = 790.536600_pm_reel // vit_J2000(3) = 5533.756190_pm_reel // call mr_J2000_veis (model, jul1950, delta_tu1, delta_tai, pos_J2000, pos_veis, code_retour, & // vit_J2000, vit_veis, jacob ) PVCoordinates pvVEIS = new PVCoordinates( new Vector3D(5168161.5980523797, 6065377.6711138152, 6380344.5327578690), new Vector3D(-4736.2464648667, 843.3525998501, 5531.9312750395)); PVCoordinates delta0 = new PVCoordinates(t0.transformPVCoordinates(pvJ2000), pvVEIS); Assert.assertEquals(0.0, delta0.getPosition().getNorm(), 7.0e-4); Assert.assertEquals(0.0, delta0.getVelocity().getNorm(), 8.0e-5); }
From source file:org.orekit.frames.VEISFrameTest.java
@Test public void testRefGEO() throws OrekitException { AbsoluteDate date0 = new AbsoluteDate(new DateComponents(2004, 06, 01), TimeComponents.H00, TimeScalesFactory.getUTC()); Transform t0 = FramesFactory.getEME2000().getTransformTo(FramesFactory.getVeis1950(), date0); //J2000//from w ww. jav a 2s . c om PVCoordinates pvJ2000 = new PVCoordinates(new Vector3D(-40588150.3620, -11462167.0280, 27147.6490), new Vector3D(834.787457, -2958.305691, -1.173016)); // the following result were obtained using this code in mslib Fortran library // model = pm_lieske_wahr // jul1950%jour = 19875 ! 2004-06-01 // jul1950%sec = 0.0_pm_reel ! 00:00:00.000 // delta_tu1 = 0.0_pm_reel ! 0.0 dtu1 as here we don't use EOP corrections // delta_tai = 32.0_pm_reel // pos_J2000(1) = -40588150.3620_pm_reel // pos_J2000(2) = -11462167.0280_pm_reel // pos_J2000(3) = 27147.6490_pm_reel // vit_J2000(1) = 834.787457_pm_reel // vit_J2000(2) = -2958.305691_pm_reel // vit_J2000(3) = -1.173016_pm_reel PVCoordinates pvVEIS = new PVCoordinates( new Vector3D(-40713785.1340916604, -11007613.4509160239, 10293.2583441036), new Vector3D(801.6573208750, -2967.4549256851, -0.9288811067)); PVCoordinates delta0 = new PVCoordinates(t0.transformPVCoordinates(pvJ2000), pvVEIS); Assert.assertEquals(0.0, delta0.getPosition().getNorm(), 4.0e-4); Assert.assertEquals(0.0, delta0.getVelocity().getNorm(), 4.0e-4); }
From source file:org.orekit.models.earth.GeoidTest.java
/** * check {@link Geoid#getIntersectionPoint(Line, Vector3D, Frame, * AbsoluteDate)} handles frame transformations correctly * * @throws OrekitException on error// w w w. ja v a 2s .c o m */ @Test public void testGetIntersectionPointFrame() throws OrekitException { // setup Geoid geoid = getComponent(); Frame frame = new Frame(geoid.getBodyFrame(), new Transform(date, new Transform(date, new Vector3D(-1, 2, -3), new Vector3D(4, -5, 6)), new Transform(date, new Rotation(-7, 8, -9, 10, true), new Vector3D(-11, 12, -13))), "test frame"); GeodeticPoint gp = new GeodeticPoint(FastMath.toRadians(46.8743190), FastMath.toRadians(102.4487290), 0); Vector3D expected = geoid.transform(gp); // glancing line: 10% vertical and 90% north (~6 deg elevation) Vector3D slope = gp.getZenith().scalarMultiply(0.1).add(gp.getNorth().scalarMultiply(0.9)); Vector3D close = expected.add(slope.scalarMultiply(100)); Line line = new Line(expected.add(slope), close, 0); Transform xform = geoid.getBodyFrame().getTransformTo(frame, date); // transform to test frame close = xform.transformPosition(close); line = xform.transformLine(line); // action GeodeticPoint actual = geoid.getIntersectionPoint(line, close, frame, date); // verify, 1 um position accuracy at Earth's surface assertThat(actual, geodeticPointCloseTo(gp, 1e-6)); }
From source file:org.orekit.models.earth.GeoidTest.java
/** * check {@link Geoid#getIntersectionPoint(Line, Vector3D, Frame, * AbsoluteDate)} returns null when there is no intersection * * @throws OrekitException on error/*from www .j a v a2 s . c o m*/ */ @Test public void testGetIntersectionPointNoIntersection() throws OrekitException { Geoid geoid = getComponent(); Vector3D closeMiss = new Vector3D(geoid.getEllipsoid().getEquatorialRadius() + 18, 0, 0); Line line = new Line(closeMiss, closeMiss.add(Vector3D.PLUS_J), 0); // action final GeodeticPoint actual = geoid.getIntersectionPoint(line, closeMiss, geoid.getBodyFrame(), date); // verify assertThat(actual, nullValue()); }
From source file:org.orekit.models.earth.GeoidTest.java
/** * check altitude is referenced to the geoid. h<sub>ellipse</sub> = * h<sub>geoid</sub> + N. Where N is the undulation of the geoid. * * @throws OrekitException on error/*www .j a v a 2 s .c o m*/ */ @Test public void testTransformVector3DFrameAbsoluteDate() throws OrekitException { // frame and date are the same Frame frame = FramesFactory.getGCRF(); AbsoluteDate date = AbsoluteDate.CCSDS_EPOCH; Geoid geoid = getComponent(); // test point at 0,0,0 Vector3D point = new Vector3D(WGS84.getEquatorialRadius(), 0, 0); double undulation = geoid.getUndulation(0, 0, date); // check ellipsoidal points and geoidal points differ by undulation GeodeticPoint ellipsoidal = geoid.getEllipsoid().transform(point, frame, date); GeodeticPoint geoidal = geoid.transform(point, frame, date); assertThat(ellipsoidal.getAltitude() - geoidal.getAltitude(), is(undulation)); // check it is the reverse of transform(GeodeticPoint) point = new Vector3D(0.5, 0.4, 0.31).scalarMultiply(WGS84.getEquatorialRadius()); Vector3D expected = geoid.transform(geoid.transform(point, frame, date)); // allow 2 upls of error assertThat(point, vectorCloseTo(expected, 2)); }
From source file:org.orekit.models.earth.GeoidTest.java
/** * check that the altitude is referenced to the geoid (includes * undulation)./* w ww .j av a 2 s. c om*/ * * @throws OrekitException on error */ @Test public void testTransformGeodeticPoint() throws OrekitException { // geoid Geoid geoid = getComponent(); // ellipsoid ReferenceEllipsoid ellipsoid = geoid.getEllipsoid(); // point to test with orthometric height GeodeticPoint orthometric = new GeodeticPoint(0, 75, 5); // undulation at point double undulation = geoid.getUndulation(orthometric.getLatitude(), orthometric.getLongitude(), date); // same point with height referenced to ellipsoid GeodeticPoint point = new GeodeticPoint(orthometric.getLatitude(), orthometric.getLongitude(), orthometric.getAltitude() + undulation); // test they are the same Vector3D expected = ellipsoid.transform(point); Vector3D actual = geoid.transform(orthometric); assertThat(actual, is(expected)); // test the point 0,0,0 expected = new Vector3D(WGS84.getEquatorialRadius() + geoid.getUndulation(0, 0, date), 0, 0); actual = geoid.transform(new GeodeticPoint(0, 0, 0)); assertThat(actual, vectorCloseTo(expected, 0)); }
From source file:org.orekit.models.earth.GeoidTest.java
/** * check {@link Geoid#projectToGround(Vector3D, AbsoluteDate, Frame)} * * @throws OrekitException on error/*from w w w. j a va2 s .c om*/ */ @Test public void testProjectToGround() throws OrekitException { //setup Vector3D p = new Vector3D(7e8, 1e3, 200); Geoid geoid = new Geoid(potential, WGS84); //action Vector3D actual = geoid.projectToGround(p, date, FramesFactory.getGCRF()); //verify assertThat(geoid.transform(actual, geoid.getBodyFrame(), date).getAltitude(), closeTo(0.0, 1e-9)); }
From source file:org.orekit.models.earth.GeoMagneticField.java
/** Rotate the magnetic vectors to geodetic coordinates. * @param sph the spherical coordinates//from w w w . ja va 2s . co m * @param gp the geodetic point * @param field the magnetic field in spherical coordinates * @return the magnetic field in geodetic coordinates */ private Vector3D rotateMagneticVector(final SphericalCoordinates sph, final GeodeticPoint gp, final Vector3D field) { // difference between the spherical and geodetic latitudes final double psi = sph.phi - gp.getLatitude(); // rotate spherical field components to the geodetic system final double Bz = field.getX() * FastMath.sin(psi) + field.getZ() * FastMath.cos(psi); final double Bx = field.getX() * FastMath.cos(psi) - field.getZ() * FastMath.sin(psi); final double By = field.getY(); return new Vector3D(Bx, By, Bz); }