(*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.
*/
}
}
+
+
/*!
* 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.
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;
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;
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);
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;
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);