From: ageay Date: Thu, 9 Oct 2008 17:19:46 +0000 (+0000) Subject: *** empty log message *** X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=1f129c70b8a82637d5daaea8d187cc2b15f2a068;p=tools%2Fmedcoupling.git *** empty log message *** --- diff --git a/src/INTERP_KERNEL/Geometric2D/ComposedEdge.cxx b/src/INTERP_KERNEL/Geometric2D/ComposedEdge.cxx index 8618922c5..d409e8907 100644 --- a/src/INTERP_KERNEL/Geometric2D/ComposedEdge.cxx +++ b/src/INTERP_KERNEL/Geometric2D/ComposedEdge.cxx @@ -185,6 +185,26 @@ void ComposedEdge::applySimilarity(double xBary, double yBary, double dimChar) (*iter)->applySimilarity(xBary,yBary,dimChar); } +int ComposedEdge::getNbOfEdgeSonsOfSameId(int id) const +{ + int ret=0; + for(list::const_iterator iter=_subEdges.begin();iter!=_subEdges.end();iter++) + if((*iter)->getPtr()->getId()==id) + ret++; + return ret; +} + +/*! + * 'this' is supposed to be the father 'split'. + * This method returns un vector 'nbOfCreatedNodes' the number of newly created nodes of each edge of this in the same order than the sub edges constituting 'this.' + */ +void ComposedEdge::dispatchForNode(const ComposedEdge& split, std::vector& nbOfCreatedNodes) const +{ + int eRk=0; + for(list::const_iterator iter=_subEdges.begin();iter!=_subEdges.end();iter++,eRk++) + nbOfCreatedNodes[eRk]=split.getNbOfEdgeSonsOfSameId((*iter)->getPtr()->getId())-1; +} + /*! * Perform Similarity transformation on all elements of this Nodes and Edges. */ @@ -224,6 +244,8 @@ void ComposedEdge::dispatchPerimeter(const std::set& ids1, const std::set& nbOfCreatedNodes) const; void dispatchPerimeter(const std::set& ids1, const std::set& ids2, double& part1, double& part2, double& commonPart) const; double dispatchPerimeterAdv(const ComposedEdge& father, std::vector& result) const; diff --git a/src/INTERP_KERNEL/Geometric2D/Edge.cxx b/src/INTERP_KERNEL/Geometric2D/Edge.cxx index 574e277cf..cb690f6c3 100644 --- a/src/INTERP_KERNEL/Geometric2D/Edge.cxx +++ b/src/INTERP_KERNEL/Geometric2D/Edge.cxx @@ -553,7 +553,7 @@ bool Edge::intersectWith(const Edge *other, MergePoints& commonNode, ComposedEdge& outVal1, ComposedEdge& outVal2) const { bool ret=true; - Bounds *merge=_bounds.nearlyAmIIntersectingWith(other->getBounds()); + Bounds *merge=_bounds.amIIntersectingWith(other->getBounds());//nearlyAmIIntersectingWith(other->getBounds()); tony if(!merge) return false; delete merge; diff --git a/src/INTERP_KERNEL/Geometric2D/QuadraticPolygon.cxx b/src/INTERP_KERNEL/Geometric2D/QuadraticPolygon.cxx index dca8f06ff..febe53566 100644 --- a/src/INTERP_KERNEL/Geometric2D/QuadraticPolygon.cxx +++ b/src/INTERP_KERNEL/Geometric2D/QuadraticPolygon.cxx @@ -212,6 +212,21 @@ double QuadraticPolygon::intersectForPerimeterAdvanced(const QuadraticPolygon& o return ret; } +/*! + * numberOfCreatedPointsPerEdge is resized to the number of edges of 'this'. + * This method returns in ordered maner the number of newly created points per edge. + * This method performs a split process between 'this' and 'other' that gives the result PThis. + * Then for each edges of 'this' this method counts how many edges in Pthis have the same id. + */ +void QuadraticPolygon::intersectForPoint(const QuadraticPolygon& other, std::vector< int >& numberOfCreatedPointsPerEdge) const +{ + numberOfCreatedPointsPerEdge.resize(size()); + QuadraticPolygon cpyOfThis(*this); + QuadraticPolygon cpyOfOther(other); int nbOfSplits=0; + splitPolygonsEachOther(cpyOfThis,cpyOfOther,nbOfSplits); + dispatchForNode(cpyOfThis,numberOfCreatedPointsPerEdge); +} + std::vector QuadraticPolygon::intersectMySelfWith(const QuadraticPolygon& other) const { QuadraticPolygon cpyOfThis(*this); diff --git a/src/INTERP_KERNEL/Geometric2D/QuadraticPolygon.hxx b/src/INTERP_KERNEL/Geometric2D/QuadraticPolygon.hxx index 7d69dbcd1..7b5146df6 100644 --- a/src/INTERP_KERNEL/Geometric2D/QuadraticPolygon.hxx +++ b/src/INTERP_KERNEL/Geometric2D/QuadraticPolygon.hxx @@ -33,6 +33,7 @@ namespace INTERP_KERNEL std::vector intersectMySelfWith(const QuadraticPolygon& other) const; void intersectForPerimeter(const QuadraticPolygon& other, double& perimeterThisPart, double& perimeterOtherPart, double& perimeterCommonPart, double& area) const; double intersectForPerimeterAdvanced(const QuadraticPolygon& other, std::vector< double >& polThis, std::vector< double >& polOther, double& area) const; + void intersectForPoint(const QuadraticPolygon& other, std::vector< int >& numberOfCreatedPointsPerEdge) const; public://Only public for tests reasons void performLocatingOperation(QuadraticPolygon& pol2) const; void splitPolygonsEachOther(QuadraticPolygon& pol1, QuadraticPolygon& pol2, int& nbOfSplits) const; diff --git a/src/INTERP_KERNEL/Test/QuadraticPlanarInterpTest4.cxx b/src/INTERP_KERNEL/Test/QuadraticPlanarInterpTest4.cxx index 38edb6b1b..786dc3ca1 100644 --- a/src/INTERP_KERNEL/Test/QuadraticPlanarInterpTest4.cxx +++ b/src/INTERP_KERNEL/Test/QuadraticPlanarInterpTest4.cxx @@ -38,12 +38,18 @@ void QuadraticPlanarInterpTest::checkPolygonsIntersection1() double tmp1=0.,tmp2=0.,tmp3=0.,tmp4=0.; pol1.intersectForPerimeter(pol2,tmp1,tmp2,tmp3,tmp4); vector v1,v2; + vector v3; double area2; CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,pol1.intersectForPerimeterAdvanced(pol2,v1,v2,area2),1.e-14);//no common edge + pol1.intersectForPoint(pol2,v3); CPPUNIT_ASSERT_EQUAL(3,(int)v1.size()); CPPUNIT_ASSERT_EQUAL(3,(int)v2.size()); + CPPUNIT_ASSERT_EQUAL(3,(int)v3.size()); if(k==0) { + CPPUNIT_ASSERT_EQUAL(2,v3[(3-i)%3]); + CPPUNIT_ASSERT_EQUAL(0,v3[(4-i)%3]); + CPPUNIT_ASSERT_EQUAL(0,v3[(5-i)%3]); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.7,v1[(3-i)%3],1.e-14); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,v1[(4-i)%3],1.e-14); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,v1[(5-i)%3],1.e-14);