test_class.file: kendzi-math-geometry/src/test/java/kendzi/math/geometry/intersection/IntersectionUtilTest.java
test_class.identifier: IntersectionUtilTest
test_case.body: @Test
      public void behindDistance() {
  
          Point3d v0 = new Point3d(-1, 0, -1);
          Point3d v1 = new Point3d(1, 0, -1);
          Point3d v2 = new Point3d(0, 0, 1);
  
          Point3d p = new Point3d(0, -0.1, 0);
          Vector3d d = new Vector3d(0, -1, 0);
  
          Double intersects = IntersectionUtil.rayIntersectsTriangleDistance(p, d, v0, v1, v2);
  
          assertNull(intersects);
      }
test_case.class_method_signature: IntersectionUtilTest.behindDistance()
test_case.full_signature: @Test public void behindDistance()
test_case.identifier: behindDistance
test_case.invocations: rayIntersectsTriangleDistance assertNull
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void behindDistance()
focal_class.file: kendzi-math-geometry/src/main/java/kendzi/math/geometry/intersection/IntersectionUtil.java
focal_class.identifier: IntersectionUtil
focal_class.class_method_signature: IntersectionUtil.rayIntersectsTriangle(Point3d p, Vector3d d, Point3d v0, Point3d v1, Point3d v2)
focal_class.full_signature: public static boolean rayIntersectsTriangle(Point3d p, Vector3d d, Point3d v0, Point3d v1, Point3d v2)
focal_class.identifier: rayIntersectsTriangle
focal_class.modifiers: public static
focal_class.parameters: (Point3d p, Vector3d d, Point3d v0, Point3d v1, Point3d v2)
focal_class.return: boolean
focal_class.signature: boolean rayIntersectsTriangle(Point3d p, Vector3d d, Point3d v0, Point3d v1, Point3d v2)
focal_class.class_method_signature: IntersectionUtil.rayIntersectsTriangleDistance(Point3d p, Vector3d d, Point3d v0, Point3d v1, Point3d v2)
focal_class.full_signature: public static Double rayIntersectsTriangleDistance(Point3d p, Vector3d d, Point3d v0, Point3d v1, Point3d v2)
focal_class.identifier: rayIntersectsTriangleDistance
focal_class.modifiers: public static
focal_class.parameters: (Point3d p, Vector3d d, Point3d v0, Point3d v1, Point3d v2)
focal_class.return: Double
focal_class.signature: Double rayIntersectsTriangleDistance(Point3d p, Vector3d d, Point3d v0, Point3d v1, Point3d v2)
focal_method.body: public static Double rayIntersectsTriangleDistance(Point3d p, Vector3d d, Point3d v0, Point3d v1, Point3d v2) {
  
          double a, f, u, v;
          Vector3d h = new Vector3d();
  
          Vector3d e1 = Vector3dUtil.fromTo(v0, v1);
          Vector3d e2 = Vector3dUtil.fromTo(v0, v2);
  
          h.cross(d, e2);
  
          a = e1.dot(h);
  
          if (a > -0.00001 && a < 0.00001) {
              return null;
          }
  
          f = 1 / a;
  
          Vector3d s = Vector3dUtil.fromTo(v0, p);
  
          u = f * s.dot(h);
  
          if (u < 0.0 || u > 1.0) {
              return null;
          }
  
          Vector3d q = new Vector3d();
          q.cross(s, e1);
  
          v = f * d.dot(q);
  
          if (v < 0.0 || u + v > 1.0) {
              return null;
          }
  
          // at this stage we can compute t to find out where
          // the intersection point is on the line
          double t = f * e2.dot(q);
          // t = f * innerProduct(e2, q);
  
          if (t > 0.00001) {// ray intersection
              return t;
  
          } else {
              // this means that there is a line intersection
              // but not a ray intersection
              return null;
          }
      }
focal_method.class_method_signature: IntersectionUtil.rayIntersectsTriangleDistance(Point3d p, Vector3d d, Point3d v0, Point3d v1, Point3d v2)
focal_method.full_signature: public static Double rayIntersectsTriangleDistance(Point3d p, Vector3d d, Point3d v0, Point3d v1, Point3d v2)
focal_method.identifier: rayIntersectsTriangleDistance
focal_method.invocations: fromTo fromTo cross dot fromTo dot cross dot dot
focal_method.modifiers: public static
focal_method.parameters: (Point3d p, Vector3d d, Point3d v0, Point3d v1, Point3d v2)
focal_method.return: Double
focal_method.signature: Double rayIntersectsTriangleDistance(Point3d p, Vector3d d, Point3d v0, Point3d v1, Point3d v2)