X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FINTERP_KERNEL%2FVectorUtils.hxx;h=00b2bf042cb1f20d28ccbfd5ccc6a9deda64d998;hb=75006818415ac26dc594b6abb806ba3c292a545c;hp=21d69803a77d38139c2ef6cd57a2bbc989f852bd;hpb=3c911ce36f5caa779ea60042e738fa57671a44b1;p=tools%2Fmedcoupling.git diff --git a/src/INTERP_KERNEL/VectorUtils.hxx b/src/INTERP_KERNEL/VectorUtils.hxx index 21d69803a..00b2bf042 100644 --- a/src/INTERP_KERNEL/VectorUtils.hxx +++ b/src/INTERP_KERNEL/VectorUtils.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2015 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 @@ -20,12 +20,14 @@ #ifndef __VECTORUTILS_HXX__ #define __VECTORUTILS_HXX__ +#include #include #include #include #include #include + namespace INTERP_KERNEL { /// Precision used for tests of 3D part of INTERP_KERNEL @@ -145,6 +147,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,