Line implements Embedding<Euclidean3D, Euclidean1D> { public boolean contains(final Vector3D p) { return distance(p) < tolerance; } Line(final Vector3D p1, final Vector3D p2, final double tolerance);  Line(final Line line); @Deprecated  Line(final Vector3D p1, final Vector3D p2); void reset(final Vector3D p1, final Vector3D p2); double getTolerance(); Line revert(); Vector3D getDirection(); Vector3D getOrigin(); double getAbscissa(final Vector3D point); Vector3D pointAt(final double abscissa); Vector1D toSubSpace(Vector<Euclidean3D> vector); Vector3D toSpace(Vector<Euclidean1D> vector); Vector1D toSubSpace(final Point<Euclidean3D> point); Vector3D toSpace(final Point<Euclidean1D> point); boolean isSimilarTo(final Line line); boolean contains(final Vector3D p); double distance(final Vector3D p); double distance(final Line line); Vector3D closestPoint(final Line line); Vector3D intersection(final Line line); SubLine wholeLine();  }
@Test public void testContains() throws MathIllegalArgumentException, MathArithmeticException { Vector3D p1 = new Vector3D(0, 0, 1); Line l = new Line(p1, new Vector3D(0, 0, 2), 1.0e-10); Assert.assertTrue(l.contains(p1)); Assert.assertTrue(l.contains(new Vector3D(1.0, p1, 0.3, l.getDirection()))); Vector3D u = l.getDirection().orthogonal(); Vector3D v = Vector3D.crossProduct(l.getDirection(), u); for (double alpha = 0; alpha < 2 * FastMath.PI; alpha += 0.3) { Assert.assertTrue(! l.contains(p1.add(new Vector3D(FastMath.cos(alpha), u, FastMath.sin(alpha), v)))); } }