Ray3 extends Line3Base implements ReadOnlyRay3, Poolable { @Override public boolean intersectsQuad(final ReadOnlyVector3 pointA, final ReadOnlyVector3 pointB, final ReadOnlyVector3 pointC, final ReadOnlyVector3 pointD, final Vector3 locationStore) { return intersects(pointA, pointB, pointC, locationStore, false) || intersects(pointA, pointC, pointD, locationStore, false); } 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 testIntersectsQuad() { final Vector3 v0 = new Vector3(0, 0, 0); final Vector3 v1 = new Vector3(5, 0, 0); final Vector3 v2 = new Vector3(5, 5, 0); final Vector3 v3 = new Vector3(0, 5, 0); Vector3 intersectionPoint = null; final ReadOnlyRay3 pickRayA = new Ray3(new Vector3(2, 2, 10), new Vector3(0, 0, -1)); final ReadOnlyRay3 pickRayB = new Ray3(new Vector3(2, 4, 10), new Vector3(0, 0, -1)); assertTrue(pickRayA.intersectsQuad(v0, v1, v2, v3, intersectionPoint)); assertTrue(pickRayB.intersectsQuad(v0, v1, v2, v3, intersectionPoint)); final Ray3 pickRay2 = new Ray3(new Vector3(-1, 0, 10), new Vector3(0, 0, -1)); assertFalse(pickRay2.intersectsQuad(v0, v1, v2, v3, intersectionPoint)); assertTrue(10.0 == pickRayA.getDistanceToPrimitive(new Vector3[] {v0, v1, v2, v3})); assertTrue(Double.POSITIVE_INFINITY == pickRay2.getDistanceToPrimitive(new Vector3[] {v0, v1, v2, v3})); assertFalse(pickRay2.intersects(new Vector3[] {v0, v1}, null)); assertFalse( new Ray3(new Vector3(0, 0, -1), Vector3.UNIT_Y).intersectsQuadPlanar(v0, v1, v2, v3, intersectionPoint)); intersectionPoint = new Vector3(); assertTrue(pickRayA.intersectsQuadPlanar(v0, v1, v2, v3, intersectionPoint)); assertTrue(pickRayB.intersectsQuadPlanar(v0, v1, v2, v3, intersectionPoint)); }