X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FINTERP_KERNEL%2FInterpolationUtils.hxx;h=2c3cb65012b4e369cda1f5604cbd592889997524;hb=d426837c21eca9b56b9b8a7a7434aaf3969c8977;hp=f8209fd68605d548844bc7647c75866592a6d716;hpb=9fda818a38b3b3350b25d22e17176cc7f0d52e81;p=tools%2Fmedcoupling.git diff --git a/src/INTERP_KERNEL/InterpolationUtils.hxx b/src/INTERP_KERNEL/InterpolationUtils.hxx index f8209fd68..2c3cb6501 100644 --- a/src/INTERP_KERNEL/InterpolationUtils.hxx +++ b/src/INTERP_KERNEL/InterpolationUtils.hxx @@ -946,6 +946,24 @@ namespace INTERP_KERNEL } } + /*! + * Find a vector orthogonal to the input vector + */ + inline void orthogonalVect3(const double inpVect[3], double outVect[3]) + { + std::vector sw(3,false); + double inpVect2[3]; + std::transform(inpVect,inpVect+3,inpVect2,std::ptr_fun(fabs)); + std::size_t posMin(std::distance(inpVect2,std::min_element(inpVect2,inpVect2+3))); + sw[posMin]=true; + std::size_t posMax(std::distance(inpVect2,std::max_element(inpVect2,inpVect2+3))); + if(posMax==posMin) + { posMax=(posMin+1)%3; } + sw[posMax]=true; + std::size_t posMid(std::distance(sw.begin(),std::find(sw.begin(),sw.end(),false))); + outVect[posMin]=0.; outVect[posMid]=1.; outVect[posMax]=-inpVect[posMid]/inpVect[posMax]; + } + /*_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _*/ /* Computes the dot product of a and b */ /*_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _*/