From: ndjinga Date: Fri, 30 Jan 2009 09:17:47 +0000 (+0000) Subject: Correction erreur valgrind dans SingleElementPlanarTests (jump on unitialised parameter) X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e04f326f0fbfe7bd0f77a9b233a63bae0c46092d;p=tools%2Fmedcoupling.git Correction erreur valgrind dans SingleElementPlanarTests (jump on unitialised parameter) --- diff --git a/src/INTERP_KERNEL/PolygonAlgorithms.txx b/src/INTERP_KERNEL/PolygonAlgorithms.txx index fbdd36cef..2e7ff2604 100644 --- a/src/INTERP_KERNEL/PolygonAlgorithms.txx +++ b/src/INTERP_KERNEL/PolygonAlgorithms.txx @@ -50,7 +50,11 @@ namespace INTERP_KERNEL switch(DIM) { case 2: - return false; + { + if(distance2(A,D)<_Epsilon) + crossprod(A,C,E,_Vdouble);//store the crossprod between vectors AC and AE (E=vertex preceding A) + return false;//case of paralell segments + } case 3://beware AB and CD may belong to a vertical plane det = determinant(&AB[1],&DC[1]);//determinant of the last two coefficients if(fabs(det) > _Epsilon) @@ -68,11 +72,17 @@ namespace INTERP_KERNEL t1=(AC[0]*DC[2]-AC[2]*DC[0])*inv_det; t2=(AB[0]*AC[2]-AB[2]*AC[0])*inv_det; } - else return false;//case of paralell segments - } + else + { + if(distance2(A,D)<_Epsilon) + crossprod(A,C,E,_Vdouble);//store the crossprod between vectors AC and AE (E=vertex preceding A) + return false;//case of paralell segments + } + } } } - + + // std::cout<<"t1= " << t1 << " ; t2= " << t2<< std::endl; if(t1>_Precision && t1<1-_Precision) { if( t2>_Precision && t2<1-_Precision) @@ -107,7 +117,7 @@ namespace INTERP_KERNEL } } else if(fabs(t2-1) <= _Precision)//vertex on a vertex (A=D), first run - crossprod(A,C,E,_Vdouble);//angle between vectors AC and AE (E=vertex preceding A) + crossprod(A,C,E,_Vdouble);//store the angle between vectors AC and AE (E=vertex preceding A) else if(fabs(t2) <= _Precision)//vertex on a vertex (A=C), second run { double Vdoublebis[DIM]; @@ -396,7 +406,7 @@ namespace INTERP_KERNEL _Status.insert(std::make_pair(i_next_glob,std::make_pair(i_glob, false))); _Status.insert(std::make_pair(i_prev_glob,std::make_pair(i_glob, false))); mi1++; - //std::cout<< "nb_prev= "<< 0 << " i_glob= " << i_glob << std::endl; + // std::cout<< "nb_prev= "<< 0 << " i_glob= " << i_glob << std::endl; /******* Loop until the second polygon is reached *******/ while( !four_neighbours) @@ -429,7 +439,6 @@ namespace INTERP_KERNEL four_neighbours = true; else /* Rare pothological case: */ { - //std::cout<<"coucou" << std::endl; const pair< const double *, int > next_pt= *mi2; events.erase(mi2); mi1=events.insert(mi1,next_pt);