List of usage examples for org.apache.commons.math3.geometry.euclidean.threed Line contains
public boolean contains(final Vector3D p)
From source file:NewEmptyJUnitTest.java
@Test public void hello() { Line line = new Line(new Vector3D(-1, -1, -1), new Vector3D(1, -1, -1)); boolean result = line.contains(new Vector3D(2, -1, -1)); assertTrue(result);// w w w.j av a 2 s . c o m }
From source file:org.orekit.attitudes.BodyCenterPointingTest.java
/** Test if body center belongs to the direction pointed by the satellite *///from w w w .j ava 2 s.co m @Test public void testBodyCenterInPointingDirection() throws OrekitException { // Transform satellite position to position/velocity parameters in EME2000 frame PVCoordinates pvSatEME2000 = circ.getPVCoordinates(); // Pointing direction // ******************** // Get satellite attitude rotation, i.e rotation from EME2000 frame to satellite frame Rotation rotSatEME2000 = earthCenterAttitudeLaw.getAttitude(circ, date, circ.getFrame()).getRotation(); // Transform Z axis from satellite frame to EME2000 Vector3D zSatEME2000 = rotSatEME2000.applyInverseTo(Vector3D.PLUS_K); // Transform Z axis from EME2000 to ITRF2008 Vector3D zSatITRF2008C = eme2000ToItrf.transformVector(zSatEME2000); // Transform satellite position/velocity from EME2000 to ITRF2008 PVCoordinates pvSatITRF2008C = eme2000ToItrf.transformPVCoordinates(pvSatEME2000); // Line containing satellite point and following pointing direction Line pointingLine = new Line(pvSatITRF2008C.getPosition(), pvSatITRF2008C.getPosition().add(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, zSatITRF2008C), 2.0e-8); // Check that the line contains Earth center Assert.assertTrue(pointingLine.contains(Vector3D.ZERO)); }
From source file:org.orekit.bodies.OneAxisEllipsoidTest.java
@Test public void testLineIntersection() throws OrekitException { AbsoluteDate date = AbsoluteDate.J2000_EPOCH; Frame frame = FramesFactory.getITRF(IERSConventions.IERS_2010, true); OneAxisEllipsoid model = new OneAxisEllipsoid(100.0, 0.9, frame); Vector3D point = new Vector3D(0.0, 93.7139699, 3.5930796); Vector3D direction = new Vector3D(0.0, 1.0, 1.0); Line line = new Line(point, point.add(direction), 1.0e-10); GeodeticPoint gp = model.getIntersectionPoint(line, point, frame, date); Assert.assertEquals(gp.getAltitude(), 0.0, 1.0e-12); Assert.assertTrue(line.contains(model.transform(gp))); model = new OneAxisEllipsoid(100.0, 0.9, frame); point = new Vector3D(0.0, -93.7139699, -3.5930796); direction = new Vector3D(0.0, -1.0, -1.0); line = new Line(point, point.add(direction), 1.0e-10).revert(); gp = model.getIntersectionPoint(line, point, frame, date); Assert.assertTrue(line.contains(model.transform(gp))); model = new OneAxisEllipsoid(100.0, 0.9, frame); point = new Vector3D(0.0, -93.7139699, 3.5930796); direction = new Vector3D(0.0, -1.0, 1.0); line = new Line(point, point.add(direction), 1.0e-10); gp = model.getIntersectionPoint(line, point, frame, date); Assert.assertTrue(line.contains(model.transform(gp))); model = new OneAxisEllipsoid(100.0, 0.9, frame); point = new Vector3D(-93.7139699, 0.0, 3.5930796); direction = new Vector3D(-1.0, 0.0, 1.0); line = new Line(point, point.add(direction), 1.0e-10); gp = model.getIntersectionPoint(line, point, frame, date); Assert.assertTrue(line.contains(model.transform(gp))); Assert.assertFalse(line.contains(new Vector3D(0, 0, 7000000))); point = new Vector3D(0.0, 0.0, 110); direction = new Vector3D(0.0, 0.0, 1.0); line = new Line(point, point.add(direction), 1.0e-10); gp = model.getIntersectionPoint(line, point, frame, date); Assert.assertEquals(gp.getLatitude(), FastMath.PI / 2, 1.0e-12); point = new Vector3D(0.0, 110, 0); direction = new Vector3D(0.0, 1.0, 0.0); line = new Line(point, point.add(direction), 1.0e-10); gp = model.getIntersectionPoint(line, point, frame, date); Assert.assertEquals(gp.getLatitude(), 0, 1.0e-12); }