Salome HOME
Fix: getCellsContainingPoints() in case of polyhedron with a face containing colinear...
[tools/medcoupling.git] / src / INTERP_KERNEL / VectorUtils.hxx
index f3ce8f3adb4751e69aa04f823081c1c4179d9584..4d626c334295bad802dbc53715888a85ce3fe1c0 100644 (file)
@@ -160,6 +160,22 @@ namespace INTERP_KERNEL
     return epsilonEqual(dot(cros, cros), 0.0, eps);
   }
 
+  /**
+   * Test whether three 3D points are colinear.
+   * Implemented by calling overload isColinear3D(v1,v2, eps)
+   */
+  inline bool isColinear3DPts(const double *p1, const double *p2, const double *p3, const double eps = DEFAULT_ABS_TOL)
+  {
+    // check if these points are colinear
+    double vec1[3];
+    // p2-p1
+    std::transform(p2, p2 + 3, p1, vec1, std::minus<double>());
+    double vec2[3];
+    // p3-p2
+    std::transform(p3, p3 + 3, p2, vec2, std::minus<double>());
+    return isColinear3D(vec1, vec2, eps);
+  }
+
   /**
    * Caracteristic vector size (its biggest component, in absolute)
    */