private static Intersection getIntersection(TriangleObject obj, Vector3D p, Vector3D pc) {
   DecompositionSolver solver = obj.getSolverXY();
   try {
     double[] params = {pc.getX(), pc.getY()};
     return getIntersection(obj, solver, p, pc, params);
   } catch (Exception ex) {
     solver = obj.getSolverYZ();
     try {
       double[] params = {pc.getY(), pc.getZ()};
       return getIntersection(obj, solver, p, pc, params);
     } catch (Exception e) {
       solver = obj.getSolverXZ();
       double[] params = {pc.getX(), pc.getZ()};
       return getIntersection(obj, solver, p, pc, params);
     }
   }
 }
 private static Intersection getIntersection(Ray ray, TriangleObject obj, Model model) {
   Vector3D p0 = VectorUtils.toVector3D(ray.getP0());
   Vector3D p1 = VectorUtils.toVector3D(ray.getP1());
   Vector3D a = obj.getA();
   Vector3D b = obj.getB();
   Vector3D c = obj.getC();
   Vector3D n = obj.getN();
   double den = p1.dotProduct(n);
   if (den != 0.0) {
     double t = (a.dotProduct(n) - p0.dotProduct(n)) / den;
     if (t < EPSILON) {
       return new Intersection(false);
     }
     Vector3D p = p0.add(p1.scalarMultiply(t));
     Vector3D pc = p.subtract(c);
     final Intersection intersection = getIntersection(obj, p, pc);
     if (intersection != null) {
       intersection.setDistance(t);
       return intersection;
     }
   }
   return new Intersection(false);
 }