X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FINTERP_KERNEL%2FVectorUtils.hxx;h=7ac0582bd6b7b711101a3e36b5387d72e2296f7b;hb=19a5d11f2c31745a83bd6993357263641c0babe5;hp=bf7d5ec90d45253ea8c90c9824f43e6a0bedb6f9;hpb=f1a947b32a36d8dc8e3079b25305bb50e8cb59a0;p=tools%2Fmedcoupling.git diff --git a/src/INTERP_KERNEL/VectorUtils.hxx b/src/INTERP_KERNEL/VectorUtils.hxx index bf7d5ec90..7ac0582bd 100644 --- a/src/INTERP_KERNEL/VectorUtils.hxx +++ b/src/INTERP_KERNEL/VectorUtils.hxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D +// Copyright (C) 2007-2016 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -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,