From fa829e60d3f99eb253f6e92401f79de659370d39 Mon Sep 17 00:00:00 2001 From: ageay Date: Thu, 10 Jul 2008 12:35:49 +0000 Subject: [PATCH] *** empty log message *** --- .../Geometric2D/BasicMainTest.hxx | 96 --- .../Geometric2D/Test/Makefile.am | 31 - src/INTERP_KERNEL/Geometric2D/Test/Pol1.fig | 15 - src/INTERP_KERNEL/Geometric2D/Test/Pol2.fig | 13 - src/INTERP_KERNEL/Geometric2D/Test/Pol3.fig | 11 - src/INTERP_KERNEL/Geometric2D/Test/Pol4.fig | 10 - .../Test/QuadraticPlanarInterpRun.cxx | 12 - .../Test/QuadraticPlanarInterpTest.cxx | 812 ------------------ .../Test/QuadraticPlanarInterpTest.hxx | 60 -- .../Test/QuadraticPlanarInterpTest2.cxx | 641 -------------- .../Test/QuadraticPlanarInterpTest3.cxx | 300 ------- .../Test/QuadraticPlanarInterpTest4.cxx | 327 ------- .../Geometric2D/Test/UnitTestsResult.hxx | 20 - 13 files changed, 2348 deletions(-) delete mode 100644 src/INTERP_KERNEL/Geometric2D/BasicMainTest.hxx delete mode 100644 src/INTERP_KERNEL/Geometric2D/Test/Makefile.am delete mode 100644 src/INTERP_KERNEL/Geometric2D/Test/Pol1.fig delete mode 100644 src/INTERP_KERNEL/Geometric2D/Test/Pol2.fig delete mode 100644 src/INTERP_KERNEL/Geometric2D/Test/Pol3.fig delete mode 100644 src/INTERP_KERNEL/Geometric2D/Test/Pol4.fig delete mode 100644 src/INTERP_KERNEL/Geometric2D/Test/QuadraticPlanarInterpRun.cxx delete mode 100644 src/INTERP_KERNEL/Geometric2D/Test/QuadraticPlanarInterpTest.cxx delete mode 100644 src/INTERP_KERNEL/Geometric2D/Test/QuadraticPlanarInterpTest.hxx delete mode 100644 src/INTERP_KERNEL/Geometric2D/Test/QuadraticPlanarInterpTest2.cxx delete mode 100644 src/INTERP_KERNEL/Geometric2D/Test/QuadraticPlanarInterpTest3.cxx delete mode 100644 src/INTERP_KERNEL/Geometric2D/Test/QuadraticPlanarInterpTest4.cxx delete mode 100644 src/INTERP_KERNEL/Geometric2D/Test/UnitTestsResult.hxx diff --git a/src/INTERP_KERNEL/Geometric2D/BasicMainTest.hxx b/src/INTERP_KERNEL/Geometric2D/BasicMainTest.hxx deleted file mode 100644 index 99bc93739..000000000 --- a/src/INTERP_KERNEL/Geometric2D/BasicMainTest.hxx +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// 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 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 -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef _BASICMAINTEST_HXX_ -#define _BASICMAINTEST_HXX_ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -// ============================================================================ -/*! - * Main program source for Unit Tests with cppunit package does not depend - * on actual tests, so we use the same for all partial unit tests. - */ -// ============================================================================ - -#include "UnitTestsResult.hxx" - -int main(int argc, char* argv[]) -{ - // --- Create the event manager and test controller - CPPUNIT_NS::TestResult controller; - - // --- Add a listener that collects test result - CPPUNIT_NS::TestResultCollector result; - controller.addListener( &result ); - - // --- Add a listener that print dots as test run. -#ifdef WIN32 - CPPUNIT_NS::TextTestProgressListener progress; -#else - CPPUNIT_NS::BriefTestProgressListener progress; -#endif - controller.addListener( &progress ); - - // --- Get the top level suite from the registry - - CPPUNIT_NS::Test *suite = - CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest(); - - // --- Adds the test to the list of test to run - - CPPUNIT_NS::TestRunner runner; - //CPPUNIT_NS::TextTestRunner runner; - runner.addTest( suite ); - runner.run( controller); - //bool wasSucessful = runner.run(); - - // --- Print test in a compiler compatible format. - - system("mkdir -p /tmp/${USER}"); - std::ofstream testFile; - testFile.open(INTERP_KERNEL::UnitTestsResult.c_str(), std::ios::out | std::ios::app); - testFile << UNIT_TEST_HEADER << std::endl; - //CPPUNIT_NS::CompilerOutputter outputter( &result, std::cerr ); - CPPUNIT_NS::CompilerOutputter outputter( &result, testFile ); - outputter.write(); - - // --- Run the tests. - - bool wasSucessful = result.wasSuccessful(); - testFile.close(); - - // --- Return error code 1 if the one of test failed. - - return wasSucessful ? 0 : 1; -} - -#endif diff --git a/src/INTERP_KERNEL/Geometric2D/Test/Makefile.am b/src/INTERP_KERNEL/Geometric2D/Test/Makefile.am deleted file mode 100644 index 7daded567..000000000 --- a/src/INTERP_KERNEL/Geometric2D/Test/Makefile.am +++ /dev/null @@ -1,31 +0,0 @@ -# MED MEDMEM : MED files in memory -# -# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -# -# 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 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 -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# -# -# -# File : Makefile.am -# Author : Anthony GEAY (CEA/DEN/DANS/DM2S/SFME/LGLS) -# Module : MED - -include $(top_srcdir)/adm_local/unix/make_common_starter.am - - - diff --git a/src/INTERP_KERNEL/Geometric2D/Test/Pol1.fig b/src/INTERP_KERNEL/Geometric2D/Test/Pol1.fig deleted file mode 100644 index be55cc812..000000000 --- a/src/INTERP_KERNEL/Geometric2D/Test/Pol1.fig +++ /dev/null @@ -1,15 +0,0 @@ -#FIG 3.2 Produced by xfig version 3.2.5-alpha5 -Landscape -Center -Inches -Letter -100.00 -Single --2 -1200 2 -5 1 0 1 0 7 50 -1 -1 0.000 0 1 0 0 2700.000 4800.000 3600 6000 4200 4800 3600 3600 -5 1 0 1 0 7 50 -1 -1 0.000 0 1 0 0 5400.000 1200.000 3600 3600 5400 4200 7200 3600 -5 1 0 1 0 7 50 -1 -1 0.000 0 0 0 0 5100.000 6300.000 7200 3600 7800 4200 8400 5400 -5 1 0 1 0 7 50 -1 -1 0.000 0 1 0 0 8400.000 6000.000 8400 5400 7800 6000 8400 6600 -5 1 0 1 0 7 50 -1 -1 0.000 0 1 0 0 9128.571 9642.857 8400 6600 6600 7800 6000 9600 -5 1 0 1 0 7 50 -1 -1 0.000 0 1 0 0 2820.000 9120.000 6000 9600 5400 7200 3600 6000 diff --git a/src/INTERP_KERNEL/Geometric2D/Test/Pol2.fig b/src/INTERP_KERNEL/Geometric2D/Test/Pol2.fig deleted file mode 100644 index 4778e6735..000000000 --- a/src/INTERP_KERNEL/Geometric2D/Test/Pol2.fig +++ /dev/null @@ -1,13 +0,0 @@ -#FIG 3.2 Produced by xfig version 3.2.5-alpha5 -Landscape -Center -Inches -Letter -100.00 -Single --2 -1200 2 -5 1 0 1 0 7 50 -1 -1 0.000 0 0 0 0 13000.000 7200.000 6600 9000 6600 5400 8400 2400 -5 1 0 1 0 7 50 -1 -1 0.000 0 1 0 0 10500.000 -900.000 8400 2400 10800 3000 12600 2400 -5 1 0 1 0 7 50 -1 -1 0.000 0 1 0 0 16242.857 6471.429 12600 2400 10800 6000 11400 9000 -5 1 0 1 0 7 50 -1 -1 0.000 0 0 0 0 9000.000 13500.000 6600 9000 9000 8400 11400 9000 diff --git a/src/INTERP_KERNEL/Geometric2D/Test/Pol3.fig b/src/INTERP_KERNEL/Geometric2D/Test/Pol3.fig deleted file mode 100644 index 4bad14493..000000000 --- a/src/INTERP_KERNEL/Geometric2D/Test/Pol3.fig +++ /dev/null @@ -1,11 +0,0 @@ -#FIG 3.2 Produced by xfig version 3.2.5-alpha5 -Landscape -Center -Inches -Letter -100.00 -Single --2 -1200 2 -2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 -3000 7200 6600 3600 diff --git a/src/INTERP_KERNEL/Geometric2D/Test/Pol4.fig b/src/INTERP_KERNEL/Geometric2D/Test/Pol4.fig deleted file mode 100644 index 1c6cd7924..000000000 --- a/src/INTERP_KERNEL/Geometric2D/Test/Pol4.fig +++ /dev/null @@ -1,10 +0,0 @@ -#FIG 3.2 Produced by xfig version 3.2.5-alpha5 -Landscape -Center -Inches -Letter -100.00 -Single --2 -1200 2 -5 1 0 1 0 7 50 -1 -1 0.000 0 0 0 0 4800.000 4837.500 4200 7200 4800 2400 5400 7200 diff --git a/src/INTERP_KERNEL/Geometric2D/Test/QuadraticPlanarInterpRun.cxx b/src/INTERP_KERNEL/Geometric2D/Test/QuadraticPlanarInterpRun.cxx deleted file mode 100644 index ffa8e9b30..000000000 --- a/src/INTERP_KERNEL/Geometric2D/Test/QuadraticPlanarInterpRun.cxx +++ /dev/null @@ -1,12 +0,0 @@ - -#define UNIT_TEST_HEADER " --- TEST src/engine EngineTest" - -#include "QuadraticPlanarInterpTest.hxx" - -// --- Registers the fixture into the 'registry' - -CPPUNIT_TEST_SUITE_REGISTRATION( INTERP_KERNEL::QuadraticPlanarInterpTest ); - -// --- generic Main program from bases/Test - -#include "BasicMainTest.hxx" diff --git a/src/INTERP_KERNEL/Geometric2D/Test/QuadraticPlanarInterpTest.cxx b/src/INTERP_KERNEL/Geometric2D/Test/QuadraticPlanarInterpTest.cxx deleted file mode 100644 index b5da3ca08..000000000 --- a/src/INTERP_KERNEL/Geometric2D/Test/QuadraticPlanarInterpTest.cxx +++ /dev/null @@ -1,812 +0,0 @@ -#include "QuadraticPlanarInterpTest.hxx" -#include "QuadraticPolygon.hxx" -#include "EdgeArcCircle.hxx" -#include "ElementaryEdge.hxx" -#include "ComposedEdge.hxx" -#include "EdgeLin.hxx" - -#include -#include - -using namespace std; -using namespace INTERP_KERNEL; - -static const double ADMISSIBLE_ERROR = 1.e-14; - -void QuadraticPlanarInterpTest::setUp() -{ -} - -void QuadraticPlanarInterpTest::tearDown() -{ -} - -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"); - EdgeLin *e1=new EdgeLin(stream); - Bounds bound=e1->getBounds(); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.32,bound[0],ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.45,bound[1],ADMISSIBLE_ERROR); - 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"); - e1=new EdgeLin(stream2); - bound=e1->getBounds(); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.32,bound[0],ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.45,bound[1],ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.34,bound[2],ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.47,bound[3],ADMISSIBLE_ERROR); - e1->decrRef(); - //Testing bounds calculation For Arc of circle. - -} - -void QuadraticPlanarInterpTest::ReadWriteInXfigGlobal() -{ - QuadraticPolygon pol1("Pol1.fig"); - pol1.dumpInXfigFile("Pol1_gen.fig"); - QuadraticPolygon pol2("Pol2.fig"); - pol2.dumpInXfigFile("Pol2_gen.fig"); - QuadraticPolygon pol3("Pol3.fig"); - pol3.dumpInXfigFile("Pol3_gen.fig"); - QuadraticPolygon pol4("Pol4.fig"); - CPPUNIT_ASSERT_EQUAL(1,pol4.size()); - ElementaryEdge *edge1=dynamic_cast(pol4[0]); - CPPUNIT_ASSERT(edge1); - Edge *edge2=edge1->getPtr(); - EdgeArcCircle *edge=dynamic_cast(edge2); - CPPUNIT_ASSERT(edge); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.24375,edge->getRadius(),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(5.7857653289925404,edge->getAngle(),ADMISSIBLE_ERROR); - double center[2]; - edge->getCenter(center); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.48,center[0],ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.48375,center[1],ADMISSIBLE_ERROR); - const double *start=*edge->getStartNode(); - Node *n1=new Node(start[0]+2*(center[0]-start[0]),start[1]+2*(center[1]-start[1])); - edge->changeMiddle(n1); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.24375,edge->getRadius(),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(5.7857653289925404,edge->getAngle(),ADMISSIBLE_ERROR); - n1->decrRef(); - n1=new Node(center[0],center[1]+0.24375); - edge->changeMiddle(n1); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.24375,edge->getRadius(),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.49741997818704586,edge->getAngle(),ADMISSIBLE_ERROR);//5.7857653289925404 + 2*PI - n1->decrRef(); - //A half circle. - EdgeArcCircle *e=new EdgeArcCircle(0.84,0.54,0.78,0.6,0.84,0.66); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.06,e->getRadius(),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(-3.1415925921507317,e->getAngle(),1e-5); - e->decrRef(); - e=new EdgeArcCircle(0.84,0.54,0.9,0.6,0.84,0.66); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.06,e->getRadius(),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(3.1415925921507317,e->getAngle(),1e-5); - e->decrRef(); -} - -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"); - 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"); - 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); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.45,(*bound)[1],ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.34,(*bound)[2],ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.48,(*bound)[3],ADMISSIBLE_ERROR); - 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"); - 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"); - EdgeLin *e4=new EdgeLin(stream4); - bound=e3->getBounds().amIIntersectingWith(e4->getBounds()); CPPUNIT_ASSERT(bound); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.48,(*bound)[0],ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.6,(*bound)[1],ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.42,(*bound)[2],ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.66,(*bound)[3],ADMISSIBLE_ERROR); - delete bound; - e3->decrRef(); e4->decrRef(); -} - -void QuadraticPlanarInterpTest::EdgeLinUnitary() -{ - EdgeLin *e1=new EdgeLin(0.5,0.5,3.7,4.1); - Node *n=new Node(2.1,2.3); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getCharactValue(*n),0.5,1e-8); - n->decrRef(); - n=new Node(3.7,4.1); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getCharactValue(*n),1.,1e-8); - n->decrRef(); - n=new Node(0.5,0.5); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getCharactValue(*n),0.,1e-8); - n->decrRef(); - n=new Node(-1.1,-1.3); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getCharactValue(*n),-0.5,1e-8); - n->decrRef(); - n=new Node(5.3,5.9); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getCharactValue(*n),1.5,1e-8); - n->decrRef(); e1->decrRef(); -} - -/*! - * Here two things are tested. - * 1 ) One the overlapping calculation capability of edge/edge intersector. - * 2 ) Then the capability to handle the case where 2 segs (whatever their type) are overlapped. - * All the configuration of full or part overlapping have been tested. - */ -void QuadraticPlanarInterpTest::IntersectionEdgeOverlapUnitarySegSeg() -{ - ComposedEdge& v1=*(new ComposedEdge); - ComposedEdge& v2=*(new ComposedEdge); - MergePoints v3; - //Testing merge of geometric equals seg2. - EdgeLin *e1=new EdgeLin(0.5,0.5,1.,1.); EdgeLin *e2=new EdgeLin(0.5,0.5,1.,1.); - CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2)); - CPPUNIT_ASSERT_EQUAL(2,(int)v3.getNumberOfAssociations()); - CPPUNIT_ASSERT_EQUAL(1,(int)v1.size()); CPPUNIT_ASSERT_EQUAL(1,(int)v2.size()); - CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection()); CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e1) && v2[0]->getDirection()); - v1.clear(); v2.clear(); v3.clear(); - // - testing by adding some noise - e1->decrRef(); e1=new EdgeLin(0.5+5.e-15,0.5-5.e-15,1.,1.+7.e-15); - CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2)); - CPPUNIT_ASSERT_EQUAL(2,(int)v3.getNumberOfAssociations()); - CPPUNIT_ASSERT_EQUAL(1,(int)v1.size()); CPPUNIT_ASSERT_EQUAL(1,(int)v2.size()); - CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection()); CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e1) && v2[0]->getDirection()); - e2->decrRef(); e1->decrRef(); - v1.clear(); v2.clear(); v3.clear(); - //Testing merge of geometric equals seg2 but now with opposite direction - 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); - CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2)); - CPPUNIT_ASSERT_EQUAL(2,(int)v3.getNumberOfAssociations()); - CPPUNIT_ASSERT_EQUAL(1,(int)v1.size()); CPPUNIT_ASSERT_EQUAL(1,(int)v2.size()); - 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() - e2->decrRef(); e1->decrRef(); - v1.clear(); v2.clear(); v3.clear(); - //Test 0 - //Test 1 - OUT_AFTER - OUT_AFTER | same dir. - 0° - 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()); - CPPUNIT_ASSERT_EQUAL(0,(int)v1.size()); - 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° - 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()); - CPPUNIT_ASSERT_EQUAL(2,(int)v1.size()); - CPPUNIT_ASSERT_EQUAL(2,(int)v2.size()); - CPPUNIT_ASSERT(v1[1]->intresicEqualDirSensitive(v2[0])); - CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode()); CPPUNIT_ASSERT(e1->getStartNode()==v1[0]->getStartNode()); CPPUNIT_ASSERT(e1->getEndNode()==v1[1]->getEndNode()); - CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode()); CPPUNIT_ASSERT(e2->getStartNode()==v2[0]->getStartNode()); CPPUNIT_ASSERT(e2->getEndNode()==v2[1]->getEndNode()); - CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode()); - 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° - 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()); - CPPUNIT_ASSERT_EQUAL(2,(int)v1.size()); - CPPUNIT_ASSERT_EQUAL(2,(int)v2.size()); - CPPUNIT_ASSERT(v1[1]->intresicEqualDirSensitive(v2[0])); - CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode()); CPPUNIT_ASSERT(e1->getStartNode()==v1[0]->getStartNode()); CPPUNIT_ASSERT(e1->getEndNode()==v1[1]->getEndNode()); - CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode()); CPPUNIT_ASSERT(e2->getStartNode()==v2[0]->getStartNode()); CPPUNIT_ASSERT(e2->getEndNode()==v2[1]->getEndNode()); - CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode()); - 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° - 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()); - CPPUNIT_ASSERT_EQUAL(2,(int)v1.size()); - CPPUNIT_ASSERT_EQUAL(2,(int)v2.size()); - CPPUNIT_ASSERT(v1[1]->intresicEqualDirSensitive(v2[0])); - CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode()); CPPUNIT_ASSERT(e1->getStartNode()==v1[0]->getStartNode()); CPPUNIT_ASSERT(e1->getEndNode()==v1[1]->getEndNode()); - 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° - 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()); - CPPUNIT_ASSERT_EQUAL(2,(int)v1.size()); - CPPUNIT_ASSERT_EQUAL(2,(int)v2.size()); - CPPUNIT_ASSERT(!v1[1]->intresicEqualDirSensitive(v2[1]) && v1[1]->intresicEqual(v2[1])); - CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode()); CPPUNIT_ASSERT(e1->getStartNode()==v1[0]->getStartNode()); CPPUNIT_ASSERT(e1->getEndNode()==v1[1]->getEndNode()); - CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode()); CPPUNIT_ASSERT(e2->getStartNode()==v2[0]->getStartNode()); CPPUNIT_ASSERT(e2->getEndNode()==v2[1]->getEndNode()); - CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode()); - 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° - 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()); - CPPUNIT_ASSERT_EQUAL(3,(int)v1.size()); - CPPUNIT_ASSERT_EQUAL(1,(int)v2.size()); - CPPUNIT_ASSERT(v1[1]->intresincEqCoarse(e2) && v1[1]->getDirection()); - CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode()); CPPUNIT_ASSERT(v1[1]->getEndNode()==v1[2]->getStartNode()); - CPPUNIT_ASSERT(v1[0]->getStartNode()== e1->getStartNode()); CPPUNIT_ASSERT(v1[2]->getEndNode()== e1->getEndNode()); - CPPUNIT_ASSERT(v1[0]->getEndNode()==e2->getStartNode()); CPPUNIT_ASSERT(v1[1]->getEndNode()==e2->getEndNode()); - CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode()); - 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° - 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()); - CPPUNIT_ASSERT_EQUAL(3,(int)v1.size()); - CPPUNIT_ASSERT_EQUAL(1,(int)v2.size()); - CPPUNIT_ASSERT(v1[1]->intresincEqCoarse(e2) && v1[1]->getDirection()); - CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode()); CPPUNIT_ASSERT(v1[1]->getEndNode()==v1[2]->getStartNode()); - CPPUNIT_ASSERT(v1[0]->getStartNode()== e1->getStartNode()); CPPUNIT_ASSERT(v1[2]->getEndNode()== e1->getEndNode()); - CPPUNIT_ASSERT(v1[0]->getEndNode()==e2->getStartNode()); CPPUNIT_ASSERT(v1[1]->getEndNode()==e2->getEndNode()); - CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode()); - 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° - 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()); - CPPUNIT_ASSERT_EQUAL(3,(int)v1.size()); - CPPUNIT_ASSERT_EQUAL(1,(int)v2.size()); - CPPUNIT_ASSERT(v1[1]->intresincEqCoarse(e2) && v1[1]->getDirection()); - CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode()); CPPUNIT_ASSERT(v1[1]->getEndNode()==v1[2]->getStartNode()); - CPPUNIT_ASSERT(v1[0]->getStartNode()== e1->getStartNode()); CPPUNIT_ASSERT(v1[2]->getEndNode()== e1->getEndNode()); - CPPUNIT_ASSERT(v1[0]->getEndNode()==e2->getStartNode()); CPPUNIT_ASSERT(v1[1]->getEndNode()==e2->getEndNode()); - CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode()); - 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° - 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()); - CPPUNIT_ASSERT_EQUAL(3,(int)v1.size()); - CPPUNIT_ASSERT_EQUAL(1,(int)v2.size()); - CPPUNIT_ASSERT(v1[1]->intresincEqCoarse(e2) && !v1[1]->getDirection()); - CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode()); CPPUNIT_ASSERT(v1[1]->getEndNode()==v1[2]->getStartNode()); - CPPUNIT_ASSERT(v1[0]->getStartNode()== e1->getStartNode()); CPPUNIT_ASSERT(v1[2]->getEndNode()== e1->getEndNode()); - CPPUNIT_ASSERT(v1[0]->getEndNode()==e2->getEndNode()); CPPUNIT_ASSERT(v1[1]->getEndNode()==e2->getStartNode()); - CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode()); - CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode()); - e2->decrRef(); e1->decrRef(); - v1.clear(); v2.clear(); v3.clear(); - //Test 4 - OUT_BEFORE - OUT_BEFORE | same dir. - 0 ° - 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()); - CPPUNIT_ASSERT_EQUAL(0,(int)v1.size()); - 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° - 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()); - CPPUNIT_ASSERT_EQUAL(2,(int)v1.size()); - CPPUNIT_ASSERT_EQUAL(2,(int)v2.size()); - CPPUNIT_ASSERT(v1[0]->intresicEqualDirSensitive(v2[1])); - CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode()); CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode()); - CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode()); - 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° - 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()); - CPPUNIT_ASSERT_EQUAL(2,(int)v1.size()); - CPPUNIT_ASSERT_EQUAL(2,(int)v2.size()); - CPPUNIT_ASSERT(v1[0]->intresicEqualDirSensitive(v2[1])); - CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode()); CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode()); - CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode()); - 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° - 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()); - CPPUNIT_ASSERT_EQUAL(2,(int)v1.size()); - CPPUNIT_ASSERT_EQUAL(2,(int)v2.size()); - CPPUNIT_ASSERT(v1[0]->intresicEqualDirSensitive(v2[1])); - CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode()); CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode()); - CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode()); - 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° - 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()); - CPPUNIT_ASSERT_EQUAL(2,(int)v1.size()); - CPPUNIT_ASSERT_EQUAL(2,(int)v2.size()); - CPPUNIT_ASSERT(!v1[0]->intresicEqualDirSensitive(v2[0]) && v1[0]->intresicEqual(v2[0]) ); - CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode()); CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode()); - CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode()); - 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° - 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()); - CPPUNIT_ASSERT_EQUAL(1,(int)v1.size()); - CPPUNIT_ASSERT_EQUAL(3,(int)v2.size()); - CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection()); - CPPUNIT_ASSERT(v2[1]->intresincEqCoarse(e1) && v2[1]->getDirection()); - CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode() && v2[1]->getEndNode()==v2[2]->getStartNode()); - CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode()); - 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° - 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()); - CPPUNIT_ASSERT_EQUAL(1,(int)v1.size()); - CPPUNIT_ASSERT_EQUAL(3,(int)v2.size()); - CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection()); - CPPUNIT_ASSERT(v2[1]->intresincEqCoarse(e1) && v2[1]->getDirection()); - CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode() && v2[1]->getEndNode()==v2[2]->getStartNode()); - CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode()); - 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° - 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()); - CPPUNIT_ASSERT_EQUAL(1,(int)v1.size()); - CPPUNIT_ASSERT_EQUAL(3,(int)v2.size()); - CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection()); - CPPUNIT_ASSERT(v2[1]->intresincEqCoarse(e1) && v2[1]->getDirection()); - CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode() && v2[1]->getEndNode()==v2[2]->getStartNode()); - CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode()); - 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° - 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()); - CPPUNIT_ASSERT_EQUAL(1,(int)v1.size()); - CPPUNIT_ASSERT_EQUAL(3,(int)v2.size()); - CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection()); - CPPUNIT_ASSERT(v2[1]->intresincEqCoarse(e1) && !v2[1]->getDirection()); - CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode() && v2[1]->getEndNode()==v2[2]->getStartNode()); - CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode()); - 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° - 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()); - CPPUNIT_ASSERT_EQUAL(0,(int)v1.size()); - 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° - 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()); - CPPUNIT_ASSERT_EQUAL(0,(int)v1.size()); - CPPUNIT_ASSERT_EQUAL(0,(int)v2.size()); - CPPUNIT_ASSERT(e1->getEndNode()==e2->getEndNode()); - e2->decrRef(); e1->decrRef(); - v1.clear(); v2.clear(); v3.clear(); - //Test 8 - START - END | same dir. - 0° - 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()); - CPPUNIT_ASSERT_EQUAL(1,(int)v1.size()); - CPPUNIT_ASSERT_EQUAL(1,(int)v2.size()); - CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection()); CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e1) && v2[0]->getDirection()); - CPPUNIT_ASSERT(e1->getStartNode()==e2->getStartNode()); CPPUNIT_ASSERT(e1->getEndNode()==e2->getEndNode()); - CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode()); - 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° - 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()); - CPPUNIT_ASSERT_EQUAL(1,(int)v1.size()); - CPPUNIT_ASSERT_EQUAL(1,(int)v2.size()); - CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection()); CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e1) && v2[0]->getDirection()); - CPPUNIT_ASSERT(e1->getStartNode()==e2->getStartNode()); CPPUNIT_ASSERT(e1->getEndNode()==e2->getEndNode()); - CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode()); - 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° - 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()); - CPPUNIT_ASSERT_EQUAL(1,(int)v1.size()); - CPPUNIT_ASSERT_EQUAL(1,(int)v2.size()); - CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection()); CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e1) && v2[0]->getDirection()); - CPPUNIT_ASSERT(e1->getStartNode()==e2->getStartNode()); CPPUNIT_ASSERT(e1->getEndNode()==e2->getEndNode()); - CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode()); - 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° - 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()); - CPPUNIT_ASSERT_EQUAL(1,(int)v1.size()); - CPPUNIT_ASSERT_EQUAL(1,(int)v2.size()); - CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection()); CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e1) && !v2[0]->getDirection()); - CPPUNIT_ASSERT(e1->getStartNode()==e2->getEndNode()); CPPUNIT_ASSERT(e1->getEndNode()==e2->getStartNode()); - CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode()); - CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode()); - e2->decrRef(); e1->decrRef(); - v1.clear(); v2.clear(); v3.clear(); - //Test 9 - OUT_BEFORE - START | same dir. - e1=new EdgeLin(0.,0.,1.,0.); e2=new EdgeLin(-0.5,0.,0.,0.); - CPPUNIT_ASSERT(!e1->intersectWith(e2,v3,v1,v2)); - CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations()); - CPPUNIT_ASSERT_EQUAL(0,(int)v1.size()); - CPPUNIT_ASSERT_EQUAL(0,(int)v2.size()); - CPPUNIT_ASSERT(e2->getEndNode()==e1->getStartNode()); - e2->decrRef(); e1->decrRef(); - v1.clear(); v2.clear(); v3.clear(); - //Test 10 - START - OUT_AFTER | same dir. - 0° - 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()); - CPPUNIT_ASSERT_EQUAL(1,(int)v1.size()); - CPPUNIT_ASSERT_EQUAL(2,(int)v2.size()); - CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection()); CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e1) && v2[0]->getDirection()); - CPPUNIT_ASSERT(e1->getStartNode()==v1[0]->getStartNode()); CPPUNIT_ASSERT(e1->getStartNode()==e2->getStartNode()); CPPUNIT_ASSERT(v2[1]->getEndNode()==e2->getEndNode()); - CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode()); - CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode()); - 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° - 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()); - CPPUNIT_ASSERT_EQUAL(1,(int)v1.size()); - CPPUNIT_ASSERT_EQUAL(2,(int)v2.size()); - CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection()); CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e1) && v2[0]->getDirection()); - CPPUNIT_ASSERT(e1->getStartNode()==v1[0]->getStartNode()); CPPUNIT_ASSERT(e1->getStartNode()==e2->getStartNode()); CPPUNIT_ASSERT(v2[1]->getEndNode()==e2->getEndNode()); - CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode()); - CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode()); - 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° - 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()); - CPPUNIT_ASSERT_EQUAL(1,(int)v1.size()); - CPPUNIT_ASSERT_EQUAL(2,(int)v2.size()); - CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection()); CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e1) && v2[0]->getDirection()); - CPPUNIT_ASSERT(e1->getStartNode()==v1[0]->getStartNode()); CPPUNIT_ASSERT(e1->getStartNode()==e2->getStartNode()); CPPUNIT_ASSERT(v2[1]->getEndNode()==e2->getEndNode()); - CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode()); - CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode()); - 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° - 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()); - CPPUNIT_ASSERT_EQUAL(1,(int)v1.size()); - CPPUNIT_ASSERT_EQUAL(2,(int)v2.size()); - CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection()); CPPUNIT_ASSERT(v2[1]->intresincEqCoarse(e1) && !v2[1]->getDirection()); - CPPUNIT_ASSERT(e1->getStartNode()==v1[0]->getStartNode()); CPPUNIT_ASSERT(e1->getStartNode()==e2->getEndNode()); CPPUNIT_ASSERT(v2[1]->getEndNode()==e2->getEndNode()); - CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode()); - CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode()); - 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° - 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()); - CPPUNIT_ASSERT_EQUAL(2,(int)v1.size()); - CPPUNIT_ASSERT_EQUAL(1,(int)v2.size()); - CPPUNIT_ASSERT(v1[1]->intresincEqCoarse(e2) && v1[1]->getDirection()); CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e2) && v2[0]->getDirection()); - CPPUNIT_ASSERT(e1->getStartNode()==v1[0]->getStartNode()); CPPUNIT_ASSERT(e1->getEndNode()==v1[1]->getEndNode()); CPPUNIT_ASSERT(e1->getEndNode()==e2->getEndNode()); - CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode()); - CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode()); - 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° - 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()); - CPPUNIT_ASSERT_EQUAL(2,(int)v1.size()); - CPPUNIT_ASSERT_EQUAL(1,(int)v2.size()); - CPPUNIT_ASSERT(v1[1]->intresincEqCoarse(e2) && v1[1]->getDirection()); CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e2) && v2[0]->getDirection()); - CPPUNIT_ASSERT(e1->getStartNode()==v1[0]->getStartNode()); CPPUNIT_ASSERT(e1->getEndNode()==v1[1]->getEndNode()); CPPUNIT_ASSERT(e1->getEndNode()==e2->getEndNode()); - CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode()); - CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode()); - 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° - 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()); - CPPUNIT_ASSERT_EQUAL(2,(int)v1.size()); - CPPUNIT_ASSERT_EQUAL(1,(int)v2.size()); - CPPUNIT_ASSERT(v1[1]->intresincEqCoarse(e2) && v1[1]->getDirection()); CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e2) && v2[0]->getDirection()); - CPPUNIT_ASSERT(e1->getStartNode()==v1[0]->getStartNode()); CPPUNIT_ASSERT(e1->getEndNode()==v1[1]->getEndNode()); CPPUNIT_ASSERT(e1->getEndNode()==e2->getEndNode()); - CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode()); - CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode()); - 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° - 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()); - CPPUNIT_ASSERT_EQUAL(2,(int)v1.size()); - CPPUNIT_ASSERT_EQUAL(1,(int)v2.size()); - CPPUNIT_ASSERT(e1->getStartNode()==v1[0]->getStartNode()); CPPUNIT_ASSERT(e1->getEndNode()==v1[1]->getEndNode()); CPPUNIT_ASSERT(e1->getEndNode()==e2->getStartNode()); - CPPUNIT_ASSERT(v1[1]->intresincEqCoarse(e2) && !v1[1]->getDirection()); CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e2) && v2[0]->getDirection()); - CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode()); - CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode()); - 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° - 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()); - CPPUNIT_ASSERT_EQUAL(1,(int)v1.size()); - CPPUNIT_ASSERT_EQUAL(2,(int)v2.size()); - CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection()); CPPUNIT_ASSERT(v2[1]->intresincEqCoarse(e1) && v2[1]->getDirection()); - CPPUNIT_ASSERT(e2->getStartNode()==v2[0]->getStartNode()); CPPUNIT_ASSERT(e1->getEndNode()==e2->getEndNode()); CPPUNIT_ASSERT(e2->getEndNode()==v2[1]->getEndNode()); - CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode()); - CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode()); - 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° - 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()); - CPPUNIT_ASSERT_EQUAL(1,(int)v1.size()); - CPPUNIT_ASSERT_EQUAL(2,(int)v2.size()); - CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection()); CPPUNIT_ASSERT(v2[1]->intresincEqCoarse(e1) && v2[1]->getDirection()); - CPPUNIT_ASSERT(e2->getStartNode()==v2[0]->getStartNode()); CPPUNIT_ASSERT(e1->getEndNode()==e2->getEndNode()); CPPUNIT_ASSERT(e2->getEndNode()==v2[1]->getEndNode()); - CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode()); - CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode()); - 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° - 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()); - CPPUNIT_ASSERT_EQUAL(1,(int)v1.size()); - CPPUNIT_ASSERT_EQUAL(2,(int)v2.size()); - CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection()); CPPUNIT_ASSERT(v2[1]->intresincEqCoarse(e1) && v2[1]->getDirection()); - CPPUNIT_ASSERT(e2->getStartNode()==v2[0]->getStartNode()); CPPUNIT_ASSERT(e1->getEndNode()==e2->getEndNode()); CPPUNIT_ASSERT(e2->getEndNode()==v2[1]->getEndNode()); - CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode()); - CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode()); - 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° - 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()); - CPPUNIT_ASSERT_EQUAL(1,(int)v1.size()); - CPPUNIT_ASSERT_EQUAL(2,(int)v2.size()); - CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection()); CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e1) && !v2[0]->getDirection()); - CPPUNIT_ASSERT(e2->getStartNode()==v2[0]->getStartNode()); CPPUNIT_ASSERT(e1->getEndNode()==e2->getStartNode()); CPPUNIT_ASSERT(e2->getEndNode()==v2[1]->getEndNode()); - CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode()); - CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode()); - 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° - 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()); - CPPUNIT_ASSERT_EQUAL(2,(int)v1.size()); - CPPUNIT_ASSERT_EQUAL(1,(int)v2.size()); - CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e2) && v1[0]->getDirection()); CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e2) && v2[0]->getDirection()); - CPPUNIT_ASSERT(e2->getStartNode()==v1[0]->getStartNode()); CPPUNIT_ASSERT(e1->getStartNode()==e2->getStartNode()); CPPUNIT_ASSERT(e1->getEndNode()==v1[1]->getEndNode()); - CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode()); - CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode()); - 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° - 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()); - CPPUNIT_ASSERT_EQUAL(2,(int)v1.size()); - CPPUNIT_ASSERT_EQUAL(1,(int)v2.size()); - CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e2) && v1[0]->getDirection()); CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e2) && v2[0]->getDirection()); - CPPUNIT_ASSERT(e2->getStartNode()==v1[0]->getStartNode()); CPPUNIT_ASSERT(e1->getStartNode()==e2->getStartNode()); CPPUNIT_ASSERT(e1->getEndNode()==v1[1]->getEndNode()); - CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode()); - CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode()); - 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° - 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()); - CPPUNIT_ASSERT_EQUAL(2,(int)v1.size()); - CPPUNIT_ASSERT_EQUAL(1,(int)v2.size()); - CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e2) && v1[0]->getDirection()); CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e2) && v2[0]->getDirection()); - CPPUNIT_ASSERT(e2->getStartNode()==v1[0]->getStartNode()); CPPUNIT_ASSERT(e1->getStartNode()==e2->getStartNode()); CPPUNIT_ASSERT(e1->getEndNode()==v1[1]->getEndNode()); - CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode()); - CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode()); - 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° - 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()); - CPPUNIT_ASSERT_EQUAL(2,(int)v1.size()); - CPPUNIT_ASSERT_EQUAL(1,(int)v2.size()); - CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e2) && !v1[0]->getDirection()); CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e2) && v2[0]->getDirection()); - CPPUNIT_ASSERT(e2->getEndNode()==v1[0]->getStartNode()); CPPUNIT_ASSERT(e1->getStartNode()==e2->getEndNode()); CPPUNIT_ASSERT(e1->getEndNode()==v1[1]->getEndNode()); - CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode()); - CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode()); - CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode()); - e2->decrRef(); e1->decrRef(); - v1.clear(); v2.clear(); v3.clear(); - ComposedEdge::Delete(&v1); - ComposedEdge::Delete(&v2); -} - -/*! - * Here there is test of cases where between 2 edges intersects only in points not on edge. - */ -void QuadraticPlanarInterpTest::IntersectionPointOnlyUnitarySegSeg() -{ - // 0° - 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); - ComposedEdge& v2=*(new ComposedEdge); MergePoints v3; - CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2)); - CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations()); - CPPUNIT_ASSERT_EQUAL(2,(int)v1.size()); - CPPUNIT_ASSERT_EQUAL(2,(int)v2.size()); - CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode()); CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode()); - CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode()); - CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode()); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.4,(*v1[0]->getEndNode())[0],ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,(*v1[0]->getEndNode())[1],ADMISSIBLE_ERROR); - e2->decrRef(); e1->decrRef(); - v1.clear(); v2.clear(); v3.clear(); - // 90° - 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)); - CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations()); - CPPUNIT_ASSERT_EQUAL(2,(int)v1.size()); - CPPUNIT_ASSERT_EQUAL(2,(int)v2.size()); - CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode()); CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode()); - CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode()); - CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode()); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,(*v1[0]->getEndNode())[0],ADMISSIBLE_ERROR); - 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° - 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° - 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° - 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()); - CPPUNIT_ASSERT(v3.isStart1(0)); CPPUNIT_ASSERT(v3.isStart2(0)); - e2->decrRef(); e1->decrRef(); - v1.clear(); v2.clear(); v3.clear(); - //Test 2 - e1=new EdgeLin(0.,0.,1.,0.); e2=new EdgeLin(1.,1.,1.,0.); - CPPUNIT_ASSERT(!e1->intersectWith(e2,v3,v1,v2)); - CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations()); - CPPUNIT_ASSERT(v3.isEnd1(0)); CPPUNIT_ASSERT(v3.isEnd2(0)); - e2->decrRef(); e1->decrRef(); - v1.clear(); v2.clear(); v3.clear(); - //Test 3 - e1=new EdgeLin(0.,0.,1.,0.); e2=new EdgeLin(1.,0.,1.,1.); - CPPUNIT_ASSERT(!e1->intersectWith(e2,v3,v1,v2)); - CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations()); - CPPUNIT_ASSERT(v3.isEnd1(0)); CPPUNIT_ASSERT(v3.isStart2(0)); - e2->decrRef(); e1->decrRef(); - v1.clear(); v2.clear(); v3.clear(); - //Test 4 - e1=new EdgeLin(0.,0.,1.,1.); e2=new EdgeLin(1.,-1.,0.,0.); - CPPUNIT_ASSERT(!e1->intersectWith(e2,v3,v1,v2)); - CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations()); - CPPUNIT_ASSERT(v3.isStart1(0)); CPPUNIT_ASSERT(v3.isEnd2(0)); - e2->decrRef(); e1->decrRef(); - v1.clear(); v2.clear(); v3.clear(); - //Intersection extremity of one edge and inside of other edge. 2 End. - e1=new EdgeLin(0.,0.,1.,0.); - e2=new EdgeLin(0.5,1.,0.5,0.); - CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2)); - CPPUNIT_ASSERT_EQUAL(2,(int)v1.size()); - CPPUNIT_ASSERT_EQUAL(1,(int)v2.size()); - CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations()); - CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e2) && v2[0]->getDirection()); - CPPUNIT_ASSERT(v1[0]->getStartNode()==e1->getStartNode() && v1[0]->getEndNode()==e2->getEndNode() && v1[1]->getStartNode()==e2->getEndNode() && v1[1]->getEndNode()==e1->getEndNode()); - CPPUNIT_ASSERT(v1[0]->getDirection() && v1[1]->getDirection()); - e2->decrRef(); e1->decrRef(); - v1.clear(); v2.clear(); v3.clear(); - //Intersection extremity of one edge and inside of other edge. 2 Start. - e1=new EdgeLin(0.,0.,1.,0.); - e2=new EdgeLin(0.5,0.,0.5,1.); - CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2)); - CPPUNIT_ASSERT_EQUAL(2,(int)v1.size()); - CPPUNIT_ASSERT_EQUAL(1,(int)v2.size()); - CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations()); - CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e2) && v2[0]->getDirection()); - CPPUNIT_ASSERT(v1[0]->getStartNode()==e1->getStartNode() && v1[0]->getEndNode()==e2->getStartNode() && v1[1]->getStartNode()==e2->getStartNode() && v1[1]->getEndNode()==e1->getEndNode()); - CPPUNIT_ASSERT(v1[0]->getDirection() && v1[1]->getDirection()); - e2->decrRef(); e1->decrRef(); - v1.clear(); v2.clear(); v3.clear(); - //Intersection extremity of one edge and inside of other edge. 1 Start. - e1=new EdgeLin(0.5,0.,0.5,1.); - e2=new EdgeLin(0.,0.,1.,0.); - CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2)); - CPPUNIT_ASSERT_EQUAL(1,(int)v1.size()); - CPPUNIT_ASSERT_EQUAL(2,(int)v2.size()); - CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations()); - CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection()); - CPPUNIT_ASSERT(v2[0]->getStartNode()==e2->getStartNode() && v2[0]->getEndNode()==e1->getStartNode() && v2[1]->getStartNode()==e1->getStartNode() && v2[1]->getEndNode()==e2->getEndNode()); - CPPUNIT_ASSERT(v2[0]->getDirection() && v2[1]->getDirection()); - e2->decrRef(); e1->decrRef(); - v1.clear(); v2.clear(); v3.clear(); - //Intersection extremity of one edge and inside of other edge. 1 End. - e1=new EdgeLin(0.5,1.,0.5,0.); - e2=new EdgeLin(0.,0.,1.,0.); - CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2)); - CPPUNIT_ASSERT_EQUAL(1,(int)v1.size()); - CPPUNIT_ASSERT_EQUAL(2,(int)v2.size()); - CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations()); - CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection()); - CPPUNIT_ASSERT(v2[0]->getStartNode()==e2->getStartNode() && v2[0]->getEndNode()==e1->getEndNode() && v2[1]->getStartNode()==e1->getEndNode() && v2[1]->getEndNode()==e2->getEndNode()); - CPPUNIT_ASSERT(v2[0]->getDirection() && v2[1]->getDirection()); - e2->decrRef(); e1->decrRef(); - v1.clear(); v2.clear(); v3.clear(); - ComposedEdge::Delete(&v2); - ComposedEdge::Delete(&v1); -} diff --git a/src/INTERP_KERNEL/Geometric2D/Test/QuadraticPlanarInterpTest.hxx b/src/INTERP_KERNEL/Geometric2D/Test/QuadraticPlanarInterpTest.hxx deleted file mode 100644 index 8e95387bf..000000000 --- a/src/INTERP_KERNEL/Geometric2D/Test/QuadraticPlanarInterpTest.hxx +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef _QUADRATICPLANARINTERPTEST_HXX_ -#define _QUADRATICPLANARINTERPTEST_HXX_ - -#include - -namespace INTERP_KERNEL -{ - class Node; - class EdgeArcCircle; - class QuadraticPolygon; - - class QuadraticPlanarInterpTest : public CppUnit::TestFixture - { - CPPUNIT_TEST_SUITE( QuadraticPlanarInterpTest ); - CPPUNIT_TEST( ReadWriteInXfigElementary ); - CPPUNIT_TEST( ReadWriteInXfigGlobal ); - CPPUNIT_TEST( IntersectionBasics ); - CPPUNIT_TEST( EdgeLinUnitary ); - CPPUNIT_TEST( IntersectionEdgeOverlapUnitarySegSeg ); - CPPUNIT_TEST( IntersectionPointOnlyUnitarySegSeg ); - CPPUNIT_TEST( IntersectArcCircleBase ); - CPPUNIT_TEST( IntersectArcCircleFull ); - CPPUNIT_TEST( IntersectArcCircleSegumentBase ); - CPPUNIT_TEST( checkInOutDetection ); - CPPUNIT_TEST( checkAssemblingBases1 ); - CPPUNIT_TEST( checkAssemblingBases2 ); - CPPUNIT_TEST( checkPolygonsIntersection1 ); - CPPUNIT_TEST( checkAreasCalculations ); - CPPUNIT_TEST_SUITE_END(); - public: - void setUp(); - void tearDown(); - void cleanUp(); - // - void ReadWriteInXfigElementary(); - void ReadWriteInXfigGlobal(); - void IntersectionBasics(); - void EdgeLinUnitary(); - void IntersectionEdgeOverlapUnitarySegSeg(); - void IntersectionPointOnlyUnitarySegSeg(); - // - void IntersectArcCircleBase(); - void IntersectArcCircleFull(); - void IntersectArcCircleSegumentBase(); - // - void checkInOutDetection(); - // - void checkAssemblingBases1(); - void checkAssemblingBases2(); - // - void checkPolygonsIntersection1(); - void checkAreasCalculations(); - private: - EdgeArcCircle *buildArcOfCircle(const double *center, double radius, double alphaStart, double alphaEnd); - double btw2NodesAndACenter(const Node& n1, const Node& n2, const double *center); - void checkBasicsOfPolygons(QuadraticPolygon& pol1, QuadraticPolygon& pol2, bool checkDirection); - }; -} - -#endif diff --git a/src/INTERP_KERNEL/Geometric2D/Test/QuadraticPlanarInterpTest2.cxx b/src/INTERP_KERNEL/Geometric2D/Test/QuadraticPlanarInterpTest2.cxx deleted file mode 100644 index 75fc3bdec..000000000 --- a/src/INTERP_KERNEL/Geometric2D/Test/QuadraticPlanarInterpTest2.cxx +++ /dev/null @@ -1,641 +0,0 @@ -#include "QuadraticPlanarInterpTest.hxx" -#include "QuadraticPolygon.hxx" -#include "EdgeArcCircle.hxx" -#include "EdgeLin.hxx" - -#include -#include -#include - -using namespace std; -using namespace INTERP_KERNEL; - -static const double ADMISSIBLE_ERROR = 1.e-14; - -void QuadraticPlanarInterpTest::IntersectArcCircleBase() -{ - double center[2]={0.5,0.5}; - double radius=0.3; - EdgeArcCircle *e1=buildArcOfCircle(center,radius,M_PI/4.,M_PI/3.); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[0],center[0]+radius*cos(M_PI/3),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[1],center[0]+radius*cos(M_PI/4),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[2],center[1]+radius*sin(M_PI/4),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[3],center[1]+radius*sin(M_PI/3),ADMISSIBLE_ERROR); - e1->decrRef(); - // - e1=buildArcOfCircle(center,radius,M_PI/3.,M_PI/2.); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[0],center[0]+radius*cos(M_PI/2),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[1],center[0]+radius*cos(M_PI/3),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[2],center[1]+radius*sin(M_PI/3),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[3],center[1]+radius*sin(M_PI/2),ADMISSIBLE_ERROR); - e1->decrRef(); - // - e1=buildArcOfCircle(center,radius,M_PI/3.,3.*M_PI/4.); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[0],center[0]+radius*cos(3*M_PI/4),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[1],center[0]+radius*cos(M_PI/3),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[2],center[1]+radius*sin(3*M_PI/4),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[3],center[1]+radius*sin(M_PI/2),ADMISSIBLE_ERROR);//<< - e1->decrRef(); - // - e1=buildArcOfCircle(center,radius,3*M_PI/4,7*M_PI/8); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[0],center[0]+radius*cos(7*M_PI/8),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[1],center[0]+radius*cos(3*M_PI/4),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[2],center[1]+radius*sin(7*M_PI/8),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[3],center[1]+radius*sin(3*M_PI/4),ADMISSIBLE_ERROR); - e1->decrRef(); - // - e1=buildArcOfCircle(center,radius,7.*M_PI/8.,9.*M_PI/8.); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[0],center[0]+radius*cos(M_PI),ADMISSIBLE_ERROR);//<< - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[1],center[0]+radius*cos(7*M_PI/8),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[2],center[1]+radius*sin(9*M_PI/8),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[3],center[1]+radius*sin(7*M_PI/8),ADMISSIBLE_ERROR); - e1->decrRef(); - // - e1=buildArcOfCircle(center,radius,9.*M_PI/8.,11.*M_PI/8.); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[0],center[0]+radius*cos(9*M_PI/8),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[1],center[0]+radius*cos(11*M_PI/8),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[2],center[1]+radius*sin(11*M_PI/8),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[3],center[1]+radius*sin(9*M_PI/8),ADMISSIBLE_ERROR); - e1->decrRef(); - // - e1=buildArcOfCircle(center,radius,11.*M_PI/8.,7.*M_PI/4.); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[0],center[0]+radius*cos(11*M_PI/8),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[1],center[0]+radius*cos(7*M_PI/4),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[2],center[1]+radius*sin(3*M_PI/2),ADMISSIBLE_ERROR);//<< - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[3],center[1]+radius*sin(7*M_PI/4),ADMISSIBLE_ERROR); - e1->decrRef(); - // - e1=buildArcOfCircle(center,radius,7.*M_PI/4.,15.*M_PI/8.); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[0],center[0]+radius*cos(7*M_PI/4),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[1],center[0]+radius*cos(15*M_PI/8),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[2],center[1]+radius*sin(7*M_PI/4),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[3],center[1]+radius*sin(15*M_PI/8),ADMISSIBLE_ERROR); - e1->decrRef(); - // - e1=buildArcOfCircle(center,radius,-M_PI/8.,M_PI/4.); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[0],center[0]+radius*cos(M_PI/4),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[1],center[0]+radius*cos(0.),ADMISSIBLE_ERROR); //<< - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[2],center[1]+radius*sin(15*M_PI/8),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[3],center[1]+radius*sin(M_PI/4),ADMISSIBLE_ERROR); - e1->decrRef(); - // - // ArcCArcCIntersector - // - TypeOfLocInEdge where1,where2; - vector v4; - MergePoints v3; - EdgeArcCircle *e2; - ArcCArcCIntersector *intersector=0; - for(unsigned k=0;k<8;k++) - { - e1=buildArcOfCircle(center,radius,M_PI/4.+k*M_PI/4.,M_PI/3.+k*M_PI/4.); - e2=buildArcOfCircle(center,radius,M_PI/4.+k*M_PI/4.,M_PI/3.+k*M_PI/4.); - intersector=new ArcCArcCIntersector(*e1,*e2); - intersector->getPlacements(e2->getStartNode(),e2->getEndNode(),where1,where2,v3); - CPPUNIT_ASSERT(where1==START && where2==END); - delete intersector; v3.clear(); e2->decrRef(); - // - e2=buildArcOfCircle(center,radius,7*M_PI/24.+k*M_PI/4.,M_PI/3.+k*M_PI/4.); - intersector=new ArcCArcCIntersector(*e1,*e2); - intersector->getPlacements(e2->getStartNode(),e2->getEndNode(),where1,where2,v3); - CPPUNIT_ASSERT(where1==INSIDE && where2==END); - delete intersector; v3.clear(); e2->decrRef(); - // - e2=buildArcOfCircle(center,radius,M_PI/4.+k*M_PI/4.,7*M_PI/24.+k*M_PI/4.); - intersector=new ArcCArcCIntersector(*e1,*e2); - intersector->getPlacements(e2->getStartNode(),e2->getEndNode(),where1,where2,v3); - CPPUNIT_ASSERT(where1==START && where2==INSIDE); - delete intersector; v3.clear(); e2->decrRef(); - // - e2=buildArcOfCircle(center,radius,13.*M_PI/48.+k*M_PI/4.,15*M_PI/48.+k*M_PI/4.); - intersector=new ArcCArcCIntersector(*e1,*e2); - intersector->getPlacements(e2->getStartNode(),e2->getEndNode(),where1,where2,v3); - CPPUNIT_ASSERT(where1==INSIDE && where2==INSIDE); - delete intersector; v3.clear(); e2->decrRef(); - // - e2=buildArcOfCircle(center,radius,-M_PI/4.+k*M_PI/4.,M_PI/6.+k*M_PI/4.); - intersector=new ArcCArcCIntersector(*e1,*e2); - intersector->getPlacements(e2->getStartNode(),e2->getEndNode(),where1,where2,v3); - CPPUNIT_ASSERT(where1==OUT_BEFORE && where2==OUT_BEFORE); - delete intersector; v3.clear(); e2->decrRef(); - // - e2=buildArcOfCircle(center,radius,0+k*M_PI/4.,5*M_PI/6.+k*M_PI/4.); - intersector=new ArcCArcCIntersector(*e1,*e2); - intersector->getPlacements(e2->getStartNode(),e2->getEndNode(),where1,where2,v3); - CPPUNIT_ASSERT(where1==OUT_BEFORE && where2==OUT_AFTER); - delete intersector; v3.clear(); e2->decrRef(); - e1->decrRef(); - } - // Ok now let's see intersection only. 2 intersections R1 > R2 ; dist(circle1,circle2)>R1; Opposite order. - for(unsigned k=0;k<8;k++) - { - center[0]=0.; center[1]=0.; - double center2[2]; center2[0]=3.8*cos(k*M_PI/4.); center2[1]=3.8*sin(k*M_PI/4.); - e1=buildArcOfCircle(center,3.,(k-1)*M_PI/4.,(k+1)*M_PI/4.); - e2=buildArcOfCircle(center2,1.,M_PI+(k-1)*M_PI/4.,M_PI+(k+1)*M_PI/4.); - intersector=new ArcCArcCIntersector(*e1,*e2); - bool order; - bool obvious,areOverlapped; - intersector->areOverlappedOrOnlyColinears(0,obvious,areOverlapped); - CPPUNIT_ASSERT(!obvious && !areOverlapped); - CPPUNIT_ASSERT(intersector->intersect(0,v4,order,v3)); CPPUNIT_ASSERT(!order); - CPPUNIT_ASSERT_EQUAL(2,(int)v4.size()); CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations()); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getRadius(),Node::distanceBtw2Pt(e1->getCenter(),(*(v4[0]))),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[0]))),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getRadius(),Node::distanceBtw2Pt(e1->getCenter(),(*(v4[1]))),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[1]))),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT(!v4[0]->isEqual(*v4[1])); - CPPUNIT_ASSERT_DOUBLES_EQUAL(btw2NodesAndACenter(*v4[0],*v4[1],e1->getCenter()),0.35587863972199624,1e-10); - for(vector::iterator iter=v4.begin();iter!=v4.end();iter++) - (*iter)->decrRef(); - v4.clear(); v3.clear(); - delete intersector; e2->decrRef(); e1->decrRef(); - } - // Ok now let's see intersection only. 2 intersections R1 > R2 ; dist(circle1,circle2)>R1; Same order. - for(unsigned k=0;k<7;k++) - { - center[0]=0.; center[1]=0.; - double center2[2]; center2[0]=3.8*cos(k*M_PI/4.); center2[1]=3.8*sin(k*M_PI/4.); - e1=buildArcOfCircle(center,3.,(k-1)*M_PI/4.,(k+1)*M_PI/4.); - e2=buildArcOfCircle(center2,1.,M_PI+(k+1)*M_PI/4.,M_PI+(k-1)*M_PI/4.); - intersector=new ArcCArcCIntersector(*e1,*e2); - bool order; - bool obvious,areOverlapped; - intersector->areOverlappedOrOnlyColinears(0,obvious,areOverlapped); - CPPUNIT_ASSERT(!obvious && !areOverlapped); - CPPUNIT_ASSERT(intersector->intersect(0,v4,order,v3)); CPPUNIT_ASSERT(order); - CPPUNIT_ASSERT_EQUAL(2,(int)v4.size()); CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations()); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getRadius(),Node::distanceBtw2Pt(e1->getCenter(),(*(v4[0]))),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[0]))),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getRadius(),Node::distanceBtw2Pt(e1->getCenter(),(*(v4[1]))),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[1]))),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT(!v4[0]->isEqual(*v4[1])); - CPPUNIT_ASSERT_DOUBLES_EQUAL(btw2NodesAndACenter(*v4[0],*v4[1],e1->getCenter()),0.35587863972199624,1e-10); - for(vector::iterator iter=v4.begin();iter!=v4.end();iter++) - (*iter)->decrRef(); - v4.clear(); v3.clear(); - delete intersector; e2->decrRef(); e1->decrRef(); - } - // 2 intersections R1>R2 ; dist(circle1,circle2)areOverlappedOrOnlyColinears(0,obvious,areOverlapped); - CPPUNIT_ASSERT(!obvious && !areOverlapped); - CPPUNIT_ASSERT(intersector->intersect(0,v4,order,v3)); CPPUNIT_ASSERT(order); - CPPUNIT_ASSERT_EQUAL(2,(int)v4.size()); CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations()); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getRadius(),Node::distanceBtw2Pt(e1->getCenter(),(*(v4[0]))),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[0]))),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getRadius(),Node::distanceBtw2Pt(e1->getCenter(),(*(v4[1]))),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[1]))),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT(!v4[0]->isEqual(*v4[1])); - CPPUNIT_ASSERT_DOUBLES_EQUAL(btw2NodesAndACenter(*v4[0],*v4[1],e1->getCenter()),0.6793851523346941,1e-10); - for(vector::iterator iter=v4.begin();iter!=v4.end();iter++) - (*iter)->decrRef(); - v4.clear(); v3.clear(); - delete intersector; e2->decrRef(); e1->decrRef(); - } - // 2 intersections R1>R2 ; dist(circle1,circle2)areOverlappedOrOnlyColinears(0,obvious,areOverlapped); - CPPUNIT_ASSERT(!obvious && !areOverlapped); - CPPUNIT_ASSERT(intersector->intersect(0,v4,order,v3)); CPPUNIT_ASSERT(!order); - CPPUNIT_ASSERT_EQUAL(2,(int)v4.size()); CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations()); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getRadius(),Node::distanceBtw2Pt(e1->getCenter(),(*(v4[0]))),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[0]))),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getRadius(),Node::distanceBtw2Pt(e1->getCenter(),(*(v4[1]))),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[1]))),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT(!v4[0]->isEqual(*v4[1])); - CPPUNIT_ASSERT_DOUBLES_EQUAL(btw2NodesAndACenter(*v4[0],*v4[1],e1->getCenter()),0.6793851523346941,1e-10); - for(vector::iterator iter=v4.begin();iter!=v4.end();iter++) - (*iter)->decrRef(); - v4.clear(); v3.clear(); - delete intersector; e2->decrRef(); e1->decrRef(); - } - // Ok now let's see intersection only. 2 intersections R1 < R2 ; dist(circle1,circle2)>R2; Opposite order. - for(unsigned k=0;k<1;k++) - { - double center2[2]; center[0]=0.; center[1]=0.; - center2[0]=3.8*cos(k*M_PI/4.); center2[1]=3.8*sin(k*M_PI/4.); - e1=buildArcOfCircle(center,1.,(k-1)*M_PI/4.,(k+1)*M_PI/4.); - e2=buildArcOfCircle(center2,3.,M_PI+(k-1)*M_PI/4.,M_PI+(k+1)*M_PI/4.); - intersector=new ArcCArcCIntersector(*e1,*e2); - bool order; - bool obvious,areOverlapped; - intersector->areOverlappedOrOnlyColinears(0,obvious,areOverlapped); - CPPUNIT_ASSERT(!obvious && !areOverlapped); - CPPUNIT_ASSERT(intersector->intersect(0,v4,order,v3)); CPPUNIT_ASSERT(!order); - CPPUNIT_ASSERT_EQUAL(2,(int)v4.size()); CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations()); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getRadius(),Node::distanceBtw2Pt(e1->getCenter(),(*(v4[0]))),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[0]))),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getRadius(),Node::distanceBtw2Pt(e1->getCenter(),(*(v4[1]))),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[1]))),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT(!v4[0]->isEqual(*v4[1])); - CPPUNIT_ASSERT_DOUBLES_EQUAL(1.1195732971845034,btw2NodesAndACenter(*v4[0],*v4[1],e1->getCenter()),1e-10); - for(vector::iterator iter=v4.begin();iter!=v4.end();iter++) - (*iter)->decrRef(); - v4.clear(); v3.clear(); - delete intersector; e2->decrRef(); e1->decrRef(); - } - // Ok now let's see intersection only. 2 intersections R1 < R2 ; dist(circle1,circle2)>R2; same order. - for(unsigned k=0;k<8;k++) - { - double center2[2]; center[0]=0.; center[1]=0.; - center2[0]=3.8*cos(k*M_PI/4.); center2[1]=3.8*sin(k*M_PI/4.); - e1=buildArcOfCircle(center,1.,(k+1)*M_PI/4.,(k-1)*M_PI/4.); - e2=buildArcOfCircle(center2,3.,M_PI+(k-1)*M_PI/4.,M_PI+(k+1)*M_PI/4.); - intersector=new ArcCArcCIntersector(*e1,*e2); - bool order; - bool obvious,areOverlapped; - intersector->areOverlappedOrOnlyColinears(0,obvious,areOverlapped); - CPPUNIT_ASSERT(!obvious && !areOverlapped); - CPPUNIT_ASSERT(intersector->intersect(0,v4,order,v3)); CPPUNIT_ASSERT(order); - CPPUNIT_ASSERT_EQUAL(2,(int)v4.size()); CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations()); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getRadius(),Node::distanceBtw2Pt(e1->getCenter(),(*(v4[0]))),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[0]))),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getRadius(),Node::distanceBtw2Pt(e1->getCenter(),(*(v4[1]))),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[1]))),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT(!v4[0]->isEqual(*v4[1])); - CPPUNIT_ASSERT_DOUBLES_EQUAL(-1.1195732971845034,btw2NodesAndACenter(*v4[0],*v4[1],e1->getCenter()),1e-10); - for(vector::iterator iter=v4.begin();iter!=v4.end();iter++) - (*iter)->decrRef(); - v4.clear(); v3.clear(); - delete intersector; e2->decrRef(); e1->decrRef(); - } - // Ok now let's see intersection only. 2 intersections R1 < R2 ; dist(circle1,circle2)areOverlappedOrOnlyColinears(0,obvious,areOverlapped); - CPPUNIT_ASSERT(!obvious && !areOverlapped); - CPPUNIT_ASSERT(intersector->intersect(0,v4,order,v3)); CPPUNIT_ASSERT(order); - CPPUNIT_ASSERT_EQUAL(2,(int)v4.size()); CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations()); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getRadius(),Node::distanceBtw2Pt(e1->getCenter(),(*(v4[0]))),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[0]))),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getRadius(),Node::distanceBtw2Pt(e1->getCenter(),(*(v4[1]))),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[1]))),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT(!v4[0]->isEqual(*v4[1])); - CPPUNIT_ASSERT_DOUBLES_EQUAL(-3.0844420190512074,btw2NodesAndACenter(*v4[0],*v4[1],e1->getCenter()),1e-10); - for(vector::iterator iter=v4.begin();iter!=v4.end();iter++) - (*iter)->decrRef(); - v4.clear(); v3.clear(); - delete intersector; e2->decrRef(); e1->decrRef(); - } - // Ok now let's see intersection only. 2 intersections R1 < R2 ; dist(circle1,circle2)areOverlappedOrOnlyColinears(0,obvious,areOverlapped); - CPPUNIT_ASSERT(!obvious && !areOverlapped); - CPPUNIT_ASSERT(intersector->intersect(0,v4,order,v3)); CPPUNIT_ASSERT(!order); - CPPUNIT_ASSERT_EQUAL(2,(int)v4.size()); CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations()); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getRadius(),Node::distanceBtw2Pt(e1->getCenter(),(*(v4[0]))),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[0]))),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getRadius(),Node::distanceBtw2Pt(e1->getCenter(),(*(v4[1]))),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[1]))),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT(!v4[0]->isEqual(*v4[1])); - CPPUNIT_ASSERT_DOUBLES_EQUAL(-3.0844420190512074,btw2NodesAndACenter(*v4[0],*v4[1],e1->getCenter()),1e-10); - for(vector::iterator iter=v4.begin();iter!=v4.end();iter++) - (*iter)->decrRef(); - v4.clear(); v3.clear(); - delete intersector; e2->decrRef(); e1->decrRef(); - } - // Tangent intersection - for(unsigned k=0;k<8;k++) - { - double center2[2]; center[0]=0.; center[1]=0.; - center2[0]=4.*cos(k*M_PI/4.); center2[1]=4.*sin(k*M_PI/4.); - e1=buildArcOfCircle(center,1.,(k+1)*M_PI/4.,(k-1)*M_PI/4.); - e2=buildArcOfCircle(center2,3.,M_PI+(k-1)*M_PI/4.,M_PI+(k+1)*M_PI/4.); - intersector=new ArcCArcCIntersector(*e1,*e2); - bool order; - bool obvious,areOverlapped; - intersector->areOverlappedOrOnlyColinears(0,obvious,areOverlapped); - CPPUNIT_ASSERT(!obvious && !areOverlapped); - CPPUNIT_ASSERT(intersector->intersect(0,v4,order,v3)); CPPUNIT_ASSERT(order); // order has no sence here because v4.size() expected to 1 but for valgrind serenity test. - CPPUNIT_ASSERT_EQUAL(1,(int)v4.size()); CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations()); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getRadius(),Node::distanceBtw2Pt(e1->getCenter(),(*(v4[0]))),ADMISSIBLE_ERROR); - CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[0]))),ADMISSIBLE_ERROR); - for(vector::iterator iter=v4.begin();iter!=v4.end();iter++) - (*iter)->decrRef(); - v4.clear(); v4.clear(); - delete intersector; e2->decrRef(); e1->decrRef(); - } - // Extremities # 1 - for(unsigned k=0;k<8;k++) - { - center[0]=0.; center[1]=0.; - double center2[2]; center2[0]=3.8*cos(k*M_PI/4.); center2[1]=3.8*sin(k*M_PI/4.); - e1=buildArcOfCircle(center,3.,k*M_PI/4.-0.17793931986099812,k*M_PI/4.+0.17793931986099812); - e2=buildArcOfCircle(center2,1.,M_PI+k*M_PI/4.-0.55978664859225125,M_PI+k*M_PI/4.+0.55978664859225125); - intersector=new ArcCArcCIntersector(*e1,*e2); - bool order; - bool obvious,areOverlapped; - intersector->areOverlappedOrOnlyColinears(0,obvious,areOverlapped); - CPPUNIT_ASSERT(!obvious && !areOverlapped); - CPPUNIT_ASSERT(!intersector->intersect(0,v4,order,v3)); CPPUNIT_ASSERT_EQUAL(0,(int)v4.size()); CPPUNIT_ASSERT_EQUAL(2,(int)v3.getNumberOfAssociations()); - CPPUNIT_ASSERT(e1->getStartNode()==e2->getEndNode()); CPPUNIT_ASSERT(e2->getStartNode()==e1->getEndNode()); - v4.clear(); v3.clear(); - delete intersector; e2->decrRef(); e1->decrRef(); - } - for(unsigned k=0;k<8;k++) - { - center[0]=0.; center[1]=0.; - double center2[2]; center2[0]=3.8*cos(k*M_PI/4.); center2[1]=3.8*sin(k*M_PI/4.); - e1=buildArcOfCircle(center,3.,k*M_PI/4.-0.17793931986099812,k*M_PI/4.+0.17793931986099812); - e2=buildArcOfCircle(center2,1.,M_PI+k*M_PI/4.+0.55978664859225125,M_PI+k*M_PI/4.-0.55978664859225125); - intersector=new ArcCArcCIntersector(*e1,*e2); - bool order; - bool obvious,areOverlapped; - intersector->areOverlappedOrOnlyColinears(0,obvious,areOverlapped); - CPPUNIT_ASSERT(!obvious && !areOverlapped); - CPPUNIT_ASSERT(!intersector->intersect(0,v4,order,v3)); CPPUNIT_ASSERT_EQUAL(0,(int)v4.size()); CPPUNIT_ASSERT_EQUAL(2,(int)v3.getNumberOfAssociations()); - CPPUNIT_ASSERT(e1->getStartNode()==e2->getStartNode()); CPPUNIT_ASSERT(e2->getEndNode()==e1->getEndNode()); - v4.clear(); v3.clear(); - delete intersector; e2->decrRef(); e1->decrRef(); - } - // Extremities # 2 - for(unsigned k=0;k<8;k++) - { - center[0]=0.; center[1]=0.; - double center2[2]; center2[0]=3.8*cos(k*M_PI/4.); center2[1]=3.8*sin(k*M_PI/4.); - e1=buildArcOfCircle(center,3.,k*M_PI/4.-0.17793931986099812,k*M_PI/4.+0.17793931986099812); - e2=buildArcOfCircle(center2,1.,M_PI+k*M_PI/4.+0.55978664859225125,M_PI+k*M_PI/4.-0.7); - intersector=new ArcCArcCIntersector(*e1,*e2); - bool order; - bool obvious,areOverlapped; - intersector->areOverlappedOrOnlyColinears(0,obvious,areOverlapped); - CPPUNIT_ASSERT(!obvious && !areOverlapped); - CPPUNIT_ASSERT(intersector->intersect(0,v4,order,v3)); - CPPUNIT_ASSERT(order); CPPUNIT_ASSERT_EQUAL(1,(int)v4.size()); CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations()); - CPPUNIT_ASSERT(e1->getStartNode()==e2->getStartNode()); CPPUNIT_ASSERT(e1->getEndNode()==v4[0]); - v4[0]->decrRef(); - v4.clear(); v3.clear(); - delete intersector; e2->decrRef(); e1->decrRef(); - } - // Extremities # 3 - for(unsigned k=0;k<8;k++) - { - center[0]=0.; center[1]=0.; - double center2[2]; center2[0]=3.8*cos(k*M_PI/4.); center2[1]=3.8*sin(k*M_PI/4.); - e1=buildArcOfCircle(center,3.,k*M_PI/4.-0.17793931986099812,k*M_PI/4.+0.17793931986099812); - e2=buildArcOfCircle(center2,1.,M_PI+k*M_PI/4.+0.7,M_PI+k*M_PI/4.-0.7); - intersector=new ArcCArcCIntersector(*e1,*e2); - bool order; - bool obvious,areOverlapped; - intersector->areOverlappedOrOnlyColinears(0,obvious,areOverlapped); - CPPUNIT_ASSERT(!obvious && !areOverlapped); - CPPUNIT_ASSERT(intersector->intersect(0,v4,order,v3)); CPPUNIT_ASSERT(order); CPPUNIT_ASSERT_EQUAL(2,(int)v4.size()); CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations()); - CPPUNIT_ASSERT(e1->getStartNode()==v4[0]); CPPUNIT_ASSERT(e1->getEndNode()==v4[1]); - v4[0]->decrRef(); v4[1]->decrRef(); - v4.clear(); v3.clear(); - delete intersector; e2->decrRef(); e1->decrRef(); - } - // Extremities # 4 - for(unsigned k=0;k<8;k++) - { - center[0]=0.; center[1]=0.; - double center2[2]; center2[0]=3.8*cos(k*M_PI/4.); center2[1]=3.8*sin(k*M_PI/4.); - Node *nodeS=new Node(center[0]+3.*cos(k*M_PI/4.-0.17793931986099812),center[1]+3.*sin(k*M_PI/4.-0.17793931986099812)); - Node *nodeE=new Node(center[0]+3.*cos(k*M_PI/4.),center[1]+3.*sin(k*M_PI/4.)); - double angle=k*M_PI/4.-0.17793931986099812; - angle=angle>M_PI?angle-2.*M_PI:angle; - e1=new EdgeArcCircle(nodeS,nodeE,//Problem of precision 1e-14 to easily reached. - center,3.,angle,0.17793931986099812); - nodeS->decrRef(); nodeE->decrRef(); - e2=buildArcOfCircle(center2,1.,M_PI+k*M_PI/4.+0.7,M_PI+k*M_PI/4.-0.7); - intersector=new ArcCArcCIntersector(*e1,*e2); - bool order; - bool obvious,areOverlapped; - intersector->areOverlappedOrOnlyColinears(0,obvious,areOverlapped); - CPPUNIT_ASSERT(!obvious && !areOverlapped); - CPPUNIT_ASSERT(intersector->intersect(0,v4,order,v3)); CPPUNIT_ASSERT(order); CPPUNIT_ASSERT_EQUAL(1,(int)v4.size()); CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations()); - CPPUNIT_ASSERT(e1->getStartNode()==v4[0]); - v4[0]->decrRef(); - v4.clear(); v3.clear(); - delete intersector; e2->decrRef(); e1->decrRef(); - } - //Extremities # 5 - for(unsigned k=0;k<8;k++) - { - center[0]=0.; center[1]=0.; - double center2[2]; center2[0]=3.8*cos(k*M_PI/4.); center2[1]=3.8*sin(k*M_PI/4.); - Node *nodeS=new Node(center[0]+3.*cos(k*M_PI/4.-0.17793931986099812),center[1]+3.*sin(k*M_PI/4.-0.17793931986099812)); - Node *nodeE=new Node(center[0]+3.*cos(k*M_PI/4.)+0.5,center[1]+3.*sin(k*M_PI/4.)); - double angle=k*M_PI/4.-0.17793931986099812; - angle=angle>M_PI?angle-2.*M_PI:angle; - e1=new EdgeArcCircle(nodeS,nodeE,//Problem of precision 1e-14 to easily reached. - center,3.,angle,0.67793931986099812); - nodeS->decrRef(); nodeE->decrRef(); - e2=buildArcOfCircle(center2,1.,M_PI+k*M_PI/4.+0.7,M_PI+k*M_PI/4.-0.7); - intersector=new ArcCArcCIntersector(*e1,*e2); - bool order; - bool obvious,areOverlapped; - intersector->areOverlappedOrOnlyColinears(0,obvious,areOverlapped); - CPPUNIT_ASSERT(!obvious && !areOverlapped); - CPPUNIT_ASSERT(intersector->intersect(0,v4,order,v3)); CPPUNIT_ASSERT(order); CPPUNIT_ASSERT_EQUAL(2,(int)v4.size()); CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations()); - CPPUNIT_ASSERT(e1->getStartNode()==v4[0]); - v4[0]->decrRef(); v4[1]->decrRef(); - v4.clear(); v3.clear(); - delete intersector; e2->decrRef(); e1->decrRef(); - } -} - -void QuadraticPlanarInterpTest::IntersectArcCircleFull() -{ - double center1[2]; center1[0]=0.; center1[1]=0.; double radius1=3.; - double center2[2]; center2[0]=0.75; center2[1]=-2.6; double radius2=1.; - EdgeArcCircle *e1=buildArcOfCircle(center1,radius1,-M_PI/3.,4.*M_PI/3.); - EdgeArcCircle *e2=buildArcOfCircle(center2,radius2,0.,M_PI/2.); - MergePoints commonNode; - QuadraticPolygon pol1; QuadraticPolygon pol2; - QuadraticPolygon pol3; QuadraticPolygon pol4; - pol3.pushBack(e1); pol4.pushBack(e2); - CPPUNIT_ASSERT_DOUBLES_EQUAL(15.707963267948966,pol3.getPerimeterFast(),1e-6); - CPPUNIT_ASSERT_DOUBLES_EQUAL(1.5707963267949,pol4.getPerimeterFast(),1e-6); - CPPUNIT_ASSERT_DOUBLES_EQUAL(19.6648305849,pol3.getAreaFast(),1e-6); - CPPUNIT_ASSERT_DOUBLES_EQUAL(-1.8146018366,pol4.getAreaFast(),1e-6); - CPPUNIT_ASSERT(e1->intersectWith(e2,commonNode,pol1,pol2)); - CPPUNIT_ASSERT_EQUAL(2,pol1.size()); - CPPUNIT_ASSERT_EQUAL(2,pol2.size()); - CPPUNIT_ASSERT_DOUBLES_EQUAL(19.6648305849,pol1.getAreaFast(),1e-6); - CPPUNIT_ASSERT_DOUBLES_EQUAL(-1.8146018366,pol2.getAreaFast(),1e-6); - CPPUNIT_ASSERT_DOUBLES_EQUAL(15.707963267948966,pol1.getPerimeterFast(),1e-6); - CPPUNIT_ASSERT_DOUBLES_EQUAL(1.5707963267949,pol2.getPerimeterFast(),1e-6); - // - e1=buildArcOfCircle(center1,radius1,-2*M_PI/3.,-7.*M_PI/3.); - e2=buildArcOfCircle(center2,radius2,0.,M_PI/2.); - commonNode.clear(); - QuadraticPolygon pol5; QuadraticPolygon pol6; - QuadraticPolygon pol7; QuadraticPolygon pol8; - pol7.pushBack(e1); pol8.pushBack(e2); - CPPUNIT_ASSERT_DOUBLES_EQUAL(15.707963267948966,pol7.getPerimeterFast(),1e-6); - CPPUNIT_ASSERT_DOUBLES_EQUAL(1.5707963267949,pol8.getPerimeterFast(),1e-6); - CPPUNIT_ASSERT_DOUBLES_EQUAL(-19.6648305849,pol7.getAreaFast(),1e-6); - CPPUNIT_ASSERT_DOUBLES_EQUAL(-1.8146018366,pol8.getAreaFast(),1e-6); - CPPUNIT_ASSERT(e1->intersectWith(e2,commonNode,pol5,pol6)); - CPPUNIT_ASSERT_EQUAL(2,pol5.size()); - CPPUNIT_ASSERT_EQUAL(2,pol6.size()); - CPPUNIT_ASSERT_DOUBLES_EQUAL(-19.6648305849,pol5.getAreaFast(),1e-6); - CPPUNIT_ASSERT_DOUBLES_EQUAL(-1.8146018366,pol6.getAreaFast(),1e-6); - CPPUNIT_ASSERT_DOUBLES_EQUAL(15.707963267948966,pol5.getPerimeterFast(),1e-6); - CPPUNIT_ASSERT_DOUBLES_EQUAL(1.5707963267949,pol6.getPerimeterFast(),1e-6); - // - center2[0]=3.5; center2[1]=0.; - e1=buildArcOfCircle(center1,radius1,-2*M_PI/3.,-7.*M_PI/3.); - e2=buildArcOfCircle(center2,radius2,M_PI/2.,3*M_PI/2.); - commonNode.clear(); - QuadraticPolygon pol9; QuadraticPolygon pol10; - QuadraticPolygon pol11; QuadraticPolygon pol12; - pol11.pushBack(e1); pol12.pushBack(e2); - CPPUNIT_ASSERT_DOUBLES_EQUAL(15.707963267948966,pol11.getPerimeterFast(),1e-6); - CPPUNIT_ASSERT_DOUBLES_EQUAL(3.1415926535897931,pol12.getPerimeterFast(),1e-6); - CPPUNIT_ASSERT_DOUBLES_EQUAL(-19.6648305849,pol11.getAreaFast(),1e-6); - CPPUNIT_ASSERT_DOUBLES_EQUAL(1.5707963267949,pol12.getAreaFast(),1e-6); - CPPUNIT_ASSERT(e1->intersectWith(e2,commonNode,pol9,pol10)); - CPPUNIT_ASSERT_EQUAL(3,pol9.size()); - CPPUNIT_ASSERT_EQUAL(3,pol10.size()); - CPPUNIT_ASSERT_DOUBLES_EQUAL(15.707963267948966,pol9.getPerimeterFast(),1e-6); - CPPUNIT_ASSERT_DOUBLES_EQUAL(3.1415926535897931,pol10.getPerimeterFast(),1e-6); - CPPUNIT_ASSERT_DOUBLES_EQUAL(-19.6648305849,pol9.getAreaFast(),1e-6); - CPPUNIT_ASSERT_DOUBLES_EQUAL(1.5707963267949,pol10.getAreaFast(),1e-6); - // - center2[0]=0.; center2[1]=0.; radius2=radius1; - e1=buildArcOfCircle(center1,radius1,-2*M_PI/3.,-7.*M_PI/3.); - e2=buildArcOfCircle(center2,radius2,M_PI/3.,2*M_PI/3.); - commonNode.clear(); - QuadraticPolygon pol13; QuadraticPolygon pol14; - QuadraticPolygon pol15; QuadraticPolygon pol16; - pol15.pushBack(e1); pol16.pushBack(e2); - CPPUNIT_ASSERT_DOUBLES_EQUAL(15.707963267948966,pol15.getPerimeterFast(),1e-6); - CPPUNIT_ASSERT_DOUBLES_EQUAL(3.1415926535897931,pol16.getPerimeterFast(),1e-6); - CPPUNIT_ASSERT_DOUBLES_EQUAL(-19.6648305849,pol15.getAreaFast(),1e-6); - CPPUNIT_ASSERT_DOUBLES_EQUAL(8.6095032974147,pol16.getAreaFast(),1e-6); - CPPUNIT_ASSERT(e1->intersectWith(e2,commonNode,pol13,pol14)); - CPPUNIT_ASSERT_EQUAL(3,pol13.size()); - CPPUNIT_ASSERT_EQUAL(1,pol14.size()); - CPPUNIT_ASSERT_DOUBLES_EQUAL(15.707963267948966,pol13.getPerimeterFast(),1e-6); - CPPUNIT_ASSERT_DOUBLES_EQUAL(-19.6648305849,pol13.getAreaFast(),1e-6); - CPPUNIT_ASSERT_DOUBLES_EQUAL(3.1415926535897931,pol14.getPerimeterFast(),1e-6); - CPPUNIT_ASSERT_DOUBLES_EQUAL(8.6095032974147,pol14.getAreaFast(),1e-6); - // - e1=buildArcOfCircle(center1,radius1,-2*M_PI/3.,-7.*M_PI/3.); - e2=buildArcOfCircle(center2,radius2,2*M_PI/3.,M_PI/3.); - commonNode.clear(); - QuadraticPolygon pol17; QuadraticPolygon pol18; - QuadraticPolygon pol19; QuadraticPolygon pol20; - pol19.pushBack(e1); pol20.pushBack(e2); - CPPUNIT_ASSERT_DOUBLES_EQUAL(15.707963267948966,pol19.getPerimeterFast(),1e-6); - CPPUNIT_ASSERT_DOUBLES_EQUAL(3.1415926535897931,pol20.getPerimeterFast(),1e-6); - CPPUNIT_ASSERT_DOUBLES_EQUAL(-19.6648305849,pol19.getAreaFast(),1e-6); - CPPUNIT_ASSERT_DOUBLES_EQUAL(-8.6095032974147,pol20.getAreaFast(),1e-6); - CPPUNIT_ASSERT(e1->intersectWith(e2,commonNode,pol17,pol18)); - CPPUNIT_ASSERT_EQUAL(3,pol17.size()); - CPPUNIT_ASSERT_EQUAL(1,pol18.size()); - CPPUNIT_ASSERT_DOUBLES_EQUAL(15.707963267948966,pol17.getPerimeterFast(),1e-6); - CPPUNIT_ASSERT_DOUBLES_EQUAL(-19.6648305849,pol17.getAreaFast(),1e-6); - CPPUNIT_ASSERT_DOUBLES_EQUAL(3.1415926535897931,pol18.getPerimeterFast(),1e-6); - CPPUNIT_ASSERT_DOUBLES_EQUAL(-8.6095032974147,pol18.getAreaFast(),1e-6); - //no intersection #1 - center2[0]=4.277; center2[1]=-4.277; - e1=buildArcOfCircle(center1,radius1,-2*M_PI/3.,-7.*M_PI/3.); - e2=buildArcOfCircle(center2,radius2,M_PI/4.,5*M_PI/4.); - QuadraticPolygon polTemp1; QuadraticPolygon polTemp2; - CPPUNIT_ASSERT(!e1->intersectWith(e2,commonNode,polTemp1,polTemp2)); - e1->decrRef(); e2->decrRef(); - //no intersection #2 - center2[0]=1.; center2[1]=-1.; radius2=0.2; - e1=buildArcOfCircle(center1,radius1,-2*M_PI/3.,-7.*M_PI/3.); - e2=buildArcOfCircle(center2,radius2,M_PI/4.,5*M_PI/4.); - CPPUNIT_ASSERT(!e1->intersectWith(e2,commonNode,polTemp1,polTemp2)); - e1->decrRef(); e2->decrRef(); -} - -void QuadraticPlanarInterpTest::IntersectArcCircleSegumentBase() -{ - double center[2]={2.,2.}; - EdgeArcCircle *e1=buildArcOfCircle(center,2.3,M_PI/4.,5.*M_PI/4.); - EdgeLin *e2=new EdgeLin(-1.3,1.,3.,5.3); - Intersector *intersector=new ArcCSegIntersector(*e1,*e2); - bool order; - bool obvious,areOverlapped; - intersector->areOverlappedOrOnlyColinears(0,obvious,areOverlapped); - CPPUNIT_ASSERT(!obvious && !areOverlapped); - vector v4; - MergePoints v3; - CPPUNIT_ASSERT(intersector->intersect(0,v4,order,v3)); CPPUNIT_ASSERT(!order); CPPUNIT_ASSERT_EQUAL(2,(int)v4.size()); CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations()); - CPPUNIT_ASSERT_DOUBLES_EQUAL(2.,(*v4[0])[0],1e-10); CPPUNIT_ASSERT_DOUBLES_EQUAL(4.3,(*v4[0])[1],1e-10); - CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.3,(*v4[1])[0],1e-10); CPPUNIT_ASSERT_DOUBLES_EQUAL(2.,(*v4[1])[1],1e-10); - v4[0]->decrRef(); v4[1]->decrRef(); e2->decrRef(); v3.clear(); v4.clear(); delete intersector; - // - e2=new EdgeLin(3.,5.3,-1.3,1.); - intersector=new ArcCSegIntersector(*e1,*e2); - intersector->areOverlappedOrOnlyColinears(0,obvious,areOverlapped); CPPUNIT_ASSERT(!obvious && !areOverlapped); - CPPUNIT_ASSERT(intersector->intersect(0,v4,order,v3)); CPPUNIT_ASSERT(order); CPPUNIT_ASSERT_EQUAL(2,(int)v4.size()); CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations()); - CPPUNIT_ASSERT_DOUBLES_EQUAL(2.,(*v4[0])[0],1e-10); CPPUNIT_ASSERT_DOUBLES_EQUAL(4.3,(*v4[0])[1],1e-10); - CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.3,(*v4[1])[0],1e-10); CPPUNIT_ASSERT_DOUBLES_EQUAL(2.,(*v4[1])[1],1e-10); - v4[0]->decrRef(); v4[1]->decrRef(); e2->decrRef(); v3.clear(); v4.clear(); delete intersector; - // tangent intersection - e2=new EdgeLin(-1.,4.3,3.,4.3); - intersector=new ArcCSegIntersector(*e1,*e2); - intersector->areOverlappedOrOnlyColinears(0,obvious,areOverlapped); CPPUNIT_ASSERT(!obvious && !areOverlapped); - CPPUNIT_ASSERT(intersector->intersect(0,v4,order,v3)); CPPUNIT_ASSERT(order); CPPUNIT_ASSERT_EQUAL(1,(int)v4.size()); CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations()); - CPPUNIT_ASSERT_DOUBLES_EQUAL(2.,(*v4[0])[0],1e-10); CPPUNIT_ASSERT_DOUBLES_EQUAL(4.3,(*v4[0])[1],1e-10); - v4[0]->decrRef(); e2->decrRef(); v3.clear(); delete intersector; - // no intersection - e2=new EdgeLin(-2.,-2.,-1.,-3.); - intersector=new ArcCSegIntersector(*e1,*e2); - intersector->areOverlappedOrOnlyColinears(0,obvious,areOverlapped); CPPUNIT_ASSERT(obvious && !areOverlapped); - e2->decrRef(); v3.clear(); delete intersector; - // - e1->decrRef(); -} - -EdgeArcCircle *QuadraticPlanarInterpTest::buildArcOfCircle(const double *center, double radius, double alphaStart, double alphaEnd) -{ - double alphaM=(alphaStart+alphaEnd)/2; - return new EdgeArcCircle(center[0]+cos(alphaStart)*radius,center[1]+sin(alphaStart)*radius, - center[0]+cos(alphaM)*radius,center[1]+sin(alphaM)*radius, - center[0]+cos(alphaEnd)*radius,center[1]+sin(alphaEnd)*radius); -} - -double QuadraticPlanarInterpTest::btw2NodesAndACenter(const Node& n1, const Node& n2, const double *center) -{ - const double *n1Pt=n1; - const double *n2Pt=n2; - double tmp1[2],tmp2[2]; - tmp1[0]=n1Pt[0]-center[0]; tmp1[1]=n1Pt[1]-center[1]; - tmp2[0]=n2Pt[0]-center[0]; tmp2[1]=n2Pt[1]-center[1]; - double distTmp1=sqrt(tmp1[0]*tmp1[0]+tmp1[1]*tmp1[1]); - double distTmp2=sqrt(tmp2[0]*tmp2[0]+tmp2[1]*tmp2[1]); - double ret=acos((tmp1[0]*tmp2[0]+tmp1[1]*tmp2[1])/(distTmp1*distTmp2)); - if(tmp1[0]*tmp2[1]-tmp1[1]*tmp2[0]<0) - ret=-ret; - return ret; -} diff --git a/src/INTERP_KERNEL/Geometric2D/Test/QuadraticPlanarInterpTest3.cxx b/src/INTERP_KERNEL/Geometric2D/Test/QuadraticPlanarInterpTest3.cxx deleted file mode 100644 index 1b3f93bbe..000000000 --- a/src/INTERP_KERNEL/Geometric2D/Test/QuadraticPlanarInterpTest3.cxx +++ /dev/null @@ -1,300 +0,0 @@ -#include "QuadraticPlanarInterpTest.hxx" -#include "QuadraticPolygon.hxx" -#include "ElementaryEdge.hxx" -#include "EdgeArcCircle.hxx" -#include "EdgeLin.hxx" - -#include -#include -#include - -using namespace std; -using namespace INTERP_KERNEL; - - -void QuadraticPlanarInterpTest::checkInOutDetection() -{ - Node *n1=new Node(0.,0.); - Node *n2=new Node(1.,0.); - Node *n3=new Node(0.5,1.); - EdgeLin *e1=new EdgeLin(n1,n2); - EdgeLin *e2=new EdgeLin(n2,n3); - EdgeLin *e3=new EdgeLin(n3,n1); - ComposedEdge *tri=new ComposedEdge; - tri->pushBack(e1); tri->pushBack(e2); tri->pushBack(e3); - // - Node *where=new Node(0.4,0.1); - CPPUNIT_ASSERT(tri->isInOrOut(where)); where->decrRef(); - where=new Node(-0.1,1.); - CPPUNIT_ASSERT(!tri->isInOrOut(where)); where->decrRef(); - where=new Node(0.6,-0.1); - CPPUNIT_ASSERT(!tri->isInOrOut(where)); where->decrRef(); - //Clean-up - n1->decrRef(); n2->decrRef(); n3->decrRef(); - ComposedEdge::Delete(tri); -} - -/*! - * Check Iterators mechanism. - */ -void QuadraticPlanarInterpTest::checkAssemblingBases1() -{ - Node *n1=new Node(0.,0.); - Node *n2=new Node(0.1,0.); EdgeLin *e1_2=new EdgeLin(n1,n2); - Node *n3=new Node(0.2,0.); EdgeLin *e2_3=new EdgeLin(n2,n3); - Node *n4=new Node(0.3,0.); EdgeLin *e3_4=new EdgeLin(n3,n4); - Node *n5=new Node(0.4,0.); EdgeLin *e4_5=new EdgeLin(n4,n5); - Node *n6=new Node(0.5,0.); EdgeLin *e5_6=new EdgeLin(n5,n6); - Node *n7=new Node(0.6,0.); EdgeLin *e6_7=new EdgeLin(n6,n7); - Node *n8=new Node(0.7,0.); EdgeLin *e7_8=new EdgeLin(n7,n8); - Node *n9=new Node(0.8,0.); EdgeLin *e8_9=new EdgeLin(n8,n9); - Node *n10=new Node(0.9,0.); EdgeLin *e9_10=new EdgeLin(n9,n10); - Node *n11=new Node(1.,0.); EdgeLin *e10_11=new EdgeLin(n10,n11); - Node *n12=new Node(0.5,1.); EdgeLin *e11_12=new EdgeLin(n11,n12); - EdgeLin *e12_1=new EdgeLin(n12,n1); - //Only one level - e1_2->incrRef(); e2_3->incrRef(); e3_4->incrRef(); e4_5->incrRef(); e5_6->incrRef(); e6_7->incrRef(); - e7_8->incrRef(); e8_9->incrRef(); e9_10->incrRef(); e10_11->incrRef(); e11_12->incrRef(); e12_1->incrRef(); - ComposedEdge *c=new ComposedEdge; - c->pushBack(e1_2); c->pushBack(e2_3); c->pushBack(e3_4); c->pushBack(e4_5); c->pushBack(e5_6); c->pushBack(e6_7); - c->pushBack(e7_8); c->pushBack(e8_9); c->pushBack(e9_10); c->pushBack(e10_11); c->pushBack(e11_12); c->pushBack(e12_1); - CPPUNIT_ASSERT_EQUAL(12,c->recursiveSize()); - IteratorOnComposedEdge it(c); - CPPUNIT_ASSERT(it.current()->getPtr()==e1_2); CPPUNIT_ASSERT(!it.finished()); - it.next(); CPPUNIT_ASSERT(it.current()->getPtr()==e2_3); CPPUNIT_ASSERT(!it.finished()); - it.next(); it.next(); CPPUNIT_ASSERT(it.current()->getPtr()==e4_5); CPPUNIT_ASSERT(!it.finished()); - it.previousLoop(); CPPUNIT_ASSERT(it.current()->getPtr()==e3_4); CPPUNIT_ASSERT(!it.finished()); - it.previousLoop(); CPPUNIT_ASSERT(it.current()->getPtr()==e2_3); CPPUNIT_ASSERT(!it.finished()); - it.previousLoop(); CPPUNIT_ASSERT(it.current()->getPtr()==e1_2); CPPUNIT_ASSERT(!it.finished()); - it.previousLoop(); CPPUNIT_ASSERT(it.current()->getPtr()==e12_1); CPPUNIT_ASSERT(!it.finished()); - it.next(); CPPUNIT_ASSERT(it.finished()); - it.first(); CPPUNIT_ASSERT(it.current()->getPtr()==e1_2); CPPUNIT_ASSERT(!it.finished()); - it.previousLoop(); CPPUNIT_ASSERT(it.current()->getPtr()==e12_1); CPPUNIT_ASSERT(!it.finished()); - it.nextLoop(); CPPUNIT_ASSERT(it.current()->getPtr()==e1_2); CPPUNIT_ASSERT(!it.finished()); - it.last(); CPPUNIT_ASSERT(it.current()->getPtr()==e12_1); CPPUNIT_ASSERT(!it.finished()); - //Multi-Level - ComposedEdge::Delete(c); - //(e1_2, (e2_3,(e3_4, e4_5, e5_6, e6_7, (e7_8, e8_9 ), ( e9_10 , e10_11 ), e11_12 ),e12_1 ) ) - e1_2->incrRef(); e2_3->incrRef(); e3_4->incrRef(); e4_5->incrRef(); e5_6->incrRef(); e6_7->incrRef(); - e7_8->incrRef(); e8_9->incrRef(); e9_10->incrRef(); e10_11->incrRef(); e11_12->incrRef(); e12_1->incrRef(); - ComposedEdge *c2_2_4=new ComposedEdge; c2_2_4->pushBack(e7_8); c2_2_4->pushBack(e8_9); - ComposedEdge *c2_2_5=new ComposedEdge; c2_2_5->pushBack(e9_10); c2_2_5->pushBack(e10_11); - ComposedEdge *c2_2=new ComposedEdge; c2_2->pushBack(e3_4); c2_2->pushBack(e4_5); c2_2->pushBack(e5_6); c2_2->pushBack(e6_7); c2_2->pushBack(c2_2_4); c2_2->pushBack(c2_2_5); c2_2->pushBack(e11_12); - ComposedEdge *c2=new ComposedEdge; c2->pushBack(e2_3); c2->pushBack(c2_2); c2->pushBack(e12_1); - c=new ComposedEdge; c->pushBack(e1_2); c->pushBack(c2); CPPUNIT_ASSERT_EQUAL(12,c->recursiveSize()); - IteratorOnComposedEdge it2(c); - CPPUNIT_ASSERT(it2.current()->getPtr()==e1_2); - it2.next(); CPPUNIT_ASSERT(it2.current()->getPtr()==e2_3); CPPUNIT_ASSERT(!it2.finished()); - it2.next(); CPPUNIT_ASSERT(it2.current()->getPtr()==e3_4); CPPUNIT_ASSERT(!it2.finished()); - it2.next(); CPPUNIT_ASSERT(it2.current()->getPtr()==e4_5); CPPUNIT_ASSERT(!it2.finished()); - it2.previousLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e3_4); CPPUNIT_ASSERT(!it2.finished()); - it2.previousLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e2_3); CPPUNIT_ASSERT(!it2.finished()); - it2.previousLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e1_2); CPPUNIT_ASSERT(!it2.finished()); - it2.previousLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e12_1); CPPUNIT_ASSERT(!it2.finished()); - it2.next(); CPPUNIT_ASSERT(it2.finished()); - it2.first(); CPPUNIT_ASSERT(it2.current()->getPtr()==e1_2); CPPUNIT_ASSERT(!it2.finished()); - it2.previousLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e12_1); CPPUNIT_ASSERT(!it2.finished()); - it2.nextLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e1_2); CPPUNIT_ASSERT(!it2.finished()); - it2.last(); CPPUNIT_ASSERT(it2.current()->getPtr()==e12_1); CPPUNIT_ASSERT(!it2.finished()); - it2.first(); CPPUNIT_ASSERT(it2.current()->getPtr()==e1_2); CPPUNIT_ASSERT(!it2.finished()); - it2.nextLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e2_3); CPPUNIT_ASSERT(!it2.finished()); - it2.nextLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e3_4); CPPUNIT_ASSERT(!it2.finished()); - it2.nextLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e4_5); CPPUNIT_ASSERT(!it2.finished()); - // substitutions. - it2.first(); CPPUNIT_ASSERT(it2.current()->getPtr()==e1_2); CPPUNIT_ASSERT(!it2.finished()); - ElementaryEdge *&tmp=it2.current(); CPPUNIT_ASSERT(it2.current()->getPtr()==e1_2); CPPUNIT_ASSERT(!it2.finished()); - ComposedEdge *c1=new ComposedEdge; Node *n1_bis=new Node(0.,0.05); EdgeLin *e1_1bis=new EdgeLin(n1,n1_bis); EdgeLin *e1bis_2=new EdgeLin(n1_bis,n2); e1_1bis->incrRef(); e1bis_2->incrRef(); - c1->pushBack(e1_1bis); c1->pushBack(e1bis_2); delete tmp; tmp=(ElementaryEdge *)c1; CPPUNIT_ASSERT_EQUAL(13,c->recursiveSize()); - CPPUNIT_ASSERT(it2.current()->getPtr()==e1_1bis); CPPUNIT_ASSERT(!it2.finished());// here testing capability of Iterator.'current' method to deal with change of hierarchy. - it2.next(); CPPUNIT_ASSERT(it2.current()->getPtr()==e1bis_2); CPPUNIT_ASSERT(!it2.finished()); - it2.next(); CPPUNIT_ASSERT(it2.current()->getPtr()==e2_3); CPPUNIT_ASSERT(!it2.finished()); - it2.previousLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e1bis_2); CPPUNIT_ASSERT(!it2.finished()); - it2.previousLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e1_1bis); CPPUNIT_ASSERT(!it2.finished()); - it2.previousLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e12_1); CPPUNIT_ASSERT(!it2.finished()); - it2.previousLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e11_12); CPPUNIT_ASSERT(!it2.finished()); - it2.previousLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e10_11); CPPUNIT_ASSERT(!it2.finished()); - it2.previousLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e9_10); CPPUNIT_ASSERT(!it2.finished()); - it2.previousLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e8_9); CPPUNIT_ASSERT(!it2.finished()); - it2.previousLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e7_8); CPPUNIT_ASSERT(!it2.finished()); - it2.previousLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e6_7); CPPUNIT_ASSERT(!it2.finished()); - it2.previousLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e5_6); CPPUNIT_ASSERT(!it2.finished()); - it2.previousLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e4_5); CPPUNIT_ASSERT(!it2.finished()); - it2.previousLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e3_4); CPPUNIT_ASSERT(!it2.finished()); - it2.previousLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e2_3); CPPUNIT_ASSERT(!it2.finished()); - it2.previousLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e1bis_2); CPPUNIT_ASSERT(!it2.finished()); - it2.previousLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e1_1bis); CPPUNIT_ASSERT(!it2.finished()); - it2.previousLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e12_1); CPPUNIT_ASSERT(!it2.finished()); - //go forward - it2.nextLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e1_1bis); CPPUNIT_ASSERT(!it2.finished()); - it2.nextLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e1bis_2); CPPUNIT_ASSERT(!it2.finished()); - it2.nextLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e2_3); CPPUNIT_ASSERT(!it2.finished()); - it2.nextLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e3_4); CPPUNIT_ASSERT(!it2.finished()); - it2.nextLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e4_5); CPPUNIT_ASSERT(!it2.finished()); - it2.nextLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e5_6); CPPUNIT_ASSERT(!it2.finished()); - it2.nextLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e6_7); CPPUNIT_ASSERT(!it2.finished()); - it2.nextLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e7_8); CPPUNIT_ASSERT(!it2.finished()); - it2.nextLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e8_9); CPPUNIT_ASSERT(!it2.finished()); - it2.nextLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e9_10); CPPUNIT_ASSERT(!it2.finished()); - it2.nextLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e10_11); CPPUNIT_ASSERT(!it2.finished()); - it2.nextLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e11_12); CPPUNIT_ASSERT(!it2.finished()); - it2.nextLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e12_1); CPPUNIT_ASSERT(!it2.finished()); - it2.nextLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e1_1bis); CPPUNIT_ASSERT(!it2.finished()); - ComposedEdge::Delete(c); - //clean-up - e1_1bis->decrRef(); e1bis_2->decrRef(); - e1_2->decrRef(); e2_3->decrRef(); e3_4->decrRef(); e4_5->decrRef(); e5_6->decrRef(); e6_7->decrRef(); - e7_8->decrRef(); e8_9->decrRef(); e9_10->decrRef(); e10_11->decrRef(); e11_12->decrRef(); e12_1->decrRef(); - n1_bis->decrRef(); - n1->decrRef(); n2->decrRef(); n3->decrRef(); n4->decrRef(); n5->decrRef(); n6->decrRef(); - n7->decrRef(); n8->decrRef(); n9->decrRef(); n10->decrRef(); n11->decrRef(); n12->decrRef(); -} - -/*! - * Check splitting of 2 polygons. After this operation, all ElementaryEdge are either in/out/on. - */ -void QuadraticPlanarInterpTest::checkAssemblingBases2() -{ - //The "most" basic test1 - Node *n1=new Node(0.,0.); Node *n4=new Node(0.,-0.3); - Node *n2=new Node(1.,0.); Node *n5=new Node(1.,-0.3); - Node *n3=new Node(0.5,1.); Node *n6=new Node(0.5,0.7); - EdgeLin *e1_2=new EdgeLin(n1,n2); EdgeLin *e4_5=new EdgeLin(n4,n5); - EdgeLin *e2_3=new EdgeLin(n2,n3); EdgeLin *e5_6=new EdgeLin(n5,n6); - EdgeLin *e3_1=new EdgeLin(n3,n1); EdgeLin *e6_4=new EdgeLin(n6,n4); - // - e1_2->incrRef(); e2_3->incrRef(); e3_1->incrRef(); e4_5->incrRef(); e5_6->incrRef(); e6_4->incrRef(); - QuadraticPolygon pol1; pol1.pushBack(e1_2); pol1.pushBack(e2_3); pol1.pushBack(e3_1); - QuadraticPolygon pol2; pol2.pushBack(e4_5); pol2.pushBack(e5_6); pol2.pushBack(e6_4); - QuadraticPolygon cpyPol1(pol1); int nbOfSplits=0; - cpyPol1.splitPolygonsEachOther(pol1,pol2,nbOfSplits); - CPPUNIT_ASSERT_EQUAL(5,pol1.recursiveSize()); - CPPUNIT_ASSERT_EQUAL(5,pol2.recursiveSize());CPPUNIT_ASSERT_EQUAL(15,nbOfSplits); - checkBasicsOfPolygons(pol1,pol2,true); - CPPUNIT_ASSERT((*pol2[1])[0]->getEndNode()==(*(*pol1[0])[0])[1]->getEndNode()); - CPPUNIT_ASSERT((*pol2[1])[0]->getEndNode()->getLoc()==ON_1); - CPPUNIT_ASSERT((*pol2[2])[0]->getEndNode()==(*(*pol1[0])[0])[0]->getEndNode()); - CPPUNIT_ASSERT((*pol2[2])[0]->getEndNode()->getLoc()==ON_1); - cpyPol1.performLocatingOperation(pol2); - ElementaryEdge *tmp=dynamic_cast(pol2[0]); CPPUNIT_ASSERT(tmp); CPPUNIT_ASSERT(tmp->getPtr()==e4_5); - CPPUNIT_ASSERT(tmp->getLoc()==FULL_OUT_1); - CPPUNIT_ASSERT(tmp->getLoc()==FULL_OUT_1); - tmp=dynamic_cast((*pol2[1])[0]); CPPUNIT_ASSERT(tmp); - CPPUNIT_ASSERT(tmp->getLoc()==FULL_OUT_1); - tmp=dynamic_cast((*pol2[1])[1]); CPPUNIT_ASSERT(tmp); - CPPUNIT_ASSERT(tmp->getLoc()==FULL_IN_1); - tmp=dynamic_cast((*pol2[2])[0]); CPPUNIT_ASSERT(tmp); - CPPUNIT_ASSERT(tmp->getLoc()==FULL_IN_1); - tmp=dynamic_cast((*pol2[2])[1]); CPPUNIT_ASSERT(tmp); - CPPUNIT_ASSERT(tmp->getLoc()==FULL_OUT_1); - //clean-up for test1 - e1_2->decrRef(); e2_3->decrRef(); e3_1->decrRef(); e4_5->decrRef(); e5_6->decrRef(); e6_4->decrRef(); - n1->decrRef(); n2->decrRef(); n3->decrRef(); n4->decrRef(); n5->decrRef(); n6->decrRef(); - - //Deeper test some extremities of pol2 are on edges of pol1. - - n1=new Node(0.,0.); n4=new Node(1.5,-0.5); - n2=new Node(1.,0.); n5=new Node(0.5,0.); - n3=new Node(0.5,1.); n6=new Node(0.75,0.5); Node *n7=new Node(2.,0.5); - e1_2=new EdgeLin(n1,n2); e2_3=new EdgeLin(n2,n3); e3_1=new EdgeLin(n3,n1); - EdgeLin *e5_4=new EdgeLin(n5,n4); EdgeLin *e4_7=new EdgeLin(n4,n7); EdgeLin *e7_6=new EdgeLin(n7,n6); EdgeLin *e6_5=new EdgeLin(n6,n5); - // - e1_2->incrRef(); e2_3->incrRef(); e3_1->incrRef(); e5_4->incrRef(); e4_7->incrRef(); e7_6->incrRef(); e6_5->incrRef(); - QuadraticPolygon pol3; pol3.pushBack(e1_2); pol3.pushBack(e2_3); pol3.pushBack(e3_1); - QuadraticPolygon pol4; pol4.pushBack(e5_4); pol4.pushBack(e4_7); pol4.pushBack(e7_6); pol4.pushBack(e6_5); - QuadraticPolygon cpyPol3(pol3); nbOfSplits=0; - cpyPol3.splitPolygonsEachOther(pol3,pol4,nbOfSplits); - CPPUNIT_ASSERT_EQUAL(5,pol3.recursiveSize()); - CPPUNIT_ASSERT_EQUAL(4,pol4.recursiveSize());CPPUNIT_ASSERT_EQUAL(16,nbOfSplits); - checkBasicsOfPolygons(pol3,pol4,true); - CPPUNIT_ASSERT(pol4[0]->getStartNode()==(*pol3[0])[0]->getEndNode()); CPPUNIT_ASSERT(pol4[0]->getStartNode()==n5); - CPPUNIT_ASSERT(n5->getLoc()==ON_LIM_1); - CPPUNIT_ASSERT(pol4[2]->getEndNode()==(*pol3[1])[0]->getEndNode()); CPPUNIT_ASSERT(pol4[2]->getEndNode()==n6); - CPPUNIT_ASSERT(n6->getLoc()==ON_LIM_1); - cpyPol3.performLocatingOperation(pol4); - tmp=dynamic_cast(pol4[1]); CPPUNIT_ASSERT(tmp); CPPUNIT_ASSERT(tmp->getPtr()==e4_7); - CPPUNIT_ASSERT(tmp->getLoc()==FULL_OUT_1); - tmp=dynamic_cast(pol4[3]); CPPUNIT_ASSERT(tmp); CPPUNIT_ASSERT(tmp->getPtr()==e6_5); - tmp=dynamic_cast(pol4[0]); CPPUNIT_ASSERT(tmp); CPPUNIT_ASSERT(tmp->getPtr()==e5_4); - CPPUNIT_ASSERT(tmp->getLoc()==FULL_OUT_1); - tmp=dynamic_cast(pol4[2]); CPPUNIT_ASSERT(tmp); CPPUNIT_ASSERT(tmp->getPtr()==e7_6); - CPPUNIT_ASSERT(tmp->getLoc()==FULL_OUT_1); - tmp=dynamic_cast(pol4[3]); CPPUNIT_ASSERT(tmp); CPPUNIT_ASSERT(tmp->getPtr()==e6_5); - CPPUNIT_ASSERT(tmp->getLoc()==FULL_IN_1); - //clean-up for test2 - e1_2->decrRef(); e2_3->decrRef(); e3_1->decrRef(); e5_4->decrRef(); e4_7->decrRef(); e7_6->decrRef(); e6_5->decrRef(); - n1->decrRef(); n2->decrRef(); n3->decrRef(); n4->decrRef(); n5->decrRef(); n6->decrRef(); n7->decrRef(); - - //Test with one edge of pol2 is included in pol1. - - n1=new Node(0.,0.); n4=new Node(-0.5,0.); - n2=new Node(1.,0.); n5=new Node(0.,-1.); - n3=new Node(0.5,1.); n6=new Node(0.5,0.); - e1_2=new EdgeLin(n1,n2); e2_3=new EdgeLin(n2,n3); e3_1=new EdgeLin(n3,n1); - e4_5=new EdgeLin(n4,n5); e5_6=new EdgeLin(n5,n6); e6_4=new EdgeLin(n6,n4); - e1_2->incrRef(); e2_3->incrRef(); e3_1->incrRef(); e4_5->incrRef(); e5_6->incrRef(); e6_4->incrRef(); - QuadraticPolygon pol5; pol5.pushBack(e1_2); pol5.pushBack(e2_3); pol5.pushBack(e3_1); - QuadraticPolygon pol6; pol6.pushBack(e4_5); pol6.pushBack(e5_6); pol6.pushBack(e6_4); - QuadraticPolygon cpyPol5(pol5); nbOfSplits=0; - cpyPol5.splitPolygonsEachOther(pol5,pol6,nbOfSplits); - CPPUNIT_ASSERT_EQUAL(4,pol5.recursiveSize()); - CPPUNIT_ASSERT_EQUAL(4,pol6.recursiveSize()); CPPUNIT_ASSERT_EQUAL(13,nbOfSplits); - checkBasicsOfPolygons(pol5,pol6,false); - CPPUNIT_ASSERT((*pol6[2])[0]->getStartNode()==(*pol5[0])[0]->getEndNode()); CPPUNIT_ASSERT((*pol6[2])[0]->getStartNode()==n6); - CPPUNIT_ASSERT(n6->getLoc()==ON_LIM_1); - CPPUNIT_ASSERT((*pol6[2])[0]->getEndNode()==(*pol5[0])[0]->getStartNode()); CPPUNIT_ASSERT((*pol5[0])[0]->getStartNode()==n1); - CPPUNIT_ASSERT(n1->getLoc()==ON_LIM_1); - cpyPol5.performLocatingOperation(pol6); - tmp=dynamic_cast(pol6[0]); CPPUNIT_ASSERT(tmp); CPPUNIT_ASSERT(tmp->getPtr()==e4_5); - CPPUNIT_ASSERT(tmp->getLoc()==FULL_OUT_1); - tmp=dynamic_cast(pol6[1]); CPPUNIT_ASSERT(tmp); CPPUNIT_ASSERT(tmp->getPtr()==e5_6); - CPPUNIT_ASSERT(tmp->getLoc()==FULL_OUT_1); - tmp=dynamic_cast((*pol6[2])[0]); CPPUNIT_ASSERT(tmp); - CPPUNIT_ASSERT(tmp->getLoc()==FULL_ON_1); - tmp=dynamic_cast((*pol6[2])[1]); CPPUNIT_ASSERT(tmp); - CPPUNIT_ASSERT(tmp->getLoc()==FULL_OUT_1); - //clean-up test3 - e1_2->decrRef(); e2_3->decrRef(); e3_1->decrRef(); e4_5->decrRef(); e5_6->decrRef(); e6_4->decrRef(); - n1->decrRef(); n2->decrRef(); n3->decrRef(); n4->decrRef(); n5->decrRef(); n6->decrRef(); - - //Test of full overlapped polygons. - - n1=new Node(0.,0.); n4=new Node(0.,0.); - n2=new Node(1.,0.); n5=new Node(1.,0.); - n3=new Node(0.5,1.); n6=new Node(0.5,1.); - e1_2=new EdgeLin(n1,n2); e2_3=new EdgeLin(n2,n3); e3_1=new EdgeLin(n3,n1); - e4_5=new EdgeLin(n4,n5); e5_6=new EdgeLin(n5,n6); e6_4=new EdgeLin(n6,n4); - e1_2->incrRef(); e2_3->incrRef(); e3_1->incrRef(); e4_5->incrRef(); e5_6->incrRef(); e6_4->incrRef(); - QuadraticPolygon pol7; pol7.pushBack(e1_2); pol7.pushBack(e2_3); pol7.pushBack(e3_1); - QuadraticPolygon pol8; pol8.pushBack(e4_5); pol8.pushBack(e5_6); pol8.pushBack(e6_4); - QuadraticPolygon cpyPol7(pol7); nbOfSplits=0; - cpyPol7.splitPolygonsEachOther(pol7,pol8,nbOfSplits); - tmp=dynamic_cast(pol8[0]); CPPUNIT_ASSERT(tmp); CPPUNIT_ASSERT(tmp->getPtr()==e1_2); - CPPUNIT_ASSERT(tmp->getLoc()==FULL_ON_1); - tmp=dynamic_cast(pol8[1]); CPPUNIT_ASSERT(tmp); CPPUNIT_ASSERT(tmp->getPtr()==e2_3); - CPPUNIT_ASSERT(tmp->getLoc()==FULL_ON_1); - tmp=dynamic_cast(pol8[2]); CPPUNIT_ASSERT(tmp); CPPUNIT_ASSERT(tmp->getPtr()==e3_1); - CPPUNIT_ASSERT(tmp->getLoc()==FULL_ON_1); - //clean-up test4 - e1_2->decrRef(); e2_3->decrRef(); e3_1->decrRef(); e4_5->decrRef(); e5_6->decrRef(); e6_4->decrRef(); - n1->decrRef(); n2->decrRef(); n3->decrRef(); n4->decrRef(); n5->decrRef(); n6->decrRef(); -} - -void QuadraticPlanarInterpTest::checkBasicsOfPolygons(QuadraticPolygon& pol1, QuadraticPolygon& pol2, bool checkDirection) -{ - IteratorOnComposedEdge it1(&pol1),it2(&pol2); it1.previousLoop(); it2.previousLoop(); - Node *nIter1=it1.current()->getEndNode(); Node *nIter2=it2.current()->getEndNode(); - for(it2.first();!it2.finished();it2.next()) - { - CPPUNIT_ASSERT(nIter2==it2.current()->getStartNode()); - if(checkDirection) - CPPUNIT_ASSERT(it2.current()->getDirection()); - nIter2=it2.current()->getEndNode(); - } - for(it1.first();!it1.finished();it1.next()) - { - CPPUNIT_ASSERT(nIter1==it1.current()->getStartNode()); - if(checkDirection) - CPPUNIT_ASSERT(it1.current()->getDirection()); - nIter1=it1.current()->getEndNode(); - } -} diff --git a/src/INTERP_KERNEL/Geometric2D/Test/QuadraticPlanarInterpTest4.cxx b/src/INTERP_KERNEL/Geometric2D/Test/QuadraticPlanarInterpTest4.cxx deleted file mode 100644 index 9ac85aa30..000000000 --- a/src/INTERP_KERNEL/Geometric2D/Test/QuadraticPlanarInterpTest4.cxx +++ /dev/null @@ -1,327 +0,0 @@ -#include "QuadraticPlanarInterpTest.hxx" -#include "QuadraticPolygon.hxx" -#include "ElementaryEdge.hxx" -#include "EdgeArcCircle.hxx" -#include "EdgeLin.hxx" - -#include -#include -#include - -using namespace std; -using namespace INTERP_KERNEL; - -void QuadraticPlanarInterpTest::checkPolygonsIntersection1() -{ - //The "most" basic test1 - Node *n1=new Node(0.,0.); Node *n4=new Node(0.,-0.3); - Node *n2=new Node(1.,0.); Node *n5=new Node(1.,-0.3); - Node *n3=new Node(0.5,1.); Node *n6=new Node(0.5,0.7); - EdgeLin *e1_2=new EdgeLin(n1,n2); EdgeLin *e4_5=new EdgeLin(n4,n5); - EdgeLin *e2_3=new EdgeLin(n2,n3); EdgeLin *e5_6=new EdgeLin(n5,n6); - EdgeLin *e3_1=new EdgeLin(n3,n1); EdgeLin *e6_4=new EdgeLin(n6,n4); - // - vector result; - for(int k=0;k<2;k++) - for(int i=0;i<1;i++) - { - for(int j=0;j<1;j++) - { - e1_2->incrRef(); e2_3->incrRef(); e3_1->incrRef(); e4_5->incrRef(); e5_6->incrRef(); e6_4->incrRef(); - QuadraticPolygon pol1; pol1.circularPermute(); pol1.pushBack(e1_2); pol1.pushBack(e2_3); pol1.pushBack(e3_1); - for(int i1=0;i1recursiveSize()); - delete result[0]; - } - } - //clean-up for test1 - e1_2->decrRef(); e2_3->decrRef(); e3_1->decrRef(); e4_5->decrRef(); e5_6->decrRef(); e6_4->decrRef(); - n1->decrRef(); n2->decrRef(); n3->decrRef(); n4->decrRef(); n5->decrRef(); n6->decrRef(); - - //Deeper test some extremities of pol2 are on edges of pol1. - - n1=new Node(0.,0.); n4=new Node(1.5,-0.5); - n2=new Node(1.,0.); n5=new Node(0.5,0.); - n3=new Node(0.5,1.); n6=new Node(0.75,0.5); Node *n7=new Node(2.,0.5); - e1_2=new EdgeLin(n1,n2); e2_3=new EdgeLin(n2,n3); e3_1=new EdgeLin(n3,n1); - EdgeLin *e5_4=new EdgeLin(n5,n4); EdgeLin *e4_7=new EdgeLin(n4,n7); EdgeLin *e7_6=new EdgeLin(n7,n6); EdgeLin *e6_5=new EdgeLin(n6,n5); - // - for(int k=0;k<2;k++) - for(int i=0;i<3;i++) - { - for(int j=0;j<4;j++) - { - e1_2->incrRef(); e2_3->incrRef(); e3_1->incrRef(); e5_4->incrRef(); e4_7->incrRef(); e7_6->incrRef(); e6_5->incrRef(); - QuadraticPolygon pol3; pol3.pushBack(e1_2); pol3.pushBack(e2_3); pol3.pushBack(e3_1); - for(int i1=0;i1recursiveSize()); - delete result[0]; - } - } - //clean-up for test2 - e1_2->decrRef(); e2_3->decrRef(); e3_1->decrRef(); e5_4->decrRef(); e4_7->decrRef(); e7_6->decrRef(); e6_5->decrRef(); - n1->decrRef(); n2->decrRef(); n3->decrRef(); n4->decrRef(); n5->decrRef(); n6->decrRef(); n7->decrRef(); - - //Test with one edge of pol2 is included in pol1. - - n1=new Node(0.,0.); n4=new Node(-0.5,0.); - n2=new Node(1.,0.); n5=new Node(0.,-1.); - n3=new Node(0.5,1.); n6=new Node(0.5,0.); - e1_2=new EdgeLin(n1,n2); e2_3=new EdgeLin(n2,n3); e3_1=new EdgeLin(n3,n1); - e4_5=new EdgeLin(n4,n5); e5_6=new EdgeLin(n5,n6); e6_4=new EdgeLin(n6,n4); - for(int k=0;k<2;k++) - for(int i=0;i<3;i++) - { - for(int j=0;j<3;j++) - { - e1_2->incrRef(); e2_3->incrRef(); e3_1->incrRef(); e4_5->incrRef(); e5_6->incrRef(); e6_4->incrRef(); - QuadraticPolygon pol5; pol5.pushBack(e1_2); pol5.pushBack(e2_3); pol5.pushBack(e3_1); - for(int i1=0;i1decrRef(); e2_3->decrRef(); e3_1->decrRef(); e4_5->decrRef(); e5_6->decrRef(); e6_4->decrRef(); - n1->decrRef(); n2->decrRef(); n3->decrRef(); n4->decrRef(); n5->decrRef(); n6->decrRef(); - - //Test of full overlapped polygons. - - n1=new Node(0.,0.); n4=new Node(0.,0.); - n2=new Node(1.,0.); n5=new Node(1.,0.); - n3=new Node(0.5,1.); n6=new Node(0.5,1.); - e1_2=new EdgeLin(n1,n2); e2_3=new EdgeLin(n2,n3); e3_1=new EdgeLin(n3,n1); - e4_5=new EdgeLin(n4,n5); e5_6=new EdgeLin(n5,n6); e6_4=new EdgeLin(n6,n4); - for(int k=0;k<2;k++) - for(int i=0;i<3;i++) - { - for(int j=0;j<3;j++) - { - e1_2->incrRef(); e2_3->incrRef(); e3_1->incrRef(); e4_5->incrRef(); e5_6->incrRef(); e6_4->incrRef(); - QuadraticPolygon pol7; pol7.pushBack(e1_2); pol7.pushBack(e2_3); pol7.pushBack(e3_1); - for(int i1=0;i1recursiveSize()); - delete result[0]; - } - } - //clean-up test4 - e1_2->decrRef(); e2_3->decrRef(); e3_1->decrRef(); e4_5->decrRef(); e5_6->decrRef(); e6_4->decrRef(); - n1->decrRef(); n2->decrRef(); n3->decrRef(); n4->decrRef(); n5->decrRef(); n6->decrRef(); - - //Test of closing process - - n1=new Node(0.,0.); n4=new Node(0.539,-0.266); - n2=new Node(1.,0.); n5=new Node(1.039,0.6); - n3=new Node(0.5,1.); n6=new Node(-0.077,0.667); - e1_2=new EdgeLin(n1,n2); e2_3=new EdgeLin(n2,n3); e3_1=new EdgeLin(n3,n1); - e4_5=new EdgeLin(n4,n5); e5_6=new EdgeLin(n5,n6); e6_4=new EdgeLin(n6,n4); - for(int k=0;k<2;k++) - for(int i=0;i<3;i++) - { - for(int j=0;j<3;j++) - { - e1_2->incrRef(); e2_3->incrRef(); e3_1->incrRef(); e4_5->incrRef(); e5_6->incrRef(); e6_4->incrRef(); - QuadraticPolygon pol9; pol9.pushBack(e1_2); pol9.pushBack(e2_3); pol9.pushBack(e3_1); - for(int i1=0;i1recursiveSize()); - delete result[0]; - } - } - //clean-up test5 - e1_2->decrRef(); e2_3->decrRef(); e3_1->decrRef(); e4_5->decrRef(); e5_6->decrRef(); e6_4->decrRef(); - n1->decrRef(); n2->decrRef(); n3->decrRef(); n4->decrRef(); n5->decrRef(); n6->decrRef(); - - // Full in case - - n1=new Node(0.,0.); n4=new Node(0.3,0.1); - n2=new Node(1.,0.); n5=new Node(0.7,0.1); - n3=new Node(0.5,1.); n6=new Node(0.5,0.7); - e1_2=new EdgeLin(n1,n2); e2_3=new EdgeLin(n2,n3); e3_1=new EdgeLin(n3,n1); - e4_5=new EdgeLin(n4,n5); e5_6=new EdgeLin(n5,n6); e6_4=new EdgeLin(n6,n4); - for(int k=0;k<2;k++) - for(int i=0;i<3;i++) - { - for(int j=0;j<3;j++) - { - e1_2->incrRef(); e2_3->incrRef(); e3_1->incrRef(); e4_5->incrRef(); e5_6->incrRef(); e6_4->incrRef(); - QuadraticPolygon pol11; pol11.pushBack(e1_2); pol11.pushBack(e2_3); pol11.pushBack(e3_1); - for(int i1=0;i1recursiveSize()); - delete result[0]; - } - } - //clean-up test6 - e1_2->decrRef(); e2_3->decrRef(); e3_1->decrRef(); e4_5->decrRef(); e5_6->decrRef(); e6_4->decrRef(); - n1->decrRef(); n2->decrRef(); n3->decrRef(); n4->decrRef(); n5->decrRef(); n6->decrRef(); - - // Full out case - - n1=new Node(0.,0.); n4=new Node(-2,0.); - n2=new Node(1.,0.); n5=new Node(-1.,0.); - n3=new Node(0.5,1.); n6=new Node(-1.5,1.); - e1_2=new EdgeLin(n1,n2); e2_3=new EdgeLin(n2,n3); e3_1=new EdgeLin(n3,n1); - e4_5=new EdgeLin(n4,n5); e5_6=new EdgeLin(n5,n6); e6_4=new EdgeLin(n6,n4); - for(int k=0;k<2;k++) - for(int i=0;i<3;i++) - { - for(int j=0;j<3;j++) - { - e1_2->incrRef(); e2_3->incrRef(); e3_1->incrRef(); e4_5->incrRef(); e5_6->incrRef(); e6_4->incrRef(); - QuadraticPolygon pol13; pol13.pushBack(e1_2); pol13.pushBack(e2_3); pol13.pushBack(e3_1); - for(int i1=0;i1decrRef(); e2_3->decrRef(); e3_1->decrRef(); e4_5->decrRef(); e5_6->decrRef(); e6_4->decrRef(); - n1->decrRef(); n2->decrRef(); n3->decrRef(); n4->decrRef(); n5->decrRef(); n6->decrRef(); - - //Multi polygons - - n1=new Node(0.,0.); - n2=new Node(1.,0.); - n3=new Node(1.,1.); - n4=new Node(0.,1.); - // - n5=new Node(0.2,0.7); - n6=new Node(0.4,0.7); - n7=new Node(0.4,1.3); - Node *n8=new Node(0.6,1.3); - Node *n9=new Node(0.6,0.7); - Node *n10=new Node(0.9,0.7); - Node *n11=new Node(0.9,2.); - Node *n12=new Node(0.2,2.); - // - e1_2=new EdgeLin(n1,n2); e2_3=new EdgeLin(n2,n3); Edge *e3_4=new EdgeLin(n3,n4); Edge *e4_1=new EdgeLin(n4,n1); - e5_6=new EdgeLin(n5,n6); Edge *e6_7=new EdgeLin(n6,n7); Edge *e7_8=new EdgeLin(n7,n8); Edge *e8_9=new EdgeLin(n8,n9); Edge *e9_10=new EdgeLin(n9,n10); Edge *e10_11=new EdgeLin(n10,n11); - Edge *e11_12=new EdgeLin(n11,n12); Edge *e12_1=new EdgeLin(n12,n5); - // - for(int k=0;k<2;k++) - for(int i=0;i<4;i++) - { - for(int j=0;j<8;j++) - { - e1_2->incrRef(); e2_3->incrRef(); e3_4->incrRef(); e4_1->incrRef(); e5_6->incrRef(); e6_7->incrRef(); e7_8->incrRef(); e8_9->incrRef(); e9_10->incrRef(); e10_11->incrRef(); e11_12->incrRef(); e12_1->incrRef(); - QuadraticPolygon pol15; pol15.pushBack(e1_2); pol15.pushBack(e2_3); pol15.pushBack(e3_4); pol15.pushBack(e4_1); - for(int i1=0;i1recursiveSize()); CPPUNIT_ASSERT_EQUAL(4,result[1]->recursiveSize()); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.15,result[0]->getAreaFast()+result[1]->getAreaFast(),1e-10); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.03,fabs(result[0]->getAreaFast()-result[1]->getAreaFast()),1e-10); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.15,pol15.intersectWith(pol16),1e-10); - delete result[0]; delete result[1]; - } - } - //clean-up test8 - e1_2->decrRef(); e2_3->decrRef(); e3_4->decrRef(); e4_1->decrRef(); e5_6->decrRef(); e6_7->decrRef(); e7_8->decrRef(); e8_9->decrRef(); e9_10->decrRef(); e10_11->decrRef(); e11_12->decrRef(); e12_1->decrRef(); - n1->decrRef(); n2->decrRef(); n3->decrRef(); n4->decrRef(); n5->decrRef(); n6->decrRef(); n7->decrRef(); n8->decrRef(); n9->decrRef(); n10->decrRef(); n11->decrRef(); n12->decrRef(); -} - -void QuadraticPlanarInterpTest::checkAreasCalculations() -{ - Node *n1=new Node(0.,0.); - Node *n2=new Node(1.,0.); - Node *n3=new Node(0.5,1.); - Edge *e1_2=new EdgeLin(n1,n2); - Edge *e2_3=new EdgeLin(n2,n3); - Edge *e3_1=new EdgeLin(n3,n1); - // - e1_2->incrRef(); e2_3->incrRef(); e3_1->incrRef(); - QuadraticPolygon pol1; pol1.pushBack(e1_2); pol1.pushBack(e2_3); pol1.pushBack(e3_1); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.5,pol1.getAreaFast(),1e-10); - CPPUNIT_ASSERT_DOUBLES_EQUAL(3.2360679774997898,pol1.getPerimeterFast(),1e-10); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.61803398874989479,pol1.getHydroulicDiameter(),1e-10); - pol1.reverse(); - CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.5,pol1.getAreaFast(),1e-10); - CPPUNIT_ASSERT_DOUBLES_EQUAL(3.2360679774997898,pol1.getPerimeterFast(),1e-10); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.61803398874989479,pol1.getHydroulicDiameter(),1e-10); - //clean-up - e1_2->decrRef(); e2_3->decrRef(); e3_1->decrRef(); - n1->decrRef(); n2->decrRef(); n3->decrRef(); - - //case 2 - - n1=new Node(0.,0.); - n2=new Node(1.,0.); - Node *n3m=new Node(1.5,0.5); - n3=new Node(1.,1.); - Node *n4=new Node(0.,1.); - e1_2=new EdgeLin(n1,n2); - e2_3=new EdgeArcCircle(n2,n3m,n3); - Edge *e3_4=new EdgeLin(n3,n4); - Edge *e4_1=new EdgeLin(n4,n1); - // - for(int k=0;k<8;k++) - { - n2->setNewCoords(cos(k*M_PI/4),sin(k*M_PI/4)); - n3->setNewCoords(sqrt(2.)*cos((k+1)*M_PI/4),sqrt(2.)*sin((k+1)*M_PI/4)); - n3m->setNewCoords(1.5811388300841898*cos(0.3217505543966423+k*M_PI/4),1.5811388300841898*sin(0.3217505543966423+k*M_PI/4)); - n4->setNewCoords(cos(k*M_PI/4+M_PI/2),sin(k*M_PI/4+M_PI/2)); - e1_2->update(n3m); e2_3->update(n3m); e3_4->update(n3m); e4_1->update(n3m); - e1_2->incrRef(); e2_3->incrRef(); e3_4->incrRef(); e4_1->incrRef(); - QuadraticPolygon pol2; pol2.pushBack(e1_2); pol2.pushBack(e2_3); pol2.pushBack(e3_4); pol2.pushBack(e4_1); - CPPUNIT_ASSERT_DOUBLES_EQUAL(1.3926990816987241,pol2.getAreaFast(),1e-6); - CPPUNIT_ASSERT_DOUBLES_EQUAL(4.5707963267948966,pol2.getPerimeterFast(),1e-6); - pol2.reverse(); - CPPUNIT_ASSERT_DOUBLES_EQUAL(-1.3926990816987241,pol2.getAreaFast(),1e-6); - CPPUNIT_ASSERT_DOUBLES_EQUAL(4.5707963267948966,pol2.getPerimeterFast(),1e-6); - } - //clean-up case2 - e1_2->decrRef(); e2_3->decrRef(); e3_4->decrRef(); e4_1->decrRef(); - n1->decrRef(); n2->decrRef(); n3->decrRef(); n3m->decrRef(); n4->decrRef(); - - //case 3 - - const double radius1=0.7; - const double radius2=0.9; - n1=new Node(1.+radius1*cos(-2.*M_PI/3.),1.+radius1*sin(-2.*M_PI/3.)); - n2=new Node(1.+radius1*cos(-M_PI/3.),1.+radius1*sin(-M_PI/3.)); - Node *n2m=new Node(1.+radius1*cos(M_PI/2.),1.+radius1*sin(M_PI/2.)); - n3=new Node(1.+radius2*cos(-M_PI/3.),1.+radius2*sin(-M_PI/3.)); - n3m=new Node(1.+radius2*cos(M_PI/2.),1.+radius2*sin(M_PI/2.)); - n4=new Node(1.+radius2*cos(-2.*M_PI/3.),1.+radius2*sin(-2.*M_PI/3.)); - e1_2=new EdgeArcCircle(n1,n2m,n2); - e2_3=new EdgeLin(n2,n3); - e3_4=new EdgeArcCircle(n3,n3m,n4); - e4_1=new EdgeLin(n4,n1); - // - e1_2->incrRef(); e2_3->incrRef(); e3_4->incrRef(); e4_1->incrRef(); - QuadraticPolygon pol3; pol3.pushBack(e1_2); pol3.pushBack(e2_3); pol3.pushBack(e3_4); pol3.pushBack(e4_1); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.83775804095727857,pol3.getAreaFast(),1e-10); - CPPUNIT_ASSERT_DOUBLES_EQUAL(8.7775804095727832,pol3.getPerimeterFast(),1e-10); - pol3.reverse(); - CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.83775804095727857,pol3.getAreaFast(),1e-10); - CPPUNIT_ASSERT_DOUBLES_EQUAL(8.7775804095727832,pol3.getPerimeterFast(),1e-10); - //clean-up case3 - e1_2->decrRef(); e2_3->decrRef(); e3_4->decrRef(); e4_1->decrRef(); - n1->decrRef(); n2->decrRef(); n2m->decrRef(); n3->decrRef(); n3m->decrRef(); n4->decrRef(); -} diff --git a/src/INTERP_KERNEL/Geometric2D/Test/UnitTestsResult.hxx b/src/INTERP_KERNEL/Geometric2D/Test/UnitTestsResult.hxx deleted file mode 100644 index 31dfdb753..000000000 --- a/src/INTERP_KERNEL/Geometric2D/Test/UnitTestsResult.hxx +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef _UNITTESTSRESULT_HXX_ -#define _UNITTESTSRESULT_HXX_ - -#include -#include - -namespace INTERP_KERNEL -{ - static inline std::string getResultFile() - { - std::string s = "/tmp/"; - s += std::getenv("USER"); - s += "/UnitTestsResult"; - return s; - } - - std::string UnitTestsResult = getResultFile(); -} - -#endif -- 2.39.2