From: ageay Date: Fri, 24 Feb 2012 07:30:07 +0000 (+0000) Subject: Generalization of intersections on polygons having colinears edges. X-Git-Tag: V6_main_FINAL~824 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a74aebaeff4dc3abb69ebc3a30560515bad07d10;p=tools%2Fmedcoupling.git Generalization of intersections on polygons having colinears edges. --- diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.cxx index 696d884da..e1d4f86a4 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.cxx @@ -386,22 +386,23 @@ void QuadraticPolygon::buildFromCrudeDataArray2(const std::map0; int edgeId=abs(descBg[i])-1;//current edge id of pol2 bool directos=colinear1[edgeId].empty(); - int idIn1=-1;//store if needed the cell id in 1 - bool direct1;//store if needed the direction in 1 + std::vector > > idIns1; int offset1=0; if(!directos) {// if the current edge of pol2 has one or more colinear edges part into pol1 const std::vector& c=colinear1[edgeId]; std::size_t nbOfEdgesIn1=std::distance(descBg1,descEnd1); - for(std::size_t j=0;j0; }// it exists an edge into pol1 given by tuple (idIn1,direct1) that is colinear at edge 'edgeId' in pol2 - else - offset1+=intersectEdges1[edgeId1].size()/2;//offset1 is used to find the INTERP_KERNEL::Edge * instance into pol1 that will be part of edge into pol2 + { + idIns1.push_back(std::pair >(edgeId1,std::pair(descBg1[j]>0,offset1)));// it exists an edge into pol1 given by tuple (idIn1,direct1) that is colinear at edge 'edgeId' in pol2 + //std::pair0; + } + offset1+=intersectEdges1[edgeId1].size()/2;//offset1 is used to find the INTERP_KERNEL::Edge * instance into pol1 that will be part of edge into pol2 } - directos=(idIn1==-1); + directos=idIns1.empty(); } if(directos) {//no subpart of edge 'edgeId' of pol2 is in pol1 so let's operate the same thing that QuadraticPolygon::buildFromCrudeDataArray method @@ -411,22 +412,31 @@ void QuadraticPolygon::buildFromCrudeDataArray2(const std::map& subEdge=intersectEdges[edgeId]; std::size_t nbOfSubEdges=subEdge.size()/2; - const std::vector& subEdge1PossiblyAlreadyIn1=intersectEdges1[idIn1]; for(std::size_t j=0;j > >::const_iterator it=idIns1.begin();it!=idIns1.end();it++) + { + int idIn1=(*it).first;//store if needed the cell id in 1 + direct1=(*it).second.first; + offset1=(*it).second.second; + const std::vector& subEdge1PossiblyAlreadyIn1=intersectEdges1[idIn1]; + nbOfSubEdges1=subEdge1PossiblyAlreadyIn1.size()/2; + offset2=0; + for(std::size_t k=0;k build new Edge instance