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.bodies.EllipseTest.java
@Test public void testMeridianShape() throws OrekitException { OneAxisEllipsoid model = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true)); Ellipse e = model.getPlaneSection(new Vector3D(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, 0, 0), Vector3D.PLUS_J);/* www . j a v a 2 s.c o m*/ Assert.assertEquals(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, e.getA(), 1.0e-15 * Constants.WGS84_EARTH_EQUATORIAL_RADIUS); Assert.assertEquals(Constants.WGS84_EARTH_EQUATORIAL_RADIUS * (1 - Constants.WGS84_EARTH_FLATTENING), e.getB(), 1.0e-15 * Constants.WGS84_EARTH_EQUATORIAL_RADIUS); Assert.assertEquals(0.5 * FastMath.PI, Vector3D.angle(Vector3D.PLUS_J, e.getU()), 1.0e-15); Assert.assertEquals(0.5 * FastMath.PI, Vector3D.angle(Vector3D.PLUS_K, e.getU()), 1.0e-15); Assert.assertEquals(0.5 * FastMath.PI, Vector3D.angle(Vector3D.PLUS_I, e.getV()), 1.0e-15); Assert.assertEquals(0.5 * FastMath.PI, Vector3D.angle(Vector3D.PLUS_J, e.getV()), 1.0e-15); }
From source file:org.orekit.bodies.EllipseTest.java
@Test public void testEquatorialShape() throws OrekitException { OneAxisEllipsoid model = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true)); Ellipse e = model.getPlaneSection(new Vector3D(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, 0, 0), Vector3D.PLUS_K);/*from www . j a v a2 s .co m*/ Assert.assertEquals(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, e.getA(), 1.0e-15 * Constants.WGS84_EARTH_EQUATORIAL_RADIUS); Assert.assertEquals(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, e.getB(), 1.0e-15 * Constants.WGS84_EARTH_EQUATORIAL_RADIUS); }
From source file:org.orekit.bodies.EllipseTest.java
@Test public void testProjectionDerivatives() throws OrekitException { Ellipse e = new Ellipse(Vector3D.ZERO, Vector3D.PLUS_I, Vector3D.PLUS_J, 6.4e6, 6.3e6, FramesFactory.getGCRF());/*from w ww. j a va 2 s.c o m*/ TimeStampedPVCoordinates linearMotion = new TimeStampedPVCoordinates(AbsoluteDate.J2000_EPOCH, new Vector3D(7.0e6, 5.0e6, 0.0), new Vector3D(3.0e3, 4.0e3, 0.0), Vector3D.ZERO); TimeStampedPVCoordinates g0 = e.projectToEllipse(linearMotion); List<TimeStampedPVCoordinates> sample = new ArrayList<TimeStampedPVCoordinates>(); for (double dt = -0.25; dt <= 0.25; dt += 0.125) { sample.add(e.projectToEllipse(linearMotion.shiftedBy(dt))); } TimeStampedPVCoordinates ref = TimeStampedPVCoordinates.interpolate(g0.getDate(), CartesianDerivativesFilter.USE_P, sample); Assert.assertEquals(0, Vector3D.distance(g0.getPosition(), ref.getPosition()) / ref.getPosition().getNorm(), 1.0e-15); Assert.assertEquals(0, Vector3D.distance(g0.getVelocity(), ref.getVelocity()) / ref.getVelocity().getNorm(), 6.0e-12); Assert.assertEquals(0, Vector3D.distance(g0.getAcceleration(), ref.getAcceleration()) / ref.getAcceleration().getNorm(), 8.0e-8); }
From source file:org.orekit.bodies.EllipsoidTest.java
@Test public void testNoIntersections() { final Ellipsoid ellipsoid = new Ellipsoid(FramesFactory.getEME2000(), 1, 2, 3); final Ellipse ps = ellipsoid.getPlaneSection(new Vector3D(0, 0, 4), Vector3D.PLUS_K); Assert.assertNull(ps);/*from w w w . j av a 2 s . c o m*/ }
From source file:org.orekit.bodies.EllipsoidTest.java
@Test public void testSinglePoint() throws IOException { final Ellipsoid ellipsoid = new Ellipsoid(FramesFactory.getEME2000(), 1, 2, 3); final Ellipse ps = ellipsoid.getPlaneSection(new Vector3D(0, 0, 3), Vector3D.PLUS_K); Assert.assertEquals(0, Vector3D.distance(new Vector3D(0, 0, 3), ps.getCenter()), 1.0e-15); Assert.assertEquals(0.0, ps.getA(), 1.0e-15); Assert.assertEquals(0.0, ps.getB(), 1.0e-15); }
From source file:org.orekit.bodies.EllipsoidTest.java
@Test public void testRandomNormalSections() throws IOException { RandomGenerator random = new Well19937a(0x573c54d152aeafe4l); for (int i = 0; i < 100; ++i) { double a = 10 * random.nextDouble(); double b = 10 * random.nextDouble(); double c = 10 * random.nextDouble(); double size = FastMath.max(FastMath.max(a, b), c); final Ellipsoid ellipsoid = new Ellipsoid(FramesFactory.getEME2000(), a, b, c); for (int j = 0; j < 50; ++j) { double phi = FastMath.PI * (random.nextDouble() - 0.5); double lambda = 2 * FastMath.PI * random.nextDouble(); double cPhi = FastMath.cos(phi); double sPhi = FastMath.sin(phi); double cLambda = FastMath.cos(lambda); double sLambda = FastMath.sin(lambda); Vector3D surfacePoint = new Vector3D(ellipsoid.getA() * cPhi * cLambda, ellipsoid.getB() * cPhi * sLambda, ellipsoid.getC() * sPhi); Vector3D t1 = new Vector3D(-ellipsoid.getA() * cPhi * sLambda, ellipsoid.getB() * cPhi * cLambda, 0) .normalize();/* w w w . java2s .co m*/ Vector3D t2 = new Vector3D(-ellipsoid.getA() * sPhi * cLambda, -ellipsoid.getB() * sPhi * sLambda, ellipsoid.getC() * cPhi).normalize(); final double azimuth = 2 * FastMath.PI * random.nextDouble(); double cAzimuth = FastMath.cos(azimuth); double sAzimuth = FastMath.sin(azimuth); Vector3D tAz = new Vector3D(cAzimuth, t1, sAzimuth, t2); final Ellipse ps = ellipsoid.getPlaneSection(surfacePoint, tAz); Assert.assertEquals(0.0, errorOnEllipsoid(ps, ellipsoid), 1.0e-12 * size); Assert.assertEquals(0.0, errorOnPlane(ps, surfacePoint, tAz), 1.0e-10 * size); double cos = Vector3D.dotProduct(surfacePoint.subtract(ps.getCenter()), ps.getU()) / ps.getA(); double sin = Vector3D.dotProduct(surfacePoint.subtract(ps.getCenter()), ps.getV()) / ps.getB(); final Vector3D rebuilt = ps.pointAt(FastMath.atan2(sin, cos)); Assert.assertEquals(0, Vector3D.distance(surfacePoint, rebuilt), 1.0e-11 * size); } } }
From source file:org.orekit.bodies.GeodeticPoint.java
/** Get the direction above the point, expressed in parent shape frame. * <p>The zenith direction is defined as the normal to local horizontal plane.</p> * @return unit vector in the zenith direction * @see #getNadir()/*from ww w .j av a2 s. c o m*/ */ public Vector3D getZenith() { if (zenith == null) { final double cosLat = FastMath.cos(latitude); final double sinLat = FastMath.sin(latitude); final double cosLon = FastMath.cos(longitude); final double sinLon = FastMath.sin(longitude); zenith = new Vector3D(cosLon * cosLat, sinLon * cosLat, sinLat); } return zenith; }
From source file:org.orekit.bodies.GeodeticPoint.java
/** Get the direction to the north of point, expressed in parent shape frame. * <p>The north direction is defined in the horizontal plane * (normal to zenith direction) and following the local meridian.</p> * @return unit vector in the north direction * @see #getSouth()//ww w . j av a 2 s . co m */ public Vector3D getNorth() { if (north == null) { final double cosLat = FastMath.cos(latitude); final double sinLat = FastMath.sin(latitude); final double cosLon = FastMath.cos(longitude); final double sinLon = FastMath.sin(longitude); north = new Vector3D(-cosLon * sinLat, -sinLon * sinLat, cosLat); } return north; }
From source file:org.orekit.bodies.GeodeticPoint.java
/** Get the direction to the east of point, expressed in parent shape frame. * <p>The east direction is defined in the horizontal plane * in order to complete direct triangle (east, north, zenith).</p> * @return unit vector in the east direction * @see #getWest()/*from ww w . j a v a2s . c o m*/ */ public Vector3D getEast() { if (east == null) { east = new Vector3D(-FastMath.sin(longitude), FastMath.cos(longitude), 0); } return east; }
From source file:org.orekit.bodies.OneAxisEllipsoid.java
/** {@inheritDoc} */ public Vector3D transform(final GeodeticPoint point) { final double longitude = point.getLongitude(); final double cLambda = FastMath.cos(longitude); final double sLambda = FastMath.sin(longitude); final double latitude = point.getLatitude(); final double cPhi = FastMath.cos(latitude); final double sPhi = FastMath.sin(latitude); final double h = point.getAltitude(); final double n = getA() / FastMath.sqrt(1.0 - e2 * sPhi * sPhi); final double r = (n + h) * cPhi; return new Vector3D(r * cLambda, r * sLambda, (g2 * n + h) * sPhi); }