]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
*** empty log message ***
authorageay <ageay>
Thu, 9 Oct 2008 17:19:46 +0000 (17:19 +0000)
committerageay <ageay>
Thu, 9 Oct 2008 17:19:46 +0000 (17:19 +0000)
src/INTERP_KERNEL/Geometric2D/ComposedEdge.cxx
src/INTERP_KERNEL/Geometric2D/ComposedEdge.hxx
src/INTERP_KERNEL/Geometric2D/Edge.cxx
src/INTERP_KERNEL/Geometric2D/QuadraticPolygon.cxx
src/INTERP_KERNEL/Geometric2D/QuadraticPolygon.hxx
src/INTERP_KERNEL/Test/QuadraticPlanarInterpTest4.cxx

index 8618922c502cbfa212bcd225f080634d4b3ce6da..d409e890735ada386fdfeabcb79dae70866708ba 100644 (file)
@@ -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<ElementaryEdge *>::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<int>& nbOfCreatedNodes) const
+{
+  int eRk=0;
+  for(list<ElementaryEdge *>::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<int>& ids1, const std::set<i
     }
 }
 
+
+
 /*!
  * For every subedges of 'this' if it comes from a part of father polygon the corresponding lgth is added in the corresponding 'result' rank.
  * If a sub-edge is found with a status equal to ON, the sub-edge is shared and the sum of all edges in the same case is returned.
index da20266d0070d6c421db72e0642088b3c2a12b56..172eb2ac13398bbb5e9da40ecdee6cdb0ae9f5b5 100644 (file)
@@ -32,8 +32,10 @@ namespace INTERP_KERNEL
     double getHydraulicDiameter() const;
     double normalize(ComposedEdge *other);
     void fillBounds(Bounds& output) const;
+    int getNbOfEdgeSonsOfSameId(int id) const;
     void applySimilarity(double xBary, double yBary, double dimChar);
     void applyGlobalSimilarity(double xBary, double yBary, double dimChar);
+    void dispatchForNode(const ComposedEdge& father, std::vector<int>& nbOfCreatedNodes) const;
     void dispatchPerimeter(const std::set<int>& ids1, const std::set<int>& ids2,
                            double& part1, double& part2, double& commonPart) const;
     double dispatchPerimeterAdv(const ComposedEdge& father, std::vector<double>& result) const;
index 574e277cf5da97defefeaaa94ea77801974d69da..cb690f6c311c081ef435a8b5e2d7583cd28660e8 100644 (file)
@@ -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;
index dca8f06ffb6ecf1d25215b2de4aa47f2e3408fe6..febe53566a2dfed5f70dfcdec5ba96da93a50190 100644 (file)
@@ -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 *> QuadraticPolygon::intersectMySelfWith(const QuadraticPolygon& other) const
 {
   QuadraticPolygon cpyOfThis(*this);
index 7d69dbcd1bc678960cd5d2e714f4d02bd69813c6..7b5146df60d896e8de57016881d2643ccc4d3ca2 100644 (file)
@@ -33,6 +33,7 @@ namespace INTERP_KERNEL
     std::vector<QuadraticPolygon *> 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;
index 38edb6b1b2fb2d60298686a83aa81b03df3faa0e..786dc3ca14e69037c4a6a028f22624e76164dc78 100644 (file)
@@ -38,12 +38,18 @@ void QuadraticPlanarInterpTest::checkPolygonsIntersection1()
             double tmp1=0.,tmp2=0.,tmp3=0.,tmp4=0.;
             pol1.intersectForPerimeter(pol2,tmp1,tmp2,tmp3,tmp4);
             vector<double> v1,v2;
+            vector<int> 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);