Back to index

salome-med  6.5.0
QuadraticPlanarInterpTest.cxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 
00020 #include "QuadraticPlanarInterpTest.hxx"
00021 #include "InterpKernelGeo2DQuadraticPolygon.hxx"
00022 #include "InterpKernelGeo2DEdgeArcCircle.hxx"
00023 #include "InterpKernelGeo2DElementaryEdge.hxx"
00024 #include "InterpKernelGeo2DComposedEdge.hxx"
00025 #include "InterpKernelGeo2DEdgeLin.hxx"
00026 #include "TestInterpKernelUtils.hxx"
00027 
00028 #include <sstream>
00029 #include <iostream>
00030 
00031 using namespace INTERP_KERNEL;
00032 
00033 namespace INTERP_TEST
00034 {
00035 
00036 static const double ADMISSIBLE_ERROR = 1.e-14;
00037 
00038 void QuadraticPlanarInterpTest::setUp()
00039 {
00040 }
00041 
00042 void QuadraticPlanarInterpTest::tearDown()
00043 {
00044 }
00045 
00046 void QuadraticPlanarInterpTest::cleanUp()
00047 {
00048 }
00049 
00050 void QuadraticPlanarInterpTest::ReadWriteInXfigElementary()
00051 {
00052   //Testing bounds calculation. For Seg2
00053   std::istringstream stream("2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2\n3200 3400 4500 4700");
00054   EdgeLin *e1=new EdgeLin(stream);
00055   Bounds bound=e1->getBounds();
00056   CPPUNIT_ASSERT_DOUBLES_EQUAL(0.32,bound[0],ADMISSIBLE_ERROR);
00057   CPPUNIT_ASSERT_DOUBLES_EQUAL(0.45,bound[1],ADMISSIBLE_ERROR);
00058   CPPUNIT_ASSERT_DOUBLES_EQUAL(0.34,bound[2],ADMISSIBLE_ERROR);
00059   CPPUNIT_ASSERT_DOUBLES_EQUAL(0.47,bound[3],ADMISSIBLE_ERROR);
00060   e1->decrRef();
00061   std::istringstream stream2("2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2\n4500 4700 3200 3400");
00062   e1=new EdgeLin(stream2);
00063   bound=e1->getBounds();
00064   CPPUNIT_ASSERT_DOUBLES_EQUAL(0.32,bound[0],ADMISSIBLE_ERROR);
00065   CPPUNIT_ASSERT_DOUBLES_EQUAL(0.45,bound[1],ADMISSIBLE_ERROR);
00066   CPPUNIT_ASSERT_DOUBLES_EQUAL(0.34,bound[2],ADMISSIBLE_ERROR);
00067   CPPUNIT_ASSERT_DOUBLES_EQUAL(0.47,bound[3],ADMISSIBLE_ERROR);
00068   e1->decrRef();
00069   //Testing bounds calculation For Arc of circle.
00070   
00071 }
00072 
00073 void QuadraticPlanarInterpTest::ReadWriteInXfigGlobal()
00074 {
00075   QuadraticPolygon pol1(INTERP_TEST::getResourceFile("Pol1.fig").c_str());
00076   pol1.dumpInXfigFile("Pol1_gen.fig");
00077   QuadraticPolygon pol2(INTERP_TEST::getResourceFile("Pol2.fig").c_str());
00078   pol2.dumpInXfigFile("Pol2_gen.fig");
00079   QuadraticPolygon pol3(INTERP_TEST::getResourceFile("Pol3.fig").c_str());
00080   pol3.dumpInXfigFile("Pol3_gen.fig");
00081   QuadraticPolygon pol4(INTERP_TEST::getResourceFile("Pol4.fig").c_str());
00082   CPPUNIT_ASSERT_EQUAL(1,pol4.size());
00083   ElementaryEdge *edge1=dynamic_cast<ElementaryEdge *>(pol4[0]);
00084   CPPUNIT_ASSERT(edge1);
00085   Edge *edge2=edge1->getPtr();
00086   EdgeArcCircle *edge=dynamic_cast<EdgeArcCircle *>(edge2);
00087   CPPUNIT_ASSERT(edge);
00088   CPPUNIT_ASSERT_DOUBLES_EQUAL(0.24375,edge->getRadius(),ADMISSIBLE_ERROR);
00089   CPPUNIT_ASSERT_DOUBLES_EQUAL(5.7857653289925404,edge->getAngle(),ADMISSIBLE_ERROR);
00090   double center[2];
00091   edge->getCenter(center);
00092   CPPUNIT_ASSERT_DOUBLES_EQUAL(0.48,center[0],ADMISSIBLE_ERROR);
00093   CPPUNIT_ASSERT_DOUBLES_EQUAL(0.48375,center[1],ADMISSIBLE_ERROR);
00094   const double *start=*edge->getStartNode();
00095   Node *n1=new Node(start[0]+2*(center[0]-start[0]),start[1]+2*(center[1]-start[1]));
00096   edge->changeMiddle(n1);
00097   CPPUNIT_ASSERT_DOUBLES_EQUAL(0.24375,edge->getRadius(),ADMISSIBLE_ERROR);
00098   CPPUNIT_ASSERT_DOUBLES_EQUAL(5.7857653289925404,edge->getAngle(),ADMISSIBLE_ERROR);
00099   n1->decrRef();
00100   n1=new Node(center[0],center[1]+0.24375);
00101   edge->changeMiddle(n1);
00102   CPPUNIT_ASSERT_DOUBLES_EQUAL(0.24375,edge->getRadius(),ADMISSIBLE_ERROR);
00103   CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.49741997818704586,edge->getAngle(),ADMISSIBLE_ERROR);//5.7857653289925404 + 2*PI
00104   n1->decrRef();
00105   //A half circle.
00106   EdgeArcCircle *e=new EdgeArcCircle(0.84,0.54,0.78,0.6,0.84,0.66);
00107   CPPUNIT_ASSERT_DOUBLES_EQUAL(0.06,e->getRadius(),ADMISSIBLE_ERROR);
00108   CPPUNIT_ASSERT_DOUBLES_EQUAL(-3.1415925921507317,e->getAngle(),1e-5);
00109   e->decrRef();
00110   e=new EdgeArcCircle(0.84,0.54,0.9,0.6,0.84,0.66);
00111   CPPUNIT_ASSERT_DOUBLES_EQUAL(0.06,e->getRadius(),ADMISSIBLE_ERROR);
00112   CPPUNIT_ASSERT_DOUBLES_EQUAL(3.1415925921507317,e->getAngle(),1e-5);
00113   e->decrRef();
00114 }
00115 
00116 void QuadraticPlanarInterpTest::BasicGeometricTools()
00117 {
00118   Node *n1=new Node(1.,1.);
00119   Node *n2=new Node(4.,2.);
00120   EdgeLin *e1=new EdgeLin(n1,n2);
00121   double tmp[2];
00122   e1->getNormalVector(tmp);
00123   CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.94868329805051377,tmp[1],ADMISSIBLE_ERROR);
00124   CPPUNIT_ASSERT_DOUBLES_EQUAL(0.31622776601683794,tmp[0],ADMISSIBLE_ERROR);
00125   e1->decrRef();
00126   n1->decrRef(); n2->decrRef();
00127   n1=new Node(1.,1.);
00128   n2=new Node(0.,4.);
00129   e1=new EdgeLin(n1,n2);
00130   double tmp2[2];
00131   e1->getNormalVector(tmp2);
00132   CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,Node::dot(tmp,tmp2),1e-10);
00133   tmp[0]=0.5; tmp[1]=2.5;
00134   CPPUNIT_ASSERT(e1->isNodeLyingOn(tmp));
00135   CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,e1->getDistanceToPoint(tmp),1e-12);
00136   tmp[1]=2.55; CPPUNIT_ASSERT(!e1->isNodeLyingOn(tmp));
00137   CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0158113883008418,e1->getDistanceToPoint(tmp),1e-12);
00138   tmp[0]=0.; tmp[1]=5.;
00139   CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,e1->getDistanceToPoint(tmp),1e-12);
00140   EdgeArcCircle *e=new EdgeArcCircle(4.,3.,0.,5.,-5.,0.);
00141   tmp[0]=-4.; tmp[1]=3.;
00142   CPPUNIT_ASSERT(e->isNodeLyingOn(tmp));
00143   CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,e->getDistanceToPoint(tmp),1e-12);
00144   tmp[1]=3.1; CPPUNIT_ASSERT(!e->isNodeLyingOn(tmp));
00145   CPPUNIT_ASSERT_DOUBLES_EQUAL(6.0632371551998077e-2,e->getDistanceToPoint(tmp),1e-12);
00146   tmp[0]=-4.; tmp[1]=-3.;
00147   CPPUNIT_ASSERT(!e->isNodeLyingOn(tmp));
00148   CPPUNIT_ASSERT_DOUBLES_EQUAL(3.1622776601683795,e->getDistanceToPoint(tmp),1e-12);
00149   e->decrRef();
00150   e1->decrRef();
00151   n1->decrRef(); n2->decrRef();
00152 }
00153 
00154 void QuadraticPlanarInterpTest::IntersectionBasics()
00155 {
00156   //Testing intersection of Bounds.
00157   std::istringstream stream1("2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2\n3200 3400 4500 4800");
00158   EdgeLin *e1=new EdgeLin(stream1);
00159   std::istringstream stream2("2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2\n3200 3400 4500 4800");
00160   EdgeLin *e2=new EdgeLin(stream2);
00161   Bounds *bound=e1->getBounds().amIIntersectingWith(e2->getBounds()); CPPUNIT_ASSERT(bound);
00162   CPPUNIT_ASSERT_DOUBLES_EQUAL(0.32,(*bound)[0],ADMISSIBLE_ERROR);
00163   CPPUNIT_ASSERT_DOUBLES_EQUAL(0.45,(*bound)[1],ADMISSIBLE_ERROR);
00164   CPPUNIT_ASSERT_DOUBLES_EQUAL(0.34,(*bound)[2],ADMISSIBLE_ERROR);
00165   CPPUNIT_ASSERT_DOUBLES_EQUAL(0.48,(*bound)[3],ADMISSIBLE_ERROR);
00166   delete bound;
00167   e2->decrRef(); e1->decrRef();
00168   //
00169   std::istringstream stream3("2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2\n3000 7200 6000 3700");
00170   EdgeLin *e3=new EdgeLin(stream3);
00171   std::istringstream stream4("2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2\n4800 6600 7200 4200");
00172   EdgeLin *e4=new EdgeLin(stream4);
00173   bound=e3->getBounds().amIIntersectingWith(e4->getBounds()); CPPUNIT_ASSERT(bound);
00174   CPPUNIT_ASSERT_DOUBLES_EQUAL(0.48,(*bound)[0],ADMISSIBLE_ERROR);
00175   CPPUNIT_ASSERT_DOUBLES_EQUAL(0.6,(*bound)[1],ADMISSIBLE_ERROR);
00176   CPPUNIT_ASSERT_DOUBLES_EQUAL(0.42,(*bound)[2],ADMISSIBLE_ERROR);
00177   CPPUNIT_ASSERT_DOUBLES_EQUAL(0.66,(*bound)[3],ADMISSIBLE_ERROR);
00178   delete bound;
00179   e3->decrRef(); e4->decrRef();
00180 }
00181 
00182 void QuadraticPlanarInterpTest::EdgeLinUnitary()
00183 {
00184   EdgeLin *e1=new EdgeLin(0.5,0.5,3.7,4.1);
00185   Node *n=new Node(2.1,2.3);
00186   CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getCharactValue(*n),0.5,1e-8);
00187   n->decrRef();
00188   n=new Node(3.7,4.1);
00189   CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getCharactValue(*n),1.,1e-8);
00190   n->decrRef();
00191   n=new Node(0.5,0.5);
00192   CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getCharactValue(*n),0.,1e-8);
00193   n->decrRef();
00194   n=new Node(-1.1,-1.3);
00195   CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getCharactValue(*n),-0.5,1e-8);
00196   n->decrRef();
00197   n=new Node(5.3,5.9);
00198   CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getCharactValue(*n),1.5,1e-8);
00199   n->decrRef(); e1->decrRef();
00200 }
00201 
00208 void QuadraticPlanarInterpTest::IntersectionEdgeOverlapUnitarySegSeg()
00209 {
00210   ComposedEdge& v1=*(new ComposedEdge);
00211   ComposedEdge& v2=*(new ComposedEdge);
00212   MergePoints v3;
00213   //Testing merge of geometric equals seg2.
00214   Edge *e1=new EdgeLin(0.5,0.5,1.,1.); Edge *e2=new EdgeLin(0.5,0.5,1.,1.);
00215   CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
00216   CPPUNIT_ASSERT_EQUAL(2,(int)v3.getNumberOfAssociations());
00217   CPPUNIT_ASSERT_EQUAL(1,(int)v1.size()); CPPUNIT_ASSERT_EQUAL(1,(int)v2.size());
00218   CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection()); CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e1) && v2[0]->getDirection());
00219   v1.clear(); v2.clear(); v3.clear();
00220   //  - testing by adding some noise
00221   e1->decrRef(); e1=new EdgeLin(0.5+5.e-15,0.5-5.e-15,1.,1.+7.e-15);
00222   CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
00223   CPPUNIT_ASSERT_EQUAL(2,(int)v3.getNumberOfAssociations());
00224   CPPUNIT_ASSERT_EQUAL(1,(int)v1.size()); CPPUNIT_ASSERT_EQUAL(1,(int)v2.size());
00225   CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection()); CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e1) && v2[0]->getDirection());
00226   e2->decrRef(); e1->decrRef();
00227   v1.clear(); v2.clear(); v3.clear();
00228   //Testing merge of geometric equals seg2 but now with opposite direction
00229   e1=new EdgeLin(0.5,0.5,0.7,0.7); e2=new EdgeLin(0.7+6.e-15,0.7-2.e-15,0.5+3.e-15,0.5-4.e-15);
00230   CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
00231   CPPUNIT_ASSERT_EQUAL(2,(int)v3.getNumberOfAssociations());
00232   CPPUNIT_ASSERT_EQUAL(1,(int)v1.size()); CPPUNIT_ASSERT_EQUAL(1,(int)v2.size());
00233   CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection()); CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e1) && !v2[0]->getDirection());//compared 8 lines above !v2[0]->getDirection()
00234   e2->decrRef(); e1->decrRef();
00235   v1.clear(); v2.clear(); v3.clear();
00236   //Test 0
00237   //Test 1 - OUT_AFTER - OUT_AFTER | same dir. - 0
00238   e1=new EdgeLin(0.,0.,1.,0.); e2=new EdgeLin(1.5,0.,2.,0.);
00239   CPPUNIT_ASSERT(!e1->intersectWith(e2,v3,v1,v2));
00240   CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
00241   CPPUNIT_ASSERT_EQUAL(0,(int)v1.size());
00242   CPPUNIT_ASSERT_EQUAL(0,(int)v2.size());
00243   e2->decrRef(); e1->decrRef();
00244   v1.clear(); v2.clear(); v3.clear();
00245   //Test 2 - INSIDE - OUT_AFTER | same dir. - 0
00246   e1=new EdgeLin(0.,0.,1.,0.); e2=new EdgeLin(0.5,0.,1.5,0.);
00247   CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
00248   CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
00249   CPPUNIT_ASSERT_EQUAL(2,(int)v1.size());
00250   CPPUNIT_ASSERT_EQUAL(2,(int)v2.size());
00251   CPPUNIT_ASSERT(v1[1]->intresicEqualDirSensitive(v2[0]));
00252   CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode()); CPPUNIT_ASSERT(e1->getStartNode()==v1[0]->getStartNode()); CPPUNIT_ASSERT(e1->getEndNode()==v1[1]->getEndNode());
00253   CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode()); CPPUNIT_ASSERT(e2->getStartNode()==v2[0]->getStartNode()); CPPUNIT_ASSERT(e2->getEndNode()==v2[1]->getEndNode());
00254   CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
00255   CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
00256   e2->decrRef(); e1->decrRef();
00257   v1.clear(); v2.clear(); v3.clear();
00258   //Test 2 - INSIDE - OUT_AFTER | same dir. - 90
00259   e1=new EdgeLin(0.,0.,0.,1.); e2=new EdgeLin(0.,0.5,0.,1.5);
00260   CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
00261   CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
00262   CPPUNIT_ASSERT_EQUAL(2,(int)v1.size());
00263   CPPUNIT_ASSERT_EQUAL(2,(int)v2.size());
00264   CPPUNIT_ASSERT(v1[1]->intresicEqualDirSensitive(v2[0]));
00265   CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode()); CPPUNIT_ASSERT(e1->getStartNode()==v1[0]->getStartNode()); CPPUNIT_ASSERT(e1->getEndNode()==v1[1]->getEndNode());
00266   CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode()); CPPUNIT_ASSERT(e2->getStartNode()==v2[0]->getStartNode()); CPPUNIT_ASSERT(e2->getEndNode()==v2[1]->getEndNode());
00267   CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
00268   CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
00269   e2->decrRef(); e1->decrRef();
00270   v1.clear(); v2.clear(); v3.clear();
00271   //Test 2 - INSIDE - OUT_AFTER | same dir. - 45
00272   e1=new EdgeLin(0.,0.,1.,1.); e2=new EdgeLin(0.5,0.5,1.5,1.5);
00273   CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
00274   CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
00275   CPPUNIT_ASSERT_EQUAL(2,(int)v1.size());
00276   CPPUNIT_ASSERT_EQUAL(2,(int)v2.size());
00277   CPPUNIT_ASSERT(v1[1]->intresicEqualDirSensitive(v2[0]));
00278   CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode()); CPPUNIT_ASSERT(e1->getStartNode()==v1[0]->getStartNode()); CPPUNIT_ASSERT(e1->getEndNode()==v1[1]->getEndNode());
00279   CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode()); CPPUNIT_ASSERT(e2->getStartNode()==v2[0]->getStartNode()); CPPUNIT_ASSERT(e2->getEndNode()==v2[1]->getEndNode());
00280   e2->decrRef(); e1->decrRef();
00281   v1.clear(); v2.clear(); v3.clear();
00282   //Test 2 - INSIDE - OUT_AFTER | opp. dir. - 45
00283   e1=new EdgeLin(0.,0.,1.,1.); e2=new EdgeLin(1.5,1.5,0.5,0.5);
00284   CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
00285   CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
00286   CPPUNIT_ASSERT_EQUAL(2,(int)v1.size());
00287   CPPUNIT_ASSERT_EQUAL(2,(int)v2.size());
00288   CPPUNIT_ASSERT(!v1[1]->intresicEqualDirSensitive(v2[1]) && v1[1]->intresicEqual(v2[1]));
00289   CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode()); CPPUNIT_ASSERT(e1->getStartNode()==v1[0]->getStartNode()); CPPUNIT_ASSERT(e1->getEndNode()==v1[1]->getEndNode());
00290   CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode()); CPPUNIT_ASSERT(e2->getStartNode()==v2[0]->getStartNode()); CPPUNIT_ASSERT(e2->getEndNode()==v2[1]->getEndNode());
00291   CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
00292   CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
00293   e2->decrRef(); e1->decrRef();
00294   v1.clear(); v2.clear(); v3.clear();
00295   //Test 3 - INSIDE - INSIDE | same dir. - 0
00296   e1=new EdgeLin(0.,0.,1.,0.); e2=new EdgeLin(0.25,0.,0.75,0.);
00297   CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
00298   CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
00299   CPPUNIT_ASSERT_EQUAL(3,(int)v1.size());
00300   CPPUNIT_ASSERT_EQUAL(1,(int)v2.size());
00301   CPPUNIT_ASSERT(v1[1]->intresincEqCoarse(e2) && v1[1]->getDirection());
00302   CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode()); CPPUNIT_ASSERT(v1[1]->getEndNode()==v1[2]->getStartNode());
00303   CPPUNIT_ASSERT(v1[0]->getStartNode()== e1->getStartNode()); CPPUNIT_ASSERT(v1[2]->getEndNode()== e1->getEndNode());
00304   CPPUNIT_ASSERT(v1[0]->getEndNode()==e2->getStartNode()); CPPUNIT_ASSERT(v1[1]->getEndNode()==e2->getEndNode());
00305   CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
00306   CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
00307   e2->decrRef(); e1->decrRef();
00308   v1.clear(); v2.clear(); v3.clear();
00309   //Test 3 - INSIDE - INSIDE | same dir. - 90
00310   e1=new EdgeLin(0.,0.,0.,1.); e2=new EdgeLin(0.,0.25,0.,0.75);
00311   CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
00312   CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
00313   CPPUNIT_ASSERT_EQUAL(3,(int)v1.size());
00314   CPPUNIT_ASSERT_EQUAL(1,(int)v2.size());
00315   CPPUNIT_ASSERT(v1[1]->intresincEqCoarse(e2) && v1[1]->getDirection());
00316   CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode()); CPPUNIT_ASSERT(v1[1]->getEndNode()==v1[2]->getStartNode());
00317   CPPUNIT_ASSERT(v1[0]->getStartNode()== e1->getStartNode()); CPPUNIT_ASSERT(v1[2]->getEndNode()== e1->getEndNode());
00318   CPPUNIT_ASSERT(v1[0]->getEndNode()==e2->getStartNode()); CPPUNIT_ASSERT(v1[1]->getEndNode()==e2->getEndNode());
00319   CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
00320   CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
00321   e2->decrRef(); e1->decrRef();
00322   v1.clear(); v2.clear(); v3.clear();
00323   //Test 3 - INSIDE - INSIDE | same dir. - 45
00324   e1=new EdgeLin(0.,0.,1.,1.); e2=new EdgeLin(0.25,0.25,0.75,0.75);
00325   CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
00326   CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
00327   CPPUNIT_ASSERT_EQUAL(3,(int)v1.size());
00328   CPPUNIT_ASSERT_EQUAL(1,(int)v2.size());
00329   CPPUNIT_ASSERT(v1[1]->intresincEqCoarse(e2) && v1[1]->getDirection());
00330   CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode()); CPPUNIT_ASSERT(v1[1]->getEndNode()==v1[2]->getStartNode());
00331   CPPUNIT_ASSERT(v1[0]->getStartNode()== e1->getStartNode()); CPPUNIT_ASSERT(v1[2]->getEndNode()== e1->getEndNode());
00332   CPPUNIT_ASSERT(v1[0]->getEndNode()==e2->getStartNode()); CPPUNIT_ASSERT(v1[1]->getEndNode()==e2->getEndNode());
00333   CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
00334   CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
00335   e2->decrRef(); e1->decrRef();
00336   v1.clear(); v2.clear(); v3.clear();
00337   //Test 3 - INSIDE - INSIDE | opp dir. - 45
00338   e1=new EdgeLin(0.,0.,1.,1.); e2=new EdgeLin(0.75,0.75,0.25,0.25);
00339   CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
00340   CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
00341   CPPUNIT_ASSERT_EQUAL(3,(int)v1.size());
00342   CPPUNIT_ASSERT_EQUAL(1,(int)v2.size());
00343   CPPUNIT_ASSERT(v1[1]->intresincEqCoarse(e2) && !v1[1]->getDirection());
00344   CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode()); CPPUNIT_ASSERT(v1[1]->getEndNode()==v1[2]->getStartNode());
00345   CPPUNIT_ASSERT(v1[0]->getStartNode()== e1->getStartNode()); CPPUNIT_ASSERT(v1[2]->getEndNode()== e1->getEndNode());
00346   CPPUNIT_ASSERT(v1[0]->getEndNode()==e2->getEndNode()); CPPUNIT_ASSERT(v1[1]->getEndNode()==e2->getStartNode());
00347   CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
00348   CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
00349   e2->decrRef(); e1->decrRef();
00350   v1.clear(); v2.clear(); v3.clear();
00351   //Test 3bis - INSIDE - INSIDE - Bis | opp dir.
00352   double center[2]={0.,0.};
00353   double radius=1.;
00354   e1=buildArcOfCircle(center,radius,-M_PI,0); e2=buildArcOfCircle(center,radius,-2*M_PI/3.+2*M_PI,-M_PI/3.);
00355   CPPUNIT_ASSERT_DOUBLES_EQUAL(M_PI,e1->getCurveLength(),1e-12); CPPUNIT_ASSERT_DOUBLES_EQUAL(5.*M_PI/3.,e2->getCurveLength(),1e-12);// To check that in the previous line +2.M_PI has done its job.
00356   CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
00357   CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
00358   CPPUNIT_ASSERT_EQUAL(3,(int)v1.size());
00359   CPPUNIT_ASSERT_EQUAL(3,(int)v2.size());
00360   CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(v2[0]->getPtr())); CPPUNIT_ASSERT(v1[0]->getDirection()); CPPUNIT_ASSERT(!v2[0]->getDirection());
00361   CPPUNIT_ASSERT(v1[2]->intresincEqCoarse(v2[2]->getPtr())); CPPUNIT_ASSERT(v1[2]->getDirection()); CPPUNIT_ASSERT(!v2[2]->getDirection());
00362   CPPUNIT_ASSERT_DOUBLES_EQUAL(M_PI,v2[1]->getCurveLength(),1.e-12);
00363   CPPUNIT_ASSERT_DOUBLES_EQUAL(M_PI/3.,v1[1]->getCurveLength(),1.e-12);
00364   CPPUNIT_ASSERT(v2[1]->getStartNode()==e1->getStartNode());
00365   CPPUNIT_ASSERT(v2[1]->getEndNode()==e1->getEndNode());
00366   CPPUNIT_ASSERT(v1[0]->getStartNode()==e1->getStartNode());
00367   CPPUNIT_ASSERT(v1[0]->getEndNode()==e2->getStartNode());
00368   CPPUNIT_ASSERT(v1[1]->getStartNode()==e2->getStartNode());
00369   CPPUNIT_ASSERT(v1[1]->getEndNode()==e2->getEndNode());
00370   e2->decrRef(); e1->decrRef();
00371   v1.clear(); v2.clear(); v3.clear();
00372   //Test 3bis - INSIDE - INSIDE - Bis | same dir.
00373   e1=buildArcOfCircle(center,radius,-M_PI,0); e2=buildArcOfCircle(center,radius,-M_PI/3.,-2*M_PI/3.+2*M_PI);
00374   CPPUNIT_ASSERT_DOUBLES_EQUAL(M_PI,e1->getCurveLength(),1e-12); CPPUNIT_ASSERT_DOUBLES_EQUAL(5.*M_PI/3.,e2->getCurveLength(),1e-12);// To check that in the previous line +2.M_PI has done its job.
00375   CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
00376   CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
00377   CPPUNIT_ASSERT_EQUAL(3,(int)v1.size());
00378   CPPUNIT_ASSERT_EQUAL(3,(int)v2.size());
00379   CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(v2[2]->getPtr())); CPPUNIT_ASSERT(v1[0]->getDirection()); CPPUNIT_ASSERT(v2[2]->getDirection());
00380   CPPUNIT_ASSERT(v1[2]->intresincEqCoarse(v2[0]->getPtr())); CPPUNIT_ASSERT(v1[2]->getDirection()); CPPUNIT_ASSERT(v2[0]->getDirection());
00381   CPPUNIT_ASSERT_DOUBLES_EQUAL(M_PI,v2[1]->getCurveLength(),1.e-12);
00382   CPPUNIT_ASSERT_DOUBLES_EQUAL(M_PI/3.,v1[1]->getCurveLength(),1.e-12);
00383   CPPUNIT_ASSERT(v2[1]->getStartNode()==e1->getEndNode());
00384   CPPUNIT_ASSERT(v2[1]->getEndNode()==e1->getStartNode());
00385   CPPUNIT_ASSERT(v1[0]->getStartNode()==e1->getStartNode());
00386   CPPUNIT_ASSERT(v1[0]->getEndNode()==e2->getEndNode());
00387   CPPUNIT_ASSERT(v1[1]->getStartNode()==e2->getEndNode());
00388   CPPUNIT_ASSERT(v1[1]->getEndNode()==e2->getStartNode());
00389   e2->decrRef(); e1->decrRef();
00390   v1.clear(); v2.clear(); v3.clear();
00391   //Test 3bis - INSIDE - INSIDE - Bis | opp dir. | e1<->e2 to test symetry
00392   e1=buildArcOfCircle(center,radius,-M_PI,0); e2=buildArcOfCircle(center,radius,-2*M_PI/3.+2*M_PI,-M_PI/3.);
00393   CPPUNIT_ASSERT_DOUBLES_EQUAL(M_PI,e1->getCurveLength(),1e-12); CPPUNIT_ASSERT_DOUBLES_EQUAL(5.*M_PI/3.,e2->getCurveLength(),1e-12);// To check that in the previous line +2.M_PI has done its job.
00394   CPPUNIT_ASSERT(e2->intersectWith(e1,v3,v2,v1));
00395   CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
00396   CPPUNIT_ASSERT_EQUAL(3,(int)v1.size());
00397   CPPUNIT_ASSERT_EQUAL(3,(int)v2.size());
00398   CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(v2[0]->getPtr())); CPPUNIT_ASSERT(!v1[0]->getDirection()); CPPUNIT_ASSERT(v2[0]->getDirection());
00399   CPPUNIT_ASSERT(v1[2]->intresincEqCoarse(v2[2]->getPtr())); CPPUNIT_ASSERT(!v1[2]->getDirection()); CPPUNIT_ASSERT(v2[2]->getDirection());
00400   CPPUNIT_ASSERT_DOUBLES_EQUAL(M_PI,v2[1]->getCurveLength(),1.e-5); // << not maximal precision because node switching 
00401   CPPUNIT_ASSERT_DOUBLES_EQUAL(M_PI/3.,v1[1]->getCurveLength(),1.e-12);
00402   CPPUNIT_ASSERT(v2[1]->getStartNode()==e1->getStartNode());
00403   CPPUNIT_ASSERT(v2[1]->getEndNode()==e1->getEndNode());
00404   CPPUNIT_ASSERT(v1[0]->getStartNode()==e1->getStartNode());
00405   CPPUNIT_ASSERT(v1[0]->getEndNode()==e2->getStartNode());
00406   CPPUNIT_ASSERT(v1[1]->getStartNode()==e2->getStartNode());
00407   CPPUNIT_ASSERT(v1[1]->getEndNode()==e2->getEndNode());
00408   e2->decrRef(); e1->decrRef();
00409   v1.clear(); v2.clear(); v3.clear();
00410   //Test 3bis - INSIDE - INSIDE - Bis | same dir. | e1<->e2 to test symetry
00411   e1=buildArcOfCircle(center,radius,-M_PI,0); e2=buildArcOfCircle(center,radius,-M_PI/3.,-2*M_PI/3.+2*M_PI);
00412   CPPUNIT_ASSERT_DOUBLES_EQUAL(M_PI,e1->getCurveLength(),1e-12); CPPUNIT_ASSERT_DOUBLES_EQUAL(5.*M_PI/3.,e2->getCurveLength(),1e-12);// To check that in the previous line +2.M_PI has done its job.
00413   CPPUNIT_ASSERT(e2->intersectWith(e1,v3,v2,v1));
00414   CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
00415   CPPUNIT_ASSERT_EQUAL(3,(int)v1.size());
00416   CPPUNIT_ASSERT_EQUAL(3,(int)v2.size());
00417   CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(v2[2]->getPtr())); CPPUNIT_ASSERT(v1[0]->getDirection()); CPPUNIT_ASSERT(v2[2]->getDirection());
00418   CPPUNIT_ASSERT(v1[2]->intresincEqCoarse(v2[0]->getPtr())); CPPUNIT_ASSERT(v1[2]->getDirection()); CPPUNIT_ASSERT(v2[0]->getDirection());
00419   CPPUNIT_ASSERT_DOUBLES_EQUAL(M_PI,v2[1]->getCurveLength(),1.e-5); // << not maximal precision because node switching 
00420   CPPUNIT_ASSERT_DOUBLES_EQUAL(M_PI/3.,v1[1]->getCurveLength(),1.e-12);
00421   CPPUNIT_ASSERT(v2[1]->getStartNode()==e1->getEndNode());
00422   CPPUNIT_ASSERT(v2[1]->getEndNode()==e1->getStartNode());
00423   CPPUNIT_ASSERT(v1[0]->getStartNode()==e1->getStartNode());
00424   CPPUNIT_ASSERT(v1[0]->getEndNode()==e2->getEndNode());
00425   CPPUNIT_ASSERT(v1[1]->getStartNode()==e2->getEndNode());
00426   CPPUNIT_ASSERT(v1[1]->getEndNode()==e2->getStartNode());
00427   e2->decrRef(); e1->decrRef();
00428   v1.clear(); v2.clear(); v3.clear();
00429   //Test 4 - OUT_BEFORE - OUT_BEFORE | same dir. - 0 
00430   e1=new EdgeLin(0.,0.,1.,0.); e2=new EdgeLin(-1.,0.,-0.5,0.);
00431   CPPUNIT_ASSERT(!e1->intersectWith(e2,v3,v1,v2));
00432   CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
00433   CPPUNIT_ASSERT_EQUAL(0,(int)v1.size());
00434   CPPUNIT_ASSERT_EQUAL(0,(int)v2.size());
00435   e2->decrRef(); e1->decrRef();
00436   v1.clear(); v2.clear(); v3.clear();
00437   //Test 5 - OUT_BEFORE - INSIDE | same dir. - 0
00438   e1=new EdgeLin(0.,0.,1.,0.); e2=new EdgeLin(-0.5,0.,0.5,0.);
00439   CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
00440   CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
00441   CPPUNIT_ASSERT_EQUAL(2,(int)v1.size());
00442   CPPUNIT_ASSERT_EQUAL(2,(int)v2.size());
00443   CPPUNIT_ASSERT(v1[0]->intresicEqualDirSensitive(v2[1]));
00444   CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode()); CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode());
00445   CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
00446   CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
00447   e2->decrRef(); e1->decrRef();
00448   v1.clear(); v2.clear(); v3.clear();
00449   //Test 5 - OUT_BEFORE - INSIDE | same dir. - 90
00450   e1=new EdgeLin(0.,0.,0.,1.); e2=new EdgeLin(0,-0.5,0.,0.5);
00451   CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
00452   CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
00453   CPPUNIT_ASSERT_EQUAL(2,(int)v1.size());
00454   CPPUNIT_ASSERT_EQUAL(2,(int)v2.size());
00455   CPPUNIT_ASSERT(v1[0]->intresicEqualDirSensitive(v2[1]));
00456   CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode()); CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode());
00457   CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
00458   CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
00459   e2->decrRef(); e1->decrRef();
00460   v1.clear(); v2.clear(); v3.clear();
00461   //Test 5 - OUT_BEFORE - INSIDE | same dir. - 45
00462   e1=new EdgeLin(0.,0.,1.,1.); e2=new EdgeLin(-0.5,-0.5,0.5,0.5);
00463   CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
00464   CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
00465   CPPUNIT_ASSERT_EQUAL(2,(int)v1.size());
00466   CPPUNIT_ASSERT_EQUAL(2,(int)v2.size());
00467   CPPUNIT_ASSERT(v1[0]->intresicEqualDirSensitive(v2[1]));
00468   CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode()); CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode());
00469   CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
00470   CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
00471   e2->decrRef(); e1->decrRef();
00472   v1.clear(); v2.clear(); v3.clear();
00473   //Test 5 - OUT_BEFORE - INSIDE | opp dir. - 45
00474   e1=new EdgeLin(0.,0.,1.,1.); e2=new EdgeLin(0.5,0.5,-0.5,-0.5);
00475   CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
00476   CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
00477   CPPUNIT_ASSERT_EQUAL(2,(int)v1.size());
00478   CPPUNIT_ASSERT_EQUAL(2,(int)v2.size());
00479   CPPUNIT_ASSERT(!v1[0]->intresicEqualDirSensitive(v2[0]) && v1[0]->intresicEqual(v2[0]) );
00480   CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode()); CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode());
00481   CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
00482   CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
00483   e2->decrRef(); e1->decrRef();
00484   v1.clear(); v2.clear(); v3.clear();
00485   //Test 6 - OUT_BEFORE - OUT_AFTER | same dir. - 0
00486   e1=new EdgeLin(0.,0.,1.,0.); e2=new EdgeLin(-0.5,0.,1.5,0.);
00487   CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
00488   CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
00489   CPPUNIT_ASSERT_EQUAL(1,(int)v1.size());
00490   CPPUNIT_ASSERT_EQUAL(3,(int)v2.size());
00491   CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection());
00492   CPPUNIT_ASSERT(v2[1]->intresincEqCoarse(e1) && v2[1]->getDirection());
00493   CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode() && v2[1]->getEndNode()==v2[2]->getStartNode());
00494   CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
00495   CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
00496   e2->decrRef(); e1->decrRef();
00497   v1.clear(); v2.clear(); v3.clear();
00498   //Test 6 - OUT_BEFORE - OUT_AFTER | same dir. - 90
00499   e1=new EdgeLin(0.,0.,0.,1.); e2=new EdgeLin(0.,-0.5,0.,1.5);
00500   CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
00501   CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
00502   CPPUNIT_ASSERT_EQUAL(1,(int)v1.size());
00503   CPPUNIT_ASSERT_EQUAL(3,(int)v2.size());
00504   CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection());
00505   CPPUNIT_ASSERT(v2[1]->intresincEqCoarse(e1) && v2[1]->getDirection());
00506   CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode() && v2[1]->getEndNode()==v2[2]->getStartNode());
00507   CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
00508   CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
00509   e2->decrRef(); e1->decrRef();
00510   v1.clear(); v2.clear(); v3.clear();
00511   //Test 6 - OUT_BEFORE - OUT_AFTER | same dir. - 45
00512   e1=new EdgeLin(0.,0.,1.,1.); e2=new EdgeLin(-0.5,-0.5,1.5,1.5);
00513   CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
00514   CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
00515   CPPUNIT_ASSERT_EQUAL(1,(int)v1.size());
00516   CPPUNIT_ASSERT_EQUAL(3,(int)v2.size());
00517   CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection());
00518   CPPUNIT_ASSERT(v2[1]->intresincEqCoarse(e1) && v2[1]->getDirection());
00519   CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode() && v2[1]->getEndNode()==v2[2]->getStartNode());
00520   CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
00521   CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
00522   e2->decrRef(); e1->decrRef();
00523   v1.clear(); v2.clear(); v3.clear();
00524   //Test 6 - OUT_BEFORE - OUT_AFTER | opp dir. - 45
00525   e1=new EdgeLin(0.,0.,1.,1.); e2=new EdgeLin(1.5,1.5,-0.5,-0.5);
00526   CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
00527   CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
00528   CPPUNIT_ASSERT_EQUAL(1,(int)v1.size());
00529   CPPUNIT_ASSERT_EQUAL(3,(int)v2.size());
00530   CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection());
00531   CPPUNIT_ASSERT(v2[1]->intresincEqCoarse(e1) && !v2[1]->getDirection());
00532   CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode() && v2[1]->getEndNode()==v2[2]->getStartNode());
00533   CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
00534   CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
00535   e2->decrRef(); e1->decrRef();
00536   v1.clear(); v2.clear(); v3.clear();
00537   //Test 7 - END - OUT_AFTER | same dir. - 0
00538   e1=new EdgeLin(0.,0.,1.,0.); e2=new EdgeLin(1.,0.,1.5,0.);
00539   CPPUNIT_ASSERT(!e1->intersectWith(e2,v3,v1,v2));
00540   CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations());
00541   CPPUNIT_ASSERT_EQUAL(0,(int)v1.size());
00542   CPPUNIT_ASSERT_EQUAL(0,(int)v2.size());
00543   e2->decrRef(); e1->decrRef();
00544   v1.clear(); v2.clear(); v3.clear();
00545   //Test 7 - END - OUT_AFTER | opp dir. - 0
00546   e1=new EdgeLin(0.,0.,1.,0.); e2=new EdgeLin(1.5,0.,1.,0.);
00547   CPPUNIT_ASSERT(!e1->intersectWith(e2,v3,v1,v2));
00548   CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations());
00549   CPPUNIT_ASSERT_EQUAL(0,(int)v1.size());
00550   CPPUNIT_ASSERT_EQUAL(0,(int)v2.size());
00551   CPPUNIT_ASSERT(e1->getEndNode()==e2->getEndNode());
00552   e2->decrRef(); e1->decrRef();
00553   v1.clear(); v2.clear(); v3.clear();
00554   //Test 8 - START - END | same dir. - 0
00555   e1=new EdgeLin(0.,0.,0.7,0.); e2=new EdgeLin(0.,0.,0.7,0.);
00556   CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
00557   CPPUNIT_ASSERT_EQUAL(2,(int)v3.getNumberOfAssociations());
00558   CPPUNIT_ASSERT_EQUAL(1,(int)v1.size());
00559   CPPUNIT_ASSERT_EQUAL(1,(int)v2.size());
00560   CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection()); CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e1) && v2[0]->getDirection());
00561   CPPUNIT_ASSERT(e1->getStartNode()==e2->getStartNode()); CPPUNIT_ASSERT(e1->getEndNode()==e2->getEndNode());
00562   CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
00563   CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
00564   e2->decrRef(); e1->decrRef();
00565   v1.clear(); v2.clear(); v3.clear();
00566   //Test 8 - START - END | same dir. - 90
00567   e1=new EdgeLin(0.,0.,0.,0.7); e2=new EdgeLin(0.,0.,0.,0.7);
00568   CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
00569   CPPUNIT_ASSERT_EQUAL(2,(int)v3.getNumberOfAssociations());
00570   CPPUNIT_ASSERT_EQUAL(1,(int)v1.size());
00571   CPPUNIT_ASSERT_EQUAL(1,(int)v2.size());
00572   CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection()); CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e1) && v2[0]->getDirection());
00573   CPPUNIT_ASSERT(e1->getStartNode()==e2->getStartNode()); CPPUNIT_ASSERT(e1->getEndNode()==e2->getEndNode());
00574   CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
00575   CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
00576   e2->decrRef(); e1->decrRef();
00577   v1.clear(); v2.clear(); v3.clear();
00578   //Test 8 - START - END | same dir. - 45
00579   e1=new EdgeLin(0.,0.,0.7,0.7); e2=new EdgeLin(0.,0.,0.7,0.7);
00580   CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
00581   CPPUNIT_ASSERT_EQUAL(2,(int)v3.getNumberOfAssociations());
00582   CPPUNIT_ASSERT_EQUAL(1,(int)v1.size());
00583   CPPUNIT_ASSERT_EQUAL(1,(int)v2.size());
00584   CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection()); CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e1) && v2[0]->getDirection());
00585   CPPUNIT_ASSERT(e1->getStartNode()==e2->getStartNode()); CPPUNIT_ASSERT(e1->getEndNode()==e2->getEndNode());
00586   CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
00587   CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
00588   e2->decrRef(); e1->decrRef();
00589   v1.clear(); v2.clear(); v3.clear();
00590   //Test 8 - START - END | opp. dir. - 45
00591   e1=new EdgeLin(0.,0.,0.7,0.7); e2=new EdgeLin(0.7,0.7,0.,0.);
00592   CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
00593   CPPUNIT_ASSERT_EQUAL(2,(int)v3.getNumberOfAssociations());
00594   CPPUNIT_ASSERT_EQUAL(1,(int)v1.size());
00595   CPPUNIT_ASSERT_EQUAL(1,(int)v2.size());
00596   CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection()); CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e1) && !v2[0]->getDirection());
00597   CPPUNIT_ASSERT(e1->getStartNode()==e2->getEndNode()); CPPUNIT_ASSERT(e1->getEndNode()==e2->getStartNode());
00598   CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
00599   CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
00600   e2->decrRef(); e1->decrRef();
00601   v1.clear(); v2.clear(); v3.clear();
00602   //Test 9 - OUT_BEFORE - START | same dir.
00603   e1=new EdgeLin(0.,0.,1.,0.); e2=new EdgeLin(-0.5,0.,0.,0.);
00604   CPPUNIT_ASSERT(!e1->intersectWith(e2,v3,v1,v2));
00605   CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations());
00606   CPPUNIT_ASSERT_EQUAL(0,(int)v1.size());
00607   CPPUNIT_ASSERT_EQUAL(0,(int)v2.size());
00608   CPPUNIT_ASSERT(e2->getEndNode()==e1->getStartNode());
00609   e2->decrRef(); e1->decrRef();
00610   v1.clear(); v2.clear(); v3.clear();
00611   //Test 10 - START - OUT_AFTER | same dir. - 0
00612   e1=new EdgeLin(0.,0.,0.7,0.); e2=new EdgeLin(0.,0.,1.,0.);
00613   CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
00614   CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations());
00615   CPPUNIT_ASSERT_EQUAL(1,(int)v1.size());
00616   CPPUNIT_ASSERT_EQUAL(2,(int)v2.size());
00617   CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection()); CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e1) && v2[0]->getDirection()); 
00618   CPPUNIT_ASSERT(e1->getStartNode()==v1[0]->getStartNode()); CPPUNIT_ASSERT(e1->getStartNode()==e2->getStartNode()); CPPUNIT_ASSERT(v2[1]->getEndNode()==e2->getEndNode());
00619   CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode());
00620   CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
00621   CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
00622   e2->decrRef(); e1->decrRef();
00623   v1.clear(); v2.clear(); v3.clear();
00624   //Test 10 - START - OUT_AFTER | same dir. - 90
00625   e1=new EdgeLin(0.,0.,0.,0.7); e2=new EdgeLin(0.,0.,0.,1.);
00626   CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
00627   CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations());
00628   CPPUNIT_ASSERT_EQUAL(1,(int)v1.size());
00629   CPPUNIT_ASSERT_EQUAL(2,(int)v2.size());
00630   CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection()); CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e1) && v2[0]->getDirection()); 
00631   CPPUNIT_ASSERT(e1->getStartNode()==v1[0]->getStartNode()); CPPUNIT_ASSERT(e1->getStartNode()==e2->getStartNode()); CPPUNIT_ASSERT(v2[1]->getEndNode()==e2->getEndNode());
00632   CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode());
00633   CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
00634   CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
00635   e2->decrRef(); e1->decrRef();
00636   v1.clear(); v2.clear(); v3.clear();
00637   //Test 10 - START - OUT_AFTER | same dir. - 45
00638   e1=new EdgeLin(0.,0.,0.7,0.7); e2=new EdgeLin(0.,0.,1.,1.);
00639   CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
00640   CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations());
00641   CPPUNIT_ASSERT_EQUAL(1,(int)v1.size());
00642   CPPUNIT_ASSERT_EQUAL(2,(int)v2.size());
00643   CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection()); CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e1) && v2[0]->getDirection()); 
00644   CPPUNIT_ASSERT(e1->getStartNode()==v1[0]->getStartNode()); CPPUNIT_ASSERT(e1->getStartNode()==e2->getStartNode()); CPPUNIT_ASSERT(v2[1]->getEndNode()==e2->getEndNode());
00645   CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode());
00646   CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
00647   CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
00648   e2->decrRef(); e1->decrRef();
00649   v1.clear(); v2.clear(); v3.clear();
00650   //Test 10 - START - OUT_AFTER | opp dir. - 45
00651   e1=new EdgeLin(0.,0.,0.7,0.7); e2=new EdgeLin(1.,1.,0.,0.);
00652   CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
00653   CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations());
00654   CPPUNIT_ASSERT_EQUAL(1,(int)v1.size());
00655   CPPUNIT_ASSERT_EQUAL(2,(int)v2.size());
00656   CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection()); CPPUNIT_ASSERT(v2[1]->intresincEqCoarse(e1) && !v2[1]->getDirection()); 
00657   CPPUNIT_ASSERT(e1->getStartNode()==v1[0]->getStartNode()); CPPUNIT_ASSERT(e1->getStartNode()==e2->getEndNode()); CPPUNIT_ASSERT(v2[1]->getEndNode()==e2->getEndNode());
00658   CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode());
00659   CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
00660   CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
00661   e2->decrRef(); e1->decrRef();
00662   v1.clear(); v2.clear(); v3.clear();
00663   //Test 11 - INSIDE - END | same dir. - 0
00664   e1=new EdgeLin(0.,0.,1.,0.); e2=new EdgeLin(0.7,0.,1.,0.);
00665   CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
00666   CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations());
00667   CPPUNIT_ASSERT_EQUAL(2,(int)v1.size());
00668   CPPUNIT_ASSERT_EQUAL(1,(int)v2.size());
00669   CPPUNIT_ASSERT(v1[1]->intresincEqCoarse(e2) && v1[1]->getDirection()); CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e2) && v2[0]->getDirection()); 
00670   CPPUNIT_ASSERT(e1->getStartNode()==v1[0]->getStartNode()); CPPUNIT_ASSERT(e1->getEndNode()==v1[1]->getEndNode()); CPPUNIT_ASSERT(e1->getEndNode()==e2->getEndNode());
00671   CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode());
00672   CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
00673   CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
00674   e2->decrRef(); e1->decrRef();
00675   v1.clear(); v2.clear(); v3.clear();
00676   //Test 11 - INSIDE - END | same dir. - 90
00677   e1=new EdgeLin(0.,0.,0.,1.); e2=new EdgeLin(0.,0.7,0.,1.);
00678   CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
00679   CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations());
00680   CPPUNIT_ASSERT_EQUAL(2,(int)v1.size());
00681   CPPUNIT_ASSERT_EQUAL(1,(int)v2.size());
00682   CPPUNIT_ASSERT(v1[1]->intresincEqCoarse(e2) && v1[1]->getDirection()); CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e2) && v2[0]->getDirection()); 
00683   CPPUNIT_ASSERT(e1->getStartNode()==v1[0]->getStartNode()); CPPUNIT_ASSERT(e1->getEndNode()==v1[1]->getEndNode()); CPPUNIT_ASSERT(e1->getEndNode()==e2->getEndNode());
00684   CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode());
00685   CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
00686   CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
00687   e2->decrRef(); e1->decrRef();
00688   v1.clear(); v2.clear(); v3.clear();
00689   //Test 11 - INSIDE - END | same dir. - 45
00690   e1=new EdgeLin(0.,0.,1.,1.); e2=new EdgeLin(0.7,0.7,1.,1.);
00691   CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
00692   CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations());
00693   CPPUNIT_ASSERT_EQUAL(2,(int)v1.size());
00694   CPPUNIT_ASSERT_EQUAL(1,(int)v2.size());
00695   CPPUNIT_ASSERT(v1[1]->intresincEqCoarse(e2) && v1[1]->getDirection()); CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e2) && v2[0]->getDirection()); 
00696   CPPUNIT_ASSERT(e1->getStartNode()==v1[0]->getStartNode()); CPPUNIT_ASSERT(e1->getEndNode()==v1[1]->getEndNode()); CPPUNIT_ASSERT(e1->getEndNode()==e2->getEndNode());
00697   CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode());
00698   CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
00699   CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
00700   e2->decrRef(); e1->decrRef();
00701   v1.clear(); v2.clear(); v3.clear();
00702   //Test 11 - INSIDE - END | opp dir. - 45
00703   e1=new EdgeLin(0.,0.,1.,1.); e2=new EdgeLin(1.,1.,0.7,0.7);
00704   CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
00705   CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations());
00706   CPPUNIT_ASSERT_EQUAL(2,(int)v1.size());
00707   CPPUNIT_ASSERT_EQUAL(1,(int)v2.size());
00708   CPPUNIT_ASSERT(e1->getStartNode()==v1[0]->getStartNode()); CPPUNIT_ASSERT(e1->getEndNode()==v1[1]->getEndNode()); CPPUNIT_ASSERT(e1->getEndNode()==e2->getStartNode());
00709   CPPUNIT_ASSERT(v1[1]->intresincEqCoarse(e2) && !v1[1]->getDirection()); CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e2) && v2[0]->getDirection()); 
00710   CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode());
00711   CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
00712   CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
00713   e2->decrRef(); e1->decrRef();
00714   v1.clear(); v2.clear(); v3.clear();
00715   //Test 12 - OUT_BEFORE - END | same dir. - 0
00716   e1=new EdgeLin(0.,0.,1.,0.); e2=new EdgeLin(-0.5,0.,1.,0.);
00717   CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
00718   CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations());
00719   CPPUNIT_ASSERT_EQUAL(1,(int)v1.size());
00720   CPPUNIT_ASSERT_EQUAL(2,(int)v2.size());
00721   CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection()); CPPUNIT_ASSERT(v2[1]->intresincEqCoarse(e1) && v2[1]->getDirection());
00722   CPPUNIT_ASSERT(e2->getStartNode()==v2[0]->getStartNode()); CPPUNIT_ASSERT(e1->getEndNode()==e2->getEndNode()); CPPUNIT_ASSERT(e2->getEndNode()==v2[1]->getEndNode());
00723   CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode());
00724   CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
00725   CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
00726   e2->decrRef(); e1->decrRef();
00727   v1.clear(); v2.clear(); v3.clear();
00728   //Test 12 - OUT_BEFORE - END | same dir. - 90
00729   e1=new EdgeLin(0.,0.,0.,1.); e2=new EdgeLin(0.,-0.5,0.,1.);
00730   CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
00731   CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations());
00732   CPPUNIT_ASSERT_EQUAL(1,(int)v1.size());
00733   CPPUNIT_ASSERT_EQUAL(2,(int)v2.size());
00734   CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection()); CPPUNIT_ASSERT(v2[1]->intresincEqCoarse(e1) && v2[1]->getDirection());
00735   CPPUNIT_ASSERT(e2->getStartNode()==v2[0]->getStartNode()); CPPUNIT_ASSERT(e1->getEndNode()==e2->getEndNode()); CPPUNIT_ASSERT(e2->getEndNode()==v2[1]->getEndNode());
00736   CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode());
00737   CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
00738   CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
00739   e2->decrRef(); e1->decrRef();
00740   v1.clear(); v2.clear(); v3.clear();
00741   //Test 12 - OUT_BEFORE - END | same dir. - 45
00742   e1=new EdgeLin(0.,0.,1.,1.); e2=new EdgeLin(-0.5,-0.5,1.,1.);
00743   CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
00744   CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations());
00745   CPPUNIT_ASSERT_EQUAL(1,(int)v1.size());
00746   CPPUNIT_ASSERT_EQUAL(2,(int)v2.size());
00747   CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection()); CPPUNIT_ASSERT(v2[1]->intresincEqCoarse(e1) && v2[1]->getDirection());
00748   CPPUNIT_ASSERT(e2->getStartNode()==v2[0]->getStartNode()); CPPUNIT_ASSERT(e1->getEndNode()==e2->getEndNode()); CPPUNIT_ASSERT(e2->getEndNode()==v2[1]->getEndNode());
00749   CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode());
00750   CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
00751   CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
00752   e2->decrRef(); e1->decrRef();
00753   v1.clear(); v2.clear(); v3.clear();
00754   //Test 12 - OUT_BEFORE - END | opp dir. - 45
00755   e1=new EdgeLin(0.,0.,1.,1.); e2=new EdgeLin(1.,1.,-0.5,-0.5);
00756   CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
00757   CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations());
00758   CPPUNIT_ASSERT_EQUAL(1,(int)v1.size());
00759   CPPUNIT_ASSERT_EQUAL(2,(int)v2.size());
00760   CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection()); CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e1) && !v2[0]->getDirection());
00761   CPPUNIT_ASSERT(e2->getStartNode()==v2[0]->getStartNode()); CPPUNIT_ASSERT(e1->getEndNode()==e2->getStartNode()); CPPUNIT_ASSERT(e2->getEndNode()==v2[1]->getEndNode());
00762   CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode());
00763   CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
00764   CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
00765   e2->decrRef(); e1->decrRef();
00766   v1.clear(); v2.clear(); v3.clear();
00767   //Test 13 - START - INSIDE | same dir. - 0
00768   e1=new EdgeLin(0.,0.,1.,0.); e2=new EdgeLin(0.,0.,0.5,0.);
00769   CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
00770   CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations());
00771   CPPUNIT_ASSERT_EQUAL(2,(int)v1.size());
00772   CPPUNIT_ASSERT_EQUAL(1,(int)v2.size());
00773   CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e2) && v1[0]->getDirection()); CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e2) && v2[0]->getDirection());
00774   CPPUNIT_ASSERT(e2->getStartNode()==v1[0]->getStartNode()); CPPUNIT_ASSERT(e1->getStartNode()==e2->getStartNode()); CPPUNIT_ASSERT(e1->getEndNode()==v1[1]->getEndNode());
00775   CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode());
00776   CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
00777   CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
00778   e2->decrRef(); e1->decrRef();
00779   v1.clear(); v2.clear(); v3.clear();
00780   //Test 13 - START - INSIDE | same dir. - 90
00781   e1=new EdgeLin(0.,0.,0.,1.); e2=new EdgeLin(0.,0.,0.,0.5);
00782   CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
00783   CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations());
00784   CPPUNIT_ASSERT_EQUAL(2,(int)v1.size());
00785   CPPUNIT_ASSERT_EQUAL(1,(int)v2.size());
00786   CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e2) && v1[0]->getDirection()); CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e2) && v2[0]->getDirection());
00787   CPPUNIT_ASSERT(e2->getStartNode()==v1[0]->getStartNode()); CPPUNIT_ASSERT(e1->getStartNode()==e2->getStartNode()); CPPUNIT_ASSERT(e1->getEndNode()==v1[1]->getEndNode());
00788   CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode());
00789   CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
00790   CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
00791   e2->decrRef(); e1->decrRef();
00792   v1.clear(); v2.clear(); v3.clear();
00793   //Test 13 - START - INSIDE | same dir. - 45
00794   e1=new EdgeLin(0.,0.,1.,1.); e2=new EdgeLin(0.,0.,0.5,0.5);
00795   CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
00796   CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations());
00797   CPPUNIT_ASSERT_EQUAL(2,(int)v1.size());
00798   CPPUNIT_ASSERT_EQUAL(1,(int)v2.size());
00799   CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e2) && v1[0]->getDirection()); CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e2) && v2[0]->getDirection());
00800   CPPUNIT_ASSERT(e2->getStartNode()==v1[0]->getStartNode()); CPPUNIT_ASSERT(e1->getStartNode()==e2->getStartNode()); CPPUNIT_ASSERT(e1->getEndNode()==v1[1]->getEndNode());
00801   CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode());
00802   CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
00803   CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
00804   e2->decrRef(); e1->decrRef();
00805   v1.clear(); v2.clear(); v3.clear();
00806   //Test 13 - START - INSIDE | opp dir. - 45
00807   e1=new EdgeLin(0.,0.,1.,1.); e2=new EdgeLin(0.5,0.5,0.,0.);
00808   CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
00809   CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations());
00810   CPPUNIT_ASSERT_EQUAL(2,(int)v1.size());
00811   CPPUNIT_ASSERT_EQUAL(1,(int)v2.size());
00812   CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e2) && !v1[0]->getDirection()); CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e2) && v2[0]->getDirection());
00813   CPPUNIT_ASSERT(e2->getEndNode()==v1[0]->getStartNode()); CPPUNIT_ASSERT(e1->getStartNode()==e2->getEndNode()); CPPUNIT_ASSERT(e1->getEndNode()==v1[1]->getEndNode());
00814   CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode());
00815   CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
00816   CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
00817   e2->decrRef(); e1->decrRef();
00818   v1.clear(); v2.clear(); v3.clear();
00819   //Test 14 - INSIDE - START | same dir.
00820   e1=buildArcOfCircle(center,radius,-M_PI,2.*M_PI); e2=buildArcOfCircle(center,radius,M_PI/3.,-M_PI);
00821   CPPUNIT_ASSERT_DOUBLES_EQUAL(M_PI,e1->getCurveLength(),1e-12); CPPUNIT_ASSERT_DOUBLES_EQUAL(4.*M_PI/3.,e2->getCurveLength(),1e-12);
00822   CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
00823   CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations());
00824   CPPUNIT_ASSERT_EQUAL(2,(int)v1.size());
00825   CPPUNIT_ASSERT_EQUAL(2,(int)v2.size());
00826   CPPUNIT_ASSERT(v1[1]->intresicEqual(v2[0]));
00827   CPPUNIT_ASSERT(v2[1]->getEndNode()==e1->getStartNode());
00828   CPPUNIT_ASSERT(v1[0]->getStartNode()==e1->getStartNode());
00829   CPPUNIT_ASSERT(v1[1]->getEndNode()==e1->getEndNode());
00830   CPPUNIT_ASSERT(v2[1]->getStartNode()==e1->getEndNode());
00831   CPPUNIT_ASSERT_DOUBLES_EQUAL(2*M_PI/3.,v1[0]->getCurveLength(),1.e-12);
00832   CPPUNIT_ASSERT_DOUBLES_EQUAL(M_PI/3.,v2[0]->getCurveLength(),1.e-12);
00833   CPPUNIT_ASSERT_DOUBLES_EQUAL(M_PI,v2[1]->getCurveLength(),1.e-12);
00834   e2->decrRef(); e1->decrRef();
00835   v1.clear(); v2.clear(); v3.clear();
00836   //Test 14 - INSIDE - START | opp dir.
00837   e1=buildArcOfCircle(center,radius,-M_PI,2.*M_PI); e2=buildArcOfCircle(center,radius,-M_PI,M_PI/3.);
00838   CPPUNIT_ASSERT_DOUBLES_EQUAL(M_PI,e1->getCurveLength(),1e-12); CPPUNIT_ASSERT_DOUBLES_EQUAL(4.*M_PI/3.,e2->getCurveLength(),1e-12);
00839   CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
00840   CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations());
00841   CPPUNIT_ASSERT_EQUAL(2,(int)v1.size());
00842   CPPUNIT_ASSERT_EQUAL(2,(int)v2.size());
00843   CPPUNIT_ASSERT(v1[1]->intresincEqCoarse(v2[1]->getPtr()) && !v2[1]->getDirection() && v1[1]->getDirection());
00844   CPPUNIT_ASSERT(v2[0]->getStartNode()==e1->getStartNode());
00845   CPPUNIT_ASSERT(v1[0]->getStartNode()==e1->getStartNode());
00846   CPPUNIT_ASSERT(v1[1]->getEndNode()==e1->getEndNode());
00847   CPPUNIT_ASSERT(v2[1]->getStartNode()==e1->getEndNode());
00848   CPPUNIT_ASSERT(v2[0]->getEndNode()==e1->getEndNode());
00849   CPPUNIT_ASSERT_DOUBLES_EQUAL(2*M_PI/3.,v1[0]->getCurveLength(),1.e-12);
00850   CPPUNIT_ASSERT_DOUBLES_EQUAL(M_PI/3.,v2[1]->getCurveLength(),1.e-12);
00851   CPPUNIT_ASSERT_DOUBLES_EQUAL(M_PI,v2[0]->getCurveLength(),1.e-12);
00852   e2->decrRef(); e1->decrRef();
00853   v1.clear(); v2.clear(); v3.clear();
00854   //Test 15 - END - INSIDE | same dir.
00855   e1=buildArcOfCircle(center,radius,-M_PI,2.*M_PI); e2=buildArcOfCircle(center,radius,0.,-4.*M_PI/3);
00856   CPPUNIT_ASSERT_DOUBLES_EQUAL(M_PI,e1->getCurveLength(),1e-12); CPPUNIT_ASSERT_DOUBLES_EQUAL(4.*M_PI/3.,e2->getCurveLength(),1e-12);
00857   CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
00858   CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations());
00859   CPPUNIT_ASSERT_EQUAL(2,(int)v1.size());
00860   CPPUNIT_ASSERT_EQUAL(2,(int)v2.size());
00861   CPPUNIT_ASSERT(v1[0]->intresicEqual(v2[1]));
00862   CPPUNIT_ASSERT(v2[0]->getEndNode()==e1->getStartNode());
00863   CPPUNIT_ASSERT(v1[0]->getStartNode()==e1->getStartNode());
00864   CPPUNIT_ASSERT(v1[1]->getEndNode()==e1->getEndNode());
00865   CPPUNIT_ASSERT(v2[0]->getStartNode()==e1->getEndNode());
00866   CPPUNIT_ASSERT_DOUBLES_EQUAL(M_PI/3.,v1[0]->getCurveLength(),1.e-12);
00867   CPPUNIT_ASSERT_DOUBLES_EQUAL(M_PI,v2[0]->getCurveLength(),1.e-12);
00868   CPPUNIT_ASSERT_DOUBLES_EQUAL(2.*M_PI/3.,v1[1]->getCurveLength(),1.e-12);
00869   e2->decrRef(); e1->decrRef();
00870   v1.clear(); v2.clear(); v3.clear();
00871   //Test 15 - END - INSIDE | opp dir.
00872   e1=buildArcOfCircle(center,radius,-M_PI,2.*M_PI); e2=buildArcOfCircle(center,radius,-4.*M_PI/3,0.);
00873   CPPUNIT_ASSERT_DOUBLES_EQUAL(M_PI,e1->getCurveLength(),1e-12); CPPUNIT_ASSERT_DOUBLES_EQUAL(4.*M_PI/3.,e2->getCurveLength(),1e-12);
00874   CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
00875   CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations());
00876   CPPUNIT_ASSERT_EQUAL(2,(int)v1.size());
00877   CPPUNIT_ASSERT_EQUAL(2,(int)v2.size());
00878   CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(v2[0]->getPtr()) && !v2[0]->getDirection() && v1[0]->getDirection());
00879   CPPUNIT_ASSERT(v2[0]->getEndNode()==e1->getStartNode());
00880   CPPUNIT_ASSERT(v1[0]->getStartNode()==e1->getStartNode());
00881   CPPUNIT_ASSERT(v1[1]->getEndNode()==e1->getEndNode());
00882   CPPUNIT_ASSERT(v2[1]->getEndNode()==e1->getEndNode());
00883   CPPUNIT_ASSERT_DOUBLES_EQUAL(M_PI/3.,v1[0]->getCurveLength(),1.e-12);
00884   CPPUNIT_ASSERT_DOUBLES_EQUAL(M_PI,v2[1]->getCurveLength(),1.e-12);
00885   CPPUNIT_ASSERT_DOUBLES_EQUAL(2.*M_PI/3.,v1[1]->getCurveLength(),1.e-12);
00886   e2->decrRef(); e1->decrRef();
00887   v1.clear(); v2.clear(); v3.clear();
00888   //
00889   ComposedEdge::Delete(&v1);
00890   ComposedEdge::Delete(&v2);
00891 }
00892 
00896 void QuadraticPlanarInterpTest::IntersectionPointOnlyUnitarySegSeg()
00897 {
00898   // 0 - classical
00899   EdgeLin *e1=new EdgeLin(0.,0.,1.,0.);
00900   EdgeLin *e2=new EdgeLin(0.3,0.3,0.5,-0.3);
00901   ComposedEdge& v1=*(new ComposedEdge);
00902   ComposedEdge& v2=*(new ComposedEdge); MergePoints v3;
00903   CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
00904   CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
00905   CPPUNIT_ASSERT_EQUAL(2,(int)v1.size());
00906   CPPUNIT_ASSERT_EQUAL(2,(int)v2.size());
00907   CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode()); CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode());
00908   CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
00909   CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
00910   CPPUNIT_ASSERT_DOUBLES_EQUAL(0.4,(*v1[0]->getEndNode())[0],ADMISSIBLE_ERROR);
00911   CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,(*v1[0]->getEndNode())[1],ADMISSIBLE_ERROR);
00912   e2->decrRef(); e1->decrRef();
00913   v1.clear(); v2.clear(); v3.clear();
00914   // 90 - classical
00915   e1=new EdgeLin(0.,0.,0.,1.);
00916   e2=new EdgeLin(-0.3,0.3,0.3,0.5);
00917   CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
00918   CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
00919   CPPUNIT_ASSERT_EQUAL(2,(int)v1.size());
00920   CPPUNIT_ASSERT_EQUAL(2,(int)v2.size());
00921   CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode()); CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode());
00922   CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
00923   CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
00924   CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,(*v1[0]->getEndNode())[0],ADMISSIBLE_ERROR);
00925   CPPUNIT_ASSERT_DOUBLES_EQUAL(0.4,(*v1[0]->getEndNode())[1],ADMISSIBLE_ERROR);
00926   e2->decrRef(); e1->decrRef();
00927   v1.clear(); v2.clear(); v3.clear();
00928   //Test 1 - 0
00929   e1=new EdgeLin(0.,0.,1.,0.); e2=new EdgeLin(0.,0.,0.,1.);
00930   CPPUNIT_ASSERT(!e1->intersectWith(e2,v3,v1,v2));
00931   CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations());
00932   CPPUNIT_ASSERT(v3.isStart1(0)); CPPUNIT_ASSERT(v3.isStart2(0));
00933   e2->decrRef(); e1->decrRef();
00934   v1.clear(); v2.clear(); v3.clear();
00935   //Test 1 - 90
00936   e1=new EdgeLin(0.,0.,0.,1.); e2=new EdgeLin(0.,0.,1.,0.);
00937   CPPUNIT_ASSERT(!e1->intersectWith(e2,v3,v1,v2));
00938   CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations());
00939   CPPUNIT_ASSERT(v3.isStart1(0)); CPPUNIT_ASSERT(v3.isStart2(0));
00940   e2->decrRef(); e1->decrRef();
00941   v1.clear(); v2.clear(); v3.clear();
00942   //Test 1 - 45
00943   e1=new EdgeLin(0.,0.,1.,1.); e2=new EdgeLin(0.,0.,1.,-1.);
00944   CPPUNIT_ASSERT(!e1->intersectWith(e2,v3,v1,v2));
00945   CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations());
00946   CPPUNIT_ASSERT(v3.isStart1(0)); CPPUNIT_ASSERT(v3.isStart2(0));
00947   e2->decrRef(); e1->decrRef();
00948   v1.clear(); v2.clear(); v3.clear();
00949   //Test 2
00950   e1=new EdgeLin(0.,0.,1.,0.); e2=new EdgeLin(1.,1.,1.,0.);
00951   CPPUNIT_ASSERT(!e1->intersectWith(e2,v3,v1,v2));
00952   CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations());
00953   CPPUNIT_ASSERT(v3.isEnd1(0)); CPPUNIT_ASSERT(v3.isEnd2(0));
00954   e2->decrRef(); e1->decrRef();
00955   v1.clear(); v2.clear(); v3.clear();
00956   //Test 3
00957   e1=new EdgeLin(0.,0.,1.,0.); e2=new EdgeLin(1.,0.,1.,1.);
00958   CPPUNIT_ASSERT(!e1->intersectWith(e2,v3,v1,v2));
00959   CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations());
00960   CPPUNIT_ASSERT(v3.isEnd1(0)); CPPUNIT_ASSERT(v3.isStart2(0));
00961   e2->decrRef(); e1->decrRef();
00962   v1.clear(); v2.clear(); v3.clear();
00963   //Test 4
00964   e1=new EdgeLin(0.,0.,1.,1.); e2=new EdgeLin(1.,-1.,0.,0.);
00965   CPPUNIT_ASSERT(!e1->intersectWith(e2,v3,v1,v2));
00966   CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations());
00967   CPPUNIT_ASSERT(v3.isStart1(0)); CPPUNIT_ASSERT(v3.isEnd2(0));
00968   e2->decrRef(); e1->decrRef();
00969   v1.clear(); v2.clear(); v3.clear();
00970   //Intersection extremity of one edge and inside of other edge. 2 End.
00971   e1=new EdgeLin(0.,0.,1.,0.);
00972   e2=new EdgeLin(0.5,1.,0.5,0.);
00973   CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
00974   CPPUNIT_ASSERT_EQUAL(2,(int)v1.size());
00975   CPPUNIT_ASSERT_EQUAL(1,(int)v2.size());
00976   CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
00977   CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e2) && v2[0]->getDirection());
00978   CPPUNIT_ASSERT(v1[0]->getStartNode()==e1->getStartNode() && v1[0]->getEndNode()==e2->getEndNode() && v1[1]->getStartNode()==e2->getEndNode() && v1[1]->getEndNode()==e1->getEndNode());
00979   CPPUNIT_ASSERT(v1[0]->getDirection() && v1[1]->getDirection());
00980   e2->decrRef(); e1->decrRef();
00981   v1.clear(); v2.clear(); v3.clear();
00982   //Intersection extremity of one edge and inside of other edge. 2 Start.
00983   e1=new EdgeLin(0.,0.,1.,0.);
00984   e2=new EdgeLin(0.5,0.,0.5,1.);
00985   CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
00986   CPPUNIT_ASSERT_EQUAL(2,(int)v1.size());
00987   CPPUNIT_ASSERT_EQUAL(1,(int)v2.size());
00988   CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
00989   CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e2) && v2[0]->getDirection());
00990   CPPUNIT_ASSERT(v1[0]->getStartNode()==e1->getStartNode() && v1[0]->getEndNode()==e2->getStartNode() && v1[1]->getStartNode()==e2->getStartNode() && v1[1]->getEndNode()==e1->getEndNode());
00991   CPPUNIT_ASSERT(v1[0]->getDirection() && v1[1]->getDirection());
00992   e2->decrRef(); e1->decrRef();
00993   v1.clear(); v2.clear(); v3.clear();
00994   //Intersection extremity of one edge and inside of other edge. 1 Start.
00995   e1=new EdgeLin(0.5,0.,0.5,1.);
00996   e2=new EdgeLin(0.,0.,1.,0.);
00997   CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
00998   CPPUNIT_ASSERT_EQUAL(1,(int)v1.size());
00999   CPPUNIT_ASSERT_EQUAL(2,(int)v2.size());
01000   CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
01001   CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection());
01002   CPPUNIT_ASSERT(v2[0]->getStartNode()==e2->getStartNode() && v2[0]->getEndNode()==e1->getStartNode() && v2[1]->getStartNode()==e1->getStartNode() && v2[1]->getEndNode()==e2->getEndNode());
01003   CPPUNIT_ASSERT(v2[0]->getDirection() && v2[1]->getDirection());
01004   e2->decrRef(); e1->decrRef();
01005   v1.clear(); v2.clear(); v3.clear();
01006   //Intersection extremity of one edge and inside of other edge. 1 End.
01007   e1=new EdgeLin(0.5,1.,0.5,0.);
01008   e2=new EdgeLin(0.,0.,1.,0.);
01009   CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
01010   CPPUNIT_ASSERT_EQUAL(1,(int)v1.size());
01011   CPPUNIT_ASSERT_EQUAL(2,(int)v2.size());
01012   CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
01013   CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection());
01014   CPPUNIT_ASSERT(v2[0]->getStartNode()==e2->getStartNode() && v2[0]->getEndNode()==e1->getEndNode() && v2[1]->getStartNode()==e1->getEndNode() && v2[1]->getEndNode()==e2->getEndNode());
01015   CPPUNIT_ASSERT(v2[0]->getDirection() && v2[1]->getDirection());
01016   e2->decrRef(); e1->decrRef();
01017   v1.clear(); v2.clear(); v3.clear();
01018   ComposedEdge::Delete(&v2);
01019   ComposedEdge::Delete(&v1);
01020 }
01021 
01022 }