X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FINTERP_KERNELTest%2FQuadraticPlanarInterpTest.cxx;h=d52551a8346aa348eca08b1e4726c6ef4040dd5a;hb=8411b13fec372c7635bf04d2bb81a869dc038fdd;hp=f556f3a4c26506f158ff9767d1afd23a55d9f3c3;hpb=48782c06022ca2caa36f849cb5a29ea4fe2aaa83;p=tools%2Fmedcoupling.git diff --git a/src/INTERP_KERNELTest/QuadraticPlanarInterpTest.cxx b/src/INTERP_KERNELTest/QuadraticPlanarInterpTest.cxx index f556f3a4c..d52551a83 100644 --- a/src/INTERP_KERNELTest/QuadraticPlanarInterpTest.cxx +++ b/src/INTERP_KERNELTest/QuadraticPlanarInterpTest.cxx @@ -1,34 +1,39 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D +// Copyright (C) 2007-2020 CEA/DEN, EDF R&D // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// Author : Anthony Geay (CEA/DEN) + #include "QuadraticPlanarInterpTest.hxx" -#include "QuadraticPolygon.hxx" -#include "EdgeArcCircle.hxx" -#include "ElementaryEdge.hxx" -#include "ComposedEdge.hxx" -#include "EdgeLin.hxx" +#include "InterpKernelGeo2DQuadraticPolygon.hxx" +#include "InterpKernelGeo2DEdgeArcCircle.hxx" +#include "InterpKernelGeo2DElementaryEdge.hxx" +#include "InterpKernelGeo2DComposedEdge.hxx" +#include "InterpKernelGeo2DEdgeLin.hxx" +#include "TestInterpKernelUtils.hxx" #include #include -using namespace std; using namespace INTERP_KERNEL; +namespace INTERP_TEST +{ + static const double ADMISSIBLE_ERROR = 1.e-14; void QuadraticPlanarInterpTest::setUp() @@ -46,7 +51,7 @@ void QuadraticPlanarInterpTest::cleanUp() void QuadraticPlanarInterpTest::ReadWriteInXfigElementary() { //Testing bounds calculation. For Seg2 - istringstream stream("2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2\n3200 3400 4500 4700"); + std::istringstream stream("2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2\n3200 3400 4500 4700"); EdgeLin *e1=new EdgeLin(stream); Bounds bound=e1->getBounds(); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.32,bound[0],ADMISSIBLE_ERROR); @@ -54,7 +59,7 @@ void QuadraticPlanarInterpTest::ReadWriteInXfigElementary() CPPUNIT_ASSERT_DOUBLES_EQUAL(0.34,bound[2],ADMISSIBLE_ERROR); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.47,bound[3],ADMISSIBLE_ERROR); e1->decrRef(); - istringstream stream2("2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2\n4500 4700 3200 3400"); + std::istringstream stream2("2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2\n4500 4700 3200 3400"); e1=new EdgeLin(stream2); bound=e1->getBounds(); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.32,bound[0],ADMISSIBLE_ERROR); @@ -68,20 +73,13 @@ void QuadraticPlanarInterpTest::ReadWriteInXfigElementary() void QuadraticPlanarInterpTest::ReadWriteInXfigGlobal() { - string dataBaseDir(getenv("MED_ROOT_DIR")); - dataBaseDir+="/share/salome/resources/med/"; - string tmp; - tmp=dataBaseDir; tmp+="Pol1.fig"; - QuadraticPolygon pol1(tmp.c_str()); + QuadraticPolygon pol1(INTERP_TEST::getResourceFile("Pol1.fig").c_str()); pol1.dumpInXfigFile("Pol1_gen.fig"); - tmp=dataBaseDir; tmp+="Pol2.fig"; - QuadraticPolygon pol2(tmp.c_str()); + QuadraticPolygon pol2(INTERP_TEST::getResourceFile("Pol2.fig").c_str()); pol2.dumpInXfigFile("Pol2_gen.fig"); - tmp=dataBaseDir; tmp+="Pol3.fig"; - QuadraticPolygon pol3(tmp.c_str()); + QuadraticPolygon pol3(INTERP_TEST::getResourceFile("Pol3.fig").c_str()); pol3.dumpInXfigFile("Pol3_gen.fig"); - tmp=dataBaseDir; tmp+="Pol4.fig"; - QuadraticPolygon pol4(tmp.c_str()); + QuadraticPolygon pol4(INTERP_TEST::getResourceFile("Pol4.fig").c_str()); CPPUNIT_ASSERT_EQUAL(1,pol4.size()); ElementaryEdge *edge1=dynamic_cast(pol4[0]); CPPUNIT_ASSERT(edge1); @@ -157,9 +155,9 @@ void QuadraticPlanarInterpTest::BasicGeometricTools() void QuadraticPlanarInterpTest::IntersectionBasics() { //Testing intersection of Bounds. - istringstream stream1("2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2\n3200 3400 4500 4800"); + std::istringstream stream1("2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2\n3200 3400 4500 4800"); EdgeLin *e1=new EdgeLin(stream1); - istringstream stream2("2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2\n3200 3400 4500 4800"); + std::istringstream stream2("2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2\n3200 3400 4500 4800"); EdgeLin *e2=new EdgeLin(stream2); Bounds *bound=e1->getBounds().amIIntersectingWith(e2->getBounds()); CPPUNIT_ASSERT(bound); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.32,(*bound)[0],ADMISSIBLE_ERROR); @@ -169,9 +167,9 @@ void QuadraticPlanarInterpTest::IntersectionBasics() delete bound; e2->decrRef(); e1->decrRef(); // - istringstream stream3("2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2\n3000 7200 6000 3700"); + std::istringstream stream3("2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2\n3000 7200 6000 3700"); EdgeLin *e3=new EdgeLin(stream3); - istringstream stream4("2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2\n4800 6600 7200 4200"); + std::istringstream stream4("2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2\n4800 6600 7200 4200"); EdgeLin *e4=new EdgeLin(stream4); bound=e3->getBounds().amIIntersectingWith(e4->getBounds()); CPPUNIT_ASSERT(bound); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.48,(*bound)[0],ADMISSIBLE_ERROR); @@ -212,6 +210,7 @@ void QuadraticPlanarInterpTest::IntersectionEdgeOverlapUnitarySegSeg() { ComposedEdge& v1=*(new ComposedEdge); ComposedEdge& v2=*(new ComposedEdge); + QuadraticPlanarPrecision::setPrecision(5.0e-14); // [ABN] man, those tests are really close to epsilon! I need to relax this a bit. MergePoints v3; //Testing merge of geometric equals seg2. Edge *e1=new EdgeLin(0.5,0.5,1.,1.); Edge *e2=new EdgeLin(0.5,0.5,1.,1.); @@ -237,7 +236,7 @@ void QuadraticPlanarInterpTest::IntersectionEdgeOverlapUnitarySegSeg() e2->decrRef(); e1->decrRef(); v1.clear(); v2.clear(); v3.clear(); //Test 0 - //Test 1 - OUT_AFTER - OUT_AFTER | same dir. - 0° + //Test 1 - OUT_AFTER - OUT_AFTER | same dir. - 0deg e1=new EdgeLin(0.,0.,1.,0.); e2=new EdgeLin(1.5,0.,2.,0.); CPPUNIT_ASSERT(!e1->intersectWith(e2,v3,v1,v2)); CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations()); @@ -245,7 +244,7 @@ void QuadraticPlanarInterpTest::IntersectionEdgeOverlapUnitarySegSeg() CPPUNIT_ASSERT_EQUAL(0,(int)v2.size()); e2->decrRef(); e1->decrRef(); v1.clear(); v2.clear(); v3.clear(); - //Test 2 - INSIDE - OUT_AFTER | same dir. - 0° + //Test 2 - INSIDE - OUT_AFTER | same dir. - 0deg e1=new EdgeLin(0.,0.,1.,0.); e2=new EdgeLin(0.5,0.,1.5,0.); CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2)); CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations()); @@ -258,7 +257,7 @@ void QuadraticPlanarInterpTest::IntersectionEdgeOverlapUnitarySegSeg() CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode()); e2->decrRef(); e1->decrRef(); v1.clear(); v2.clear(); v3.clear(); - //Test 2 - INSIDE - OUT_AFTER | same dir. - 90° + //Test 2 - INSIDE - OUT_AFTER | same dir. - 90deg e1=new EdgeLin(0.,0.,0.,1.); e2=new EdgeLin(0.,0.5,0.,1.5); CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2)); CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations()); @@ -271,7 +270,7 @@ void QuadraticPlanarInterpTest::IntersectionEdgeOverlapUnitarySegSeg() CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode()); e2->decrRef(); e1->decrRef(); v1.clear(); v2.clear(); v3.clear(); - //Test 2 - INSIDE - OUT_AFTER | same dir. - 45° + //Test 2 - INSIDE - OUT_AFTER | same dir. - 45deg e1=new EdgeLin(0.,0.,1.,1.); e2=new EdgeLin(0.5,0.5,1.5,1.5); CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2)); CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations()); @@ -282,7 +281,7 @@ void QuadraticPlanarInterpTest::IntersectionEdgeOverlapUnitarySegSeg() CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode()); CPPUNIT_ASSERT(e2->getStartNode()==v2[0]->getStartNode()); CPPUNIT_ASSERT(e2->getEndNode()==v2[1]->getEndNode()); e2->decrRef(); e1->decrRef(); v1.clear(); v2.clear(); v3.clear(); - //Test 2 - INSIDE - OUT_AFTER | opp. dir. - 45° + //Test 2 - INSIDE - OUT_AFTER | opp. dir. - 45deg e1=new EdgeLin(0.,0.,1.,1.); e2=new EdgeLin(1.5,1.5,0.5,0.5); CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2)); CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations()); @@ -295,7 +294,7 @@ void QuadraticPlanarInterpTest::IntersectionEdgeOverlapUnitarySegSeg() CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode()); e2->decrRef(); e1->decrRef(); v1.clear(); v2.clear(); v3.clear(); - //Test 3 - INSIDE - INSIDE | same dir. - 0° + //Test 3 - INSIDE - INSIDE | same dir. - 0deg e1=new EdgeLin(0.,0.,1.,0.); e2=new EdgeLin(0.25,0.,0.75,0.); CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2)); CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations()); @@ -309,7 +308,7 @@ void QuadraticPlanarInterpTest::IntersectionEdgeOverlapUnitarySegSeg() CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode()); e2->decrRef(); e1->decrRef(); v1.clear(); v2.clear(); v3.clear(); - //Test 3 - INSIDE - INSIDE | same dir. - 90° + //Test 3 - INSIDE - INSIDE | same dir. - 90deg e1=new EdgeLin(0.,0.,0.,1.); e2=new EdgeLin(0.,0.25,0.,0.75); CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2)); CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations()); @@ -323,7 +322,7 @@ void QuadraticPlanarInterpTest::IntersectionEdgeOverlapUnitarySegSeg() CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode()); e2->decrRef(); e1->decrRef(); v1.clear(); v2.clear(); v3.clear(); - //Test 3 - INSIDE - INSIDE | same dir. - 45° + //Test 3 - INSIDE - INSIDE | same dir. - 45deg e1=new EdgeLin(0.,0.,1.,1.); e2=new EdgeLin(0.25,0.25,0.75,0.75); CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2)); CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations()); @@ -337,7 +336,7 @@ void QuadraticPlanarInterpTest::IntersectionEdgeOverlapUnitarySegSeg() CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode()); e2->decrRef(); e1->decrRef(); v1.clear(); v2.clear(); v3.clear(); - //Test 3 - INSIDE - INSIDE | opp dir. - 45° + //Test 3 - INSIDE - INSIDE | opp dir. - 45deg e1=new EdgeLin(0.,0.,1.,1.); e2=new EdgeLin(0.75,0.75,0.25,0.25); CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2)); CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations()); @@ -429,7 +428,7 @@ void QuadraticPlanarInterpTest::IntersectionEdgeOverlapUnitarySegSeg() CPPUNIT_ASSERT(v1[1]->getEndNode()==e2->getStartNode()); e2->decrRef(); e1->decrRef(); v1.clear(); v2.clear(); v3.clear(); - //Test 4 - OUT_BEFORE - OUT_BEFORE | same dir. - 0 ° + //Test 4 - OUT_BEFORE - OUT_BEFORE | same dir. - 0 deg e1=new EdgeLin(0.,0.,1.,0.); e2=new EdgeLin(-1.,0.,-0.5,0.); CPPUNIT_ASSERT(!e1->intersectWith(e2,v3,v1,v2)); CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations()); @@ -437,7 +436,7 @@ void QuadraticPlanarInterpTest::IntersectionEdgeOverlapUnitarySegSeg() CPPUNIT_ASSERT_EQUAL(0,(int)v2.size()); e2->decrRef(); e1->decrRef(); v1.clear(); v2.clear(); v3.clear(); - //Test 5 - OUT_BEFORE - INSIDE | same dir. - 0° + //Test 5 - OUT_BEFORE - INSIDE | same dir. - 0deg e1=new EdgeLin(0.,0.,1.,0.); e2=new EdgeLin(-0.5,0.,0.5,0.); CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2)); CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations()); @@ -449,7 +448,7 @@ void QuadraticPlanarInterpTest::IntersectionEdgeOverlapUnitarySegSeg() CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode()); e2->decrRef(); e1->decrRef(); v1.clear(); v2.clear(); v3.clear(); - //Test 5 - OUT_BEFORE - INSIDE | same dir. - 90° + //Test 5 - OUT_BEFORE - INSIDE | same dir. - 90deg e1=new EdgeLin(0.,0.,0.,1.); e2=new EdgeLin(0,-0.5,0.,0.5); CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2)); CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations()); @@ -461,7 +460,7 @@ void QuadraticPlanarInterpTest::IntersectionEdgeOverlapUnitarySegSeg() CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode()); e2->decrRef(); e1->decrRef(); v1.clear(); v2.clear(); v3.clear(); - //Test 5 - OUT_BEFORE - INSIDE | same dir. - 45° + //Test 5 - OUT_BEFORE - INSIDE | same dir. - 45deg e1=new EdgeLin(0.,0.,1.,1.); e2=new EdgeLin(-0.5,-0.5,0.5,0.5); CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2)); CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations()); @@ -473,7 +472,7 @@ void QuadraticPlanarInterpTest::IntersectionEdgeOverlapUnitarySegSeg() CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode()); e2->decrRef(); e1->decrRef(); v1.clear(); v2.clear(); v3.clear(); - //Test 5 - OUT_BEFORE - INSIDE | opp dir. - 45° + //Test 5 - OUT_BEFORE - INSIDE | opp dir. - 45deg e1=new EdgeLin(0.,0.,1.,1.); e2=new EdgeLin(0.5,0.5,-0.5,-0.5); CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2)); CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations()); @@ -485,7 +484,7 @@ void QuadraticPlanarInterpTest::IntersectionEdgeOverlapUnitarySegSeg() CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode()); e2->decrRef(); e1->decrRef(); v1.clear(); v2.clear(); v3.clear(); - //Test 6 - OUT_BEFORE - OUT_AFTER | same dir. - 0° + //Test 6 - OUT_BEFORE - OUT_AFTER | same dir. - 0deg e1=new EdgeLin(0.,0.,1.,0.); e2=new EdgeLin(-0.5,0.,1.5,0.); CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2)); CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations()); @@ -498,7 +497,7 @@ void QuadraticPlanarInterpTest::IntersectionEdgeOverlapUnitarySegSeg() CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode()); e2->decrRef(); e1->decrRef(); v1.clear(); v2.clear(); v3.clear(); - //Test 6 - OUT_BEFORE - OUT_AFTER | same dir. - 90° + //Test 6 - OUT_BEFORE - OUT_AFTER | same dir. - 90deg e1=new EdgeLin(0.,0.,0.,1.); e2=new EdgeLin(0.,-0.5,0.,1.5); CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2)); CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations()); @@ -511,7 +510,7 @@ void QuadraticPlanarInterpTest::IntersectionEdgeOverlapUnitarySegSeg() CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode()); e2->decrRef(); e1->decrRef(); v1.clear(); v2.clear(); v3.clear(); - //Test 6 - OUT_BEFORE - OUT_AFTER | same dir. - 45° + //Test 6 - OUT_BEFORE - OUT_AFTER | same dir. - 45deg e1=new EdgeLin(0.,0.,1.,1.); e2=new EdgeLin(-0.5,-0.5,1.5,1.5); CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2)); CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations()); @@ -524,7 +523,7 @@ void QuadraticPlanarInterpTest::IntersectionEdgeOverlapUnitarySegSeg() CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode()); e2->decrRef(); e1->decrRef(); v1.clear(); v2.clear(); v3.clear(); - //Test 6 - OUT_BEFORE - OUT_AFTER | opp dir. - 45° + //Test 6 - OUT_BEFORE - OUT_AFTER | opp dir. - 45deg e1=new EdgeLin(0.,0.,1.,1.); e2=new EdgeLin(1.5,1.5,-0.5,-0.5); CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2)); CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations()); @@ -537,7 +536,7 @@ void QuadraticPlanarInterpTest::IntersectionEdgeOverlapUnitarySegSeg() CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode()); e2->decrRef(); e1->decrRef(); v1.clear(); v2.clear(); v3.clear(); - //Test 7 - END - OUT_AFTER | same dir. - 0° + //Test 7 - END - OUT_AFTER | same dir. - 0deg e1=new EdgeLin(0.,0.,1.,0.); e2=new EdgeLin(1.,0.,1.5,0.); CPPUNIT_ASSERT(!e1->intersectWith(e2,v3,v1,v2)); CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations()); @@ -545,7 +544,7 @@ void QuadraticPlanarInterpTest::IntersectionEdgeOverlapUnitarySegSeg() CPPUNIT_ASSERT_EQUAL(0,(int)v2.size()); e2->decrRef(); e1->decrRef(); v1.clear(); v2.clear(); v3.clear(); - //Test 7 - END - OUT_AFTER | opp dir. - 0° + //Test 7 - END - OUT_AFTER | opp dir. - 0deg e1=new EdgeLin(0.,0.,1.,0.); e2=new EdgeLin(1.5,0.,1.,0.); CPPUNIT_ASSERT(!e1->intersectWith(e2,v3,v1,v2)); CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations()); @@ -554,7 +553,7 @@ void QuadraticPlanarInterpTest::IntersectionEdgeOverlapUnitarySegSeg() CPPUNIT_ASSERT(e1->getEndNode()==e2->getEndNode()); e2->decrRef(); e1->decrRef(); v1.clear(); v2.clear(); v3.clear(); - //Test 8 - START - END | same dir. - 0° + //Test 8 - START - END | same dir. - 0deg e1=new EdgeLin(0.,0.,0.7,0.); e2=new EdgeLin(0.,0.,0.7,0.); CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2)); CPPUNIT_ASSERT_EQUAL(2,(int)v3.getNumberOfAssociations()); @@ -566,7 +565,7 @@ void QuadraticPlanarInterpTest::IntersectionEdgeOverlapUnitarySegSeg() CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode()); e2->decrRef(); e1->decrRef(); v1.clear(); v2.clear(); v3.clear(); - //Test 8 - START - END | same dir. - 90° + //Test 8 - START - END | same dir. - 90deg e1=new EdgeLin(0.,0.,0.,0.7); e2=new EdgeLin(0.,0.,0.,0.7); CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2)); CPPUNIT_ASSERT_EQUAL(2,(int)v3.getNumberOfAssociations()); @@ -578,7 +577,7 @@ void QuadraticPlanarInterpTest::IntersectionEdgeOverlapUnitarySegSeg() CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode()); e2->decrRef(); e1->decrRef(); v1.clear(); v2.clear(); v3.clear(); - //Test 8 - START - END | same dir. - 45° + //Test 8 - START - END | same dir. - 45deg e1=new EdgeLin(0.,0.,0.7,0.7); e2=new EdgeLin(0.,0.,0.7,0.7); CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2)); CPPUNIT_ASSERT_EQUAL(2,(int)v3.getNumberOfAssociations()); @@ -590,7 +589,7 @@ void QuadraticPlanarInterpTest::IntersectionEdgeOverlapUnitarySegSeg() CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode()); e2->decrRef(); e1->decrRef(); v1.clear(); v2.clear(); v3.clear(); - //Test 8 - START - END | opp. dir. - 45° + //Test 8 - START - END | opp. dir. - 45deg e1=new EdgeLin(0.,0.,0.7,0.7); e2=new EdgeLin(0.7,0.7,0.,0.); CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2)); CPPUNIT_ASSERT_EQUAL(2,(int)v3.getNumberOfAssociations()); @@ -611,7 +610,7 @@ void QuadraticPlanarInterpTest::IntersectionEdgeOverlapUnitarySegSeg() CPPUNIT_ASSERT(e2->getEndNode()==e1->getStartNode()); e2->decrRef(); e1->decrRef(); v1.clear(); v2.clear(); v3.clear(); - //Test 10 - START - OUT_AFTER | same dir. - 0° + //Test 10 - START - OUT_AFTER | same dir. - 0deg e1=new EdgeLin(0.,0.,0.7,0.); e2=new EdgeLin(0.,0.,1.,0.); CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2)); CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations()); @@ -624,7 +623,7 @@ void QuadraticPlanarInterpTest::IntersectionEdgeOverlapUnitarySegSeg() CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode()); e2->decrRef(); e1->decrRef(); v1.clear(); v2.clear(); v3.clear(); - //Test 10 - START - OUT_AFTER | same dir. - 90° + //Test 10 - START - OUT_AFTER | same dir. - 90deg e1=new EdgeLin(0.,0.,0.,0.7); e2=new EdgeLin(0.,0.,0.,1.); CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2)); CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations()); @@ -637,7 +636,7 @@ void QuadraticPlanarInterpTest::IntersectionEdgeOverlapUnitarySegSeg() CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode()); e2->decrRef(); e1->decrRef(); v1.clear(); v2.clear(); v3.clear(); - //Test 10 - START - OUT_AFTER | same dir. - 45° + //Test 10 - START - OUT_AFTER | same dir. - 45deg e1=new EdgeLin(0.,0.,0.7,0.7); e2=new EdgeLin(0.,0.,1.,1.); CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2)); CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations()); @@ -650,7 +649,7 @@ void QuadraticPlanarInterpTest::IntersectionEdgeOverlapUnitarySegSeg() CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode()); e2->decrRef(); e1->decrRef(); v1.clear(); v2.clear(); v3.clear(); - //Test 10 - START - OUT_AFTER | opp dir. - 45° + //Test 10 - START - OUT_AFTER | opp dir. - 45deg e1=new EdgeLin(0.,0.,0.7,0.7); e2=new EdgeLin(1.,1.,0.,0.); CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2)); CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations()); @@ -663,7 +662,7 @@ void QuadraticPlanarInterpTest::IntersectionEdgeOverlapUnitarySegSeg() CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode()); e2->decrRef(); e1->decrRef(); v1.clear(); v2.clear(); v3.clear(); - //Test 11 - INSIDE - END | same dir. - 0° + //Test 11 - INSIDE - END | same dir. - 0deg e1=new EdgeLin(0.,0.,1.,0.); e2=new EdgeLin(0.7,0.,1.,0.); CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2)); CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations()); @@ -676,7 +675,7 @@ void QuadraticPlanarInterpTest::IntersectionEdgeOverlapUnitarySegSeg() CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode()); e2->decrRef(); e1->decrRef(); v1.clear(); v2.clear(); v3.clear(); - //Test 11 - INSIDE - END | same dir. - 90° + //Test 11 - INSIDE - END | same dir. - 90deg e1=new EdgeLin(0.,0.,0.,1.); e2=new EdgeLin(0.,0.7,0.,1.); CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2)); CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations()); @@ -689,7 +688,7 @@ void QuadraticPlanarInterpTest::IntersectionEdgeOverlapUnitarySegSeg() CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode()); e2->decrRef(); e1->decrRef(); v1.clear(); v2.clear(); v3.clear(); - //Test 11 - INSIDE - END | same dir. - 45° + //Test 11 - INSIDE - END | same dir. - 45deg e1=new EdgeLin(0.,0.,1.,1.); e2=new EdgeLin(0.7,0.7,1.,1.); CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2)); CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations()); @@ -702,7 +701,7 @@ void QuadraticPlanarInterpTest::IntersectionEdgeOverlapUnitarySegSeg() CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode()); e2->decrRef(); e1->decrRef(); v1.clear(); v2.clear(); v3.clear(); - //Test 11 - INSIDE - END | opp dir. - 45° + //Test 11 - INSIDE - END | opp dir. - 45deg e1=new EdgeLin(0.,0.,1.,1.); e2=new EdgeLin(1.,1.,0.7,0.7); CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2)); CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations()); @@ -715,7 +714,7 @@ void QuadraticPlanarInterpTest::IntersectionEdgeOverlapUnitarySegSeg() CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode()); e2->decrRef(); e1->decrRef(); v1.clear(); v2.clear(); v3.clear(); - //Test 12 - OUT_BEFORE - END | same dir. - 0° + //Test 12 - OUT_BEFORE - END | same dir. - 0deg e1=new EdgeLin(0.,0.,1.,0.); e2=new EdgeLin(-0.5,0.,1.,0.); CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2)); CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations()); @@ -728,7 +727,7 @@ void QuadraticPlanarInterpTest::IntersectionEdgeOverlapUnitarySegSeg() CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode()); e2->decrRef(); e1->decrRef(); v1.clear(); v2.clear(); v3.clear(); - //Test 12 - OUT_BEFORE - END | same dir. - 90° + //Test 12 - OUT_BEFORE - END | same dir. - 90deg e1=new EdgeLin(0.,0.,0.,1.); e2=new EdgeLin(0.,-0.5,0.,1.); CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2)); CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations()); @@ -741,7 +740,7 @@ void QuadraticPlanarInterpTest::IntersectionEdgeOverlapUnitarySegSeg() CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode()); e2->decrRef(); e1->decrRef(); v1.clear(); v2.clear(); v3.clear(); - //Test 12 - OUT_BEFORE - END | same dir. - 45° + //Test 12 - OUT_BEFORE - END | same dir. - 45deg e1=new EdgeLin(0.,0.,1.,1.); e2=new EdgeLin(-0.5,-0.5,1.,1.); CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2)); CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations()); @@ -754,7 +753,7 @@ void QuadraticPlanarInterpTest::IntersectionEdgeOverlapUnitarySegSeg() CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode()); e2->decrRef(); e1->decrRef(); v1.clear(); v2.clear(); v3.clear(); - //Test 12 - OUT_BEFORE - END | opp dir. - 45° + //Test 12 - OUT_BEFORE - END | opp dir. - 45deg e1=new EdgeLin(0.,0.,1.,1.); e2=new EdgeLin(1.,1.,-0.5,-0.5); CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2)); CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations()); @@ -767,7 +766,7 @@ void QuadraticPlanarInterpTest::IntersectionEdgeOverlapUnitarySegSeg() CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode()); e2->decrRef(); e1->decrRef(); v1.clear(); v2.clear(); v3.clear(); - //Test 13 - START - INSIDE | same dir. - 0° + //Test 13 - START - INSIDE | same dir. - 0deg e1=new EdgeLin(0.,0.,1.,0.); e2=new EdgeLin(0.,0.,0.5,0.); CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2)); CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations()); @@ -780,7 +779,7 @@ void QuadraticPlanarInterpTest::IntersectionEdgeOverlapUnitarySegSeg() CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode()); e2->decrRef(); e1->decrRef(); v1.clear(); v2.clear(); v3.clear(); - //Test 13 - START - INSIDE | same dir. - 90° + //Test 13 - START - INSIDE | same dir. - 90deg e1=new EdgeLin(0.,0.,0.,1.); e2=new EdgeLin(0.,0.,0.,0.5); CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2)); CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations()); @@ -793,7 +792,7 @@ void QuadraticPlanarInterpTest::IntersectionEdgeOverlapUnitarySegSeg() CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode()); e2->decrRef(); e1->decrRef(); v1.clear(); v2.clear(); v3.clear(); - //Test 13 - START - INSIDE | same dir. - 45° + //Test 13 - START - INSIDE | same dir. - 45deg e1=new EdgeLin(0.,0.,1.,1.); e2=new EdgeLin(0.,0.,0.5,0.5); CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2)); CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations()); @@ -806,7 +805,7 @@ void QuadraticPlanarInterpTest::IntersectionEdgeOverlapUnitarySegSeg() CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode()); e2->decrRef(); e1->decrRef(); v1.clear(); v2.clear(); v3.clear(); - //Test 13 - START - INSIDE | opp dir. - 45° + //Test 13 - START - INSIDE | opp dir. - 45deg e1=new EdgeLin(0.,0.,1.,1.); e2=new EdgeLin(0.5,0.5,0.,0.); CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2)); CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations()); @@ -898,7 +897,7 @@ void QuadraticPlanarInterpTest::IntersectionEdgeOverlapUnitarySegSeg() */ void QuadraticPlanarInterpTest::IntersectionPointOnlyUnitarySegSeg() { - // 0° - classical + // 0deg - classical EdgeLin *e1=new EdgeLin(0.,0.,1.,0.); EdgeLin *e2=new EdgeLin(0.3,0.3,0.5,-0.3); ComposedEdge& v1=*(new ComposedEdge); @@ -914,7 +913,7 @@ void QuadraticPlanarInterpTest::IntersectionPointOnlyUnitarySegSeg() CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,(*v1[0]->getEndNode())[1],ADMISSIBLE_ERROR); e2->decrRef(); e1->decrRef(); v1.clear(); v2.clear(); v3.clear(); - // 90° - classical + // 90deg - classical e1=new EdgeLin(0.,0.,0.,1.); e2=new EdgeLin(-0.3,0.3,0.3,0.5); CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2)); @@ -928,21 +927,21 @@ void QuadraticPlanarInterpTest::IntersectionPointOnlyUnitarySegSeg() CPPUNIT_ASSERT_DOUBLES_EQUAL(0.4,(*v1[0]->getEndNode())[1],ADMISSIBLE_ERROR); e2->decrRef(); e1->decrRef(); v1.clear(); v2.clear(); v3.clear(); - //Test 1 - 0° + //Test 1 - 0deg e1=new EdgeLin(0.,0.,1.,0.); e2=new EdgeLin(0.,0.,0.,1.); CPPUNIT_ASSERT(!e1->intersectWith(e2,v3,v1,v2)); CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations()); CPPUNIT_ASSERT(v3.isStart1(0)); CPPUNIT_ASSERT(v3.isStart2(0)); e2->decrRef(); e1->decrRef(); v1.clear(); v2.clear(); v3.clear(); - //Test 1 - 90° + //Test 1 - 90deg e1=new EdgeLin(0.,0.,0.,1.); e2=new EdgeLin(0.,0.,1.,0.); CPPUNIT_ASSERT(!e1->intersectWith(e2,v3,v1,v2)); CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations()); CPPUNIT_ASSERT(v3.isStart1(0)); CPPUNIT_ASSERT(v3.isStart2(0)); e2->decrRef(); e1->decrRef(); v1.clear(); v2.clear(); v3.clear(); - //Test 1 - 45° + //Test 1 - 45deg e1=new EdgeLin(0.,0.,1.,1.); e2=new EdgeLin(0.,0.,1.,-1.); CPPUNIT_ASSERT(!e1->intersectWith(e2,v3,v1,v2)); CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations()); @@ -1021,3 +1020,5 @@ void QuadraticPlanarInterpTest::IntersectionPointOnlyUnitarySegSeg() ComposedEdge::Delete(&v2); ComposedEdge::Delete(&v1); } + +}