Ray3 extends Line3Base implements ReadOnlyRay3, Poolable { @Override public boolean intersectsPlane(final ReadOnlyPlane plane, final Vector3 locationStore) { final ReadOnlyVector3 normal = plane.getNormal(); final double denominator = normal.dot(_direction); if (denominator > -MathUtils.EPSILON && denominator < MathUtils.EPSILON) { return false; } final double numerator = -normal.dot(_origin) + plane.getConstant(); final double ratio = numerator / denominator; if (ratio < MathUtils.EPSILON) { return false; } if (locationStore != null) { locationStore.set(_direction).multiplyLocal(ratio).addLocal(_origin); } return true; } Ray3();  Ray3(final ReadOnlyRay3 source);  Ray3(final ReadOnlyVector3 origin, final ReadOnlyVector3 direction); Ray3 set(final ReadOnlyRay3 source); @Override double getDistanceToPrimitive(final Vector3[] worldVertices); @Override boolean intersects(final Vector3[] polygonVertices, final Vector3 locationStore); @Override boolean intersectsTriangle(final ReadOnlyVector3 pointA, final ReadOnlyVector3 pointB,
      final ReadOnlyVector3 pointC, final Vector3 locationStore); @Override boolean intersectsTrianglePlanar(final ReadOnlyVector3 pointA, final ReadOnlyVector3 pointB,
      final ReadOnlyVector3 pointC, final Vector3 locationStore); @Override boolean intersectsQuad(final ReadOnlyVector3 pointA, final ReadOnlyVector3 pointB,
      final ReadOnlyVector3 pointC, final ReadOnlyVector3 pointD, final Vector3 locationStore); @Override boolean intersectsQuadPlanar(final ReadOnlyVector3 pointA, final ReadOnlyVector3 pointB,
      final ReadOnlyVector3 pointC, final ReadOnlyVector3 pointD, final Vector3 locationStore); @Override boolean intersectsPlane(final ReadOnlyPlane plane, final Vector3 locationStore); @Override double distanceSquared(final ReadOnlyVector3 point, final Vector3 store); static boolean isValid(final ReadOnlyRay3 ray); @Override String toString(); @Override boolean equals(final Object o); @Override Ray3 clone(); final static Ray3 fetchTempInstance(); final static void releaseTempInstance(final Ray3 ray);  }
@Test public void testIntersectsPlane() { final Vector3 intersectionPoint = new Vector3(); Plane plane = new Plane(new Vector3(0, 1, 0), 2); Ray3 pickRay = new Ray3(new Vector3(0, 3, 0), new Vector3(0, 0, 1)); assertFalse(pickRay.intersectsPlane(plane, intersectionPoint)); pickRay = new Ray3(new Vector3(0, 3, 0), new Vector3(0, 1, 0)); assertFalse(pickRay.intersectsPlane(plane, intersectionPoint)); pickRay = new Ray3(new Vector3(0, 2, 0), new Vector3(0, 1, 0)); assertFalse(pickRay.intersectsPlane(plane, intersectionPoint)); pickRay = new Ray3(new Vector3(0, 1, 0), new Vector3(0, 1, 0)); assertTrue(pickRay.intersectsPlane(plane, intersectionPoint)); pickRay = new Ray3(new Vector3(0, 0, 0), new Vector3(1, 0, 0)); assertFalse(pickRay.intersectsPlane(plane, intersectionPoint)); pickRay = new Ray3(new Vector3(0, -3, 0), new Vector3(0, 0, 1)); assertFalse(pickRay.intersectsPlane(plane, intersectionPoint)); pickRay = new Ray3(new Vector3(0, 3, 0), new Vector3(0, -1, 0)); assertTrue(pickRay.intersectsPlane(plane, intersectionPoint)); pickRay = new Ray3(new Vector3(0, -3, 0), new Vector3(1, 1, 1)); assertTrue(pickRay.intersectsPlane(plane, intersectionPoint)); pickRay = new Ray3(new Vector3(0, -3, 0), new Vector3(-1, -1, -1)); assertFalse(pickRay.intersectsPlane(plane, intersectionPoint)); plane = new Plane(new Vector3(1, 1, 1), -2); pickRay = new Ray3(new Vector3(0, 0, 0), new Vector3(1, -1, 1)); assertFalse(pickRay.intersectsPlane(plane, intersectionPoint)); pickRay = new Ray3(new Vector3(0, -1, 0), new Vector3(0, 1, 0)); assertFalse(pickRay.intersectsPlane(plane, intersectionPoint)); pickRay = new Ray3(new Vector3(0, -2, 0), new Vector3(0, 1, 0)); assertFalse(pickRay.intersectsPlane(plane, intersectionPoint)); pickRay = new Ray3(new Vector3(0, -3, 0), new Vector3(0, 1, 0)); assertTrue(pickRay.intersectsPlane(plane, null)); }