@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;
  // inside quad
  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));
  // inside quad
  final Ray3 pickRay2 = new Ray3(new Vector3(-1, 0, 10), new Vector3(0, 0, -1));
  assertFalse(pickRay2.intersectsQuad(v0, v1, v2, v3, intersectionPoint));
  // test distance
  assertTrue(10.0 == pickRayA.getDistanceToPrimitive(new Vector3[] {v0, v1, v2, v3}));
  assertTrue(Double.POSITIVE_INFINITY == pickRay2.getDistanceToPrimitive(new Vector3[] {v0, v1, v2, v3}));
  // test unsupported pick
  assertFalse(pickRay2.intersects(new Vector3[] {v0, v1}, null));
  // test intersect planar
  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));
}