X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FINTERP_KERNEL%2FVectorUtils.hxx;h=7ac0582bd6b7b711101a3e36b5387d72e2296f7b;hb=ffdef130a5a36893d8e58d538884e79413975c7a;hp=375c36d4b1eda77f2a3bf53e1107b953b57aa6ea;hpb=5da72d398d0eb1820c3ce6dd90b8579b6b14edf5;p=tools%2Fmedcoupling.git diff --git a/src/INTERP_KERNEL/VectorUtils.hxx b/src/INTERP_KERNEL/VectorUtils.hxx index 375c36d4b..7ac0582bd 100644 --- a/src/INTERP_KERNEL/VectorUtils.hxx +++ b/src/INTERP_KERNEL/VectorUtils.hxx @@ -145,6 +145,19 @@ namespace INTERP_KERNEL // return std::fabs(x - y) < errTol; } + + /** + * Test whether two 3D vectors are colinear. The two vectors are expected to be of unit norm (not checked) + * Implemented by checking that the norm of the cross product is null. + */ + inline bool isColinear3D(const double *v1, const double *v2, const double eps = DEFAULT_ABS_TOL) + { + double cros[3]; + cross(v1, v2, cros); + return epsilonEqual(dot(cros, cros), 0.0, eps); + } + + /** * Compares doubles using a relative tolerance * This is suitable mainly for comparing larger values to each other. Before performing the relative test,