From: ageay Date: Fri, 15 Mar 2013 06:39:41 +0000 (+0000) Subject: Protection against division by 0. in MEDCouplingPointSet::Rotate3DAlg X-Git-Tag: V6_main_FINAL~288 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3a1b3f829fa212af6b14302bad09a6b100e6347c;p=tools%2Fmedcoupling.git Protection against division by 0. in MEDCouplingPointSet::Rotate3DAlg --- diff --git a/src/MEDCoupling/MEDCouplingPointSet.cxx b/src/MEDCoupling/MEDCouplingPointSet.cxx index c83a4a642..4fc496b5f 100644 --- a/src/MEDCoupling/MEDCouplingPointSet.cxx +++ b/src/MEDCoupling/MEDCouplingPointSet.cxx @@ -803,6 +803,8 @@ void MEDCouplingPointSet::Rotate3DAlg(const double *center, const double *vect, double matrix[9]; double matrixTmp[9]; double norm=sqrt(vect[0]*vect[0]+vect[1]*vect[1]+vect[2]*vect[2]); + if(norm::min()) + throw INTERP_KERNEL::Exception("MEDCouplingPointSet::Rotate3DAlg : magnitude of input vector is too close of 0. !"); std::transform(vect,vect+3,vectorNorm,std::bind2nd(std::multiplies(),1/norm)); //rotation matrix computation matrix[0]=cosa; matrix[1]=0.; matrix[2]=0.; matrix[3]=0.; matrix[4]=cosa; matrix[5]=0.; matrix[6]=0.; matrix[7]=0.; matrix[8]=cosa;