Changeset 8f4df1 for src/unittests/tesselation_boundarytriangleunittest.cpp
- Timestamp:
- Aug 7, 2010, 12:07:04 PM (15 years ago)
- Branches:
- Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, Candidate_v1.7.0, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
- Children:
- 2d292d
- Parents:
- 8d6d31 (diff), d74077 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/unittests/tesselation_boundarytriangleunittest.cpp
r8d6d31 r8f4df1 13 13 14 14 #include <cstring> 15 #include <iostream> 15 16 16 17 #include "defs.hpp" 17 #include "tesselation.hpp" 18 #include "TesselPoint.hpp" 19 #include "BoundaryPointSet.hpp" 20 #include "BoundaryLineSet.hpp" 21 #include "BoundaryTriangleSet.hpp" 22 #include "CandidateForTesselation.hpp" 18 23 #include "tesselation_boundarytriangleunittest.hpp" 19 24 … … 36 41 // create nodes 37 42 tesselpoints[0] = new TesselPoint; 38 tesselpoints[0]-> node = new Vector(0., 0., 0.);43 tesselpoints[0]->setPosition(Vector(0., 0., 0.)); 39 44 tesselpoints[0]->setName("1"); 40 45 tesselpoints[0]->nr = 1; 41 46 points[0] = new BoundaryPointSet(tesselpoints[0]); 42 47 tesselpoints[1] = new TesselPoint; 43 tesselpoints[1]-> node = new Vector(0., 1., 0.);48 tesselpoints[1]->setPosition(Vector(0., 1., 0.)); 44 49 tesselpoints[1]->setName("2"); 45 50 tesselpoints[1]->nr = 2; 46 51 points[1] = new BoundaryPointSet(tesselpoints[1]); 47 52 tesselpoints[2] = new TesselPoint; 48 tesselpoints[2]-> node = new Vector(1., 0., 0.);53 tesselpoints[2]->setPosition(Vector(1., 0., 0.)); 49 54 tesselpoints[2]->setName("3"); 50 55 tesselpoints[2]->nr = 3; … … 67 72 for (int i=0;i<3;++i) { 68 73 // TesselPoint does not delete its vector as it only got a reference 69 delete tesselpoints[i]->node;70 74 delete tesselpoints[i]; 71 75 } … … 83 87 // simple test on y line 84 88 Point = Vector(-1.,0.5,0.); 85 CPPUNIT_ASSERT_EQUAL( 1., triangle->GetClosestPointInsideTriangle( &Point, &TestIntersection) );89 CPPUNIT_ASSERT_EQUAL( 1., triangle->GetClosestPointInsideTriangle(Point, TestIntersection) ); 86 90 Point = Vector(0.,0.5,0.); 87 91 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 88 92 Point = Vector(-4.,0.5,0.); 89 CPPUNIT_ASSERT_EQUAL( 16., triangle->GetClosestPointInsideTriangle( &Point, &TestIntersection) );93 CPPUNIT_ASSERT_EQUAL( 16., triangle->GetClosestPointInsideTriangle(Point, TestIntersection) ); 90 94 Point = Vector(0.,0.5,0.); 91 95 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); … … 93 97 // simple test on x line 94 98 Point = Vector(0.5,-1.,0.); 95 CPPUNIT_ASSERT_EQUAL( 1., triangle->GetClosestPointInsideTriangle( &Point, &TestIntersection) );99 CPPUNIT_ASSERT_EQUAL( 1., triangle->GetClosestPointInsideTriangle(Point, TestIntersection) ); 96 100 Point = Vector(0.5,0.,0.); 97 101 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 98 102 Point = Vector(0.5,-6.,0.); 99 CPPUNIT_ASSERT_EQUAL( 36., triangle->GetClosestPointInsideTriangle( &Point, &TestIntersection) );103 CPPUNIT_ASSERT_EQUAL( 36., triangle->GetClosestPointInsideTriangle(Point, TestIntersection) ); 100 104 Point = Vector(0.5,0.,0.); 101 105 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); … … 103 107 // simple test on slanted line 104 108 Point = Vector(1.,1.,0.); 105 CPPUNIT_ASSERT_EQUAL( 0.5, triangle->GetClosestPointInsideTriangle( &Point, &TestIntersection) );109 CPPUNIT_ASSERT_EQUAL( 0.5, triangle->GetClosestPointInsideTriangle(Point, TestIntersection) ); 106 110 Point = Vector(0.5,0.5,0.); 107 111 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 108 112 Point = Vector(5.,5.,0.); 109 CPPUNIT_ASSERT_EQUAL( 40.5, triangle->GetClosestPointInsideTriangle( &Point, &TestIntersection) );113 CPPUNIT_ASSERT_EQUAL( 40.5, triangle->GetClosestPointInsideTriangle(Point, TestIntersection) ); 110 114 Point = Vector(0.5,0.5,0.); 111 115 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); … … 113 117 // simple test on first node 114 118 Point = Vector(-1.,-1.,0.); 115 CPPUNIT_ASSERT_EQUAL( 2., triangle->GetClosestPointInsideTriangle( &Point, &TestIntersection) );119 CPPUNIT_ASSERT_EQUAL( 2., triangle->GetClosestPointInsideTriangle(Point, TestIntersection) ); 116 120 Point = Vector(0.,0.,0.); 117 121 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); … … 119 123 // simple test on second node 120 124 Point = Vector(0.,2.,0.); 121 CPPUNIT_ASSERT_EQUAL( 1., triangle->GetClosestPointInsideTriangle( &Point, &TestIntersection) );125 CPPUNIT_ASSERT_EQUAL( 1., triangle->GetClosestPointInsideTriangle(Point, TestIntersection) ); 122 126 Point = Vector(0.,1.,0.); 123 127 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); … … 125 129 // simple test on third node 126 130 Point = Vector(2.,0.,0.); 127 CPPUNIT_ASSERT_EQUAL( 1., triangle->GetClosestPointInsideTriangle( &Point, &TestIntersection) );131 CPPUNIT_ASSERT_EQUAL( 1., triangle->GetClosestPointInsideTriangle(Point, TestIntersection) ); 128 132 Point = Vector(1.,0.,0.); 129 133 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); … … 139 143 // straight down/up 140 144 Point = Vector(1./3.,1./3.,+5.); 141 CPPUNIT_ASSERT_EQUAL( 25. , triangle->GetClosestPointInsideTriangle( &Point, &TestIntersection) );145 CPPUNIT_ASSERT_EQUAL( 25. , triangle->GetClosestPointInsideTriangle(Point, TestIntersection) ); 142 146 Point = Vector(1./3.,1./3.,0.); 143 147 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 144 148 Point = Vector(1./3.,1./3.,-5.); 145 CPPUNIT_ASSERT_EQUAL( 25. , triangle->GetClosestPointInsideTriangle( &Point, &TestIntersection) );149 CPPUNIT_ASSERT_EQUAL( 25. , triangle->GetClosestPointInsideTriangle(Point, TestIntersection) ); 146 150 Point = Vector(1./3.,1./3.,0.); 147 151 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); … … 149 153 // simple test on y line 150 154 Point = Vector(-1.,0.5,+2.); 151 CPPUNIT_ASSERT_EQUAL( 5., triangle->GetClosestPointInsideTriangle( &Point, &TestIntersection) );155 CPPUNIT_ASSERT_EQUAL( 5., triangle->GetClosestPointInsideTriangle(Point, TestIntersection) ); 152 156 Point = Vector(0.,0.5,0.); 153 157 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 154 158 Point = Vector(-1.,0.5,-3.); 155 CPPUNIT_ASSERT_EQUAL( 10., triangle->GetClosestPointInsideTriangle( &Point, &TestIntersection) );159 CPPUNIT_ASSERT_EQUAL( 10., triangle->GetClosestPointInsideTriangle(Point, TestIntersection) ); 156 160 Point = Vector(0.,0.5,0.); 157 161 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); … … 159 163 // simple test on x line 160 164 Point = Vector(0.5,-1.,+1.); 161 CPPUNIT_ASSERT_EQUAL( 2., triangle->GetClosestPointInsideTriangle( &Point, &TestIntersection) );165 CPPUNIT_ASSERT_EQUAL( 2., triangle->GetClosestPointInsideTriangle(Point, TestIntersection) ); 162 166 Point = Vector(0.5,0.,0.); 163 167 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 164 168 Point = Vector(0.5,-1.,-2.); 165 CPPUNIT_ASSERT_EQUAL( 5., triangle->GetClosestPointInsideTriangle( &Point, &TestIntersection) );169 CPPUNIT_ASSERT_EQUAL( 5., triangle->GetClosestPointInsideTriangle(Point, TestIntersection) ); 166 170 Point = Vector(0.5,0.,0.); 167 171 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); … … 169 173 // simple test on slanted line 170 174 Point = Vector(1.,1.,+3.); 171 CPPUNIT_ASSERT_EQUAL( 9.5, triangle->GetClosestPointInsideTriangle( &Point, &TestIntersection) );175 CPPUNIT_ASSERT_EQUAL( 9.5, triangle->GetClosestPointInsideTriangle(Point, TestIntersection) ); 172 176 Point = Vector(0.5,0.5,0.); 173 177 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 174 178 Point = Vector(1.,1.,-4.); 175 CPPUNIT_ASSERT_EQUAL( 16.5, triangle->GetClosestPointInsideTriangle( &Point, &TestIntersection) );179 CPPUNIT_ASSERT_EQUAL( 16.5, triangle->GetClosestPointInsideTriangle(Point, TestIntersection) ); 176 180 Point = Vector(0.5,0.5,0.); 177 181 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); … … 179 183 // simple test on first node 180 184 Point = Vector(-1.,-1.,5.); 181 CPPUNIT_ASSERT_EQUAL( 27., triangle->GetClosestPointInsideTriangle( &Point, &TestIntersection) );185 CPPUNIT_ASSERT_EQUAL( 27., triangle->GetClosestPointInsideTriangle(Point, TestIntersection) ); 182 186 Point = Vector(0.,0.,0.); 183 187 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); … … 185 189 // simple test on second node 186 190 Point = Vector(0.,2.,5.); 187 CPPUNIT_ASSERT_EQUAL( 26., triangle->GetClosestPointInsideTriangle( &Point, &TestIntersection) );191 CPPUNIT_ASSERT_EQUAL( 26., triangle->GetClosestPointInsideTriangle(Point, TestIntersection) ); 188 192 Point = Vector(0.,1.,0.); 189 193 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); … … 191 195 // simple test on third node 192 196 Point = Vector(2.,0.,5.); 193 CPPUNIT_ASSERT_EQUAL( 26., triangle->GetClosestPointInsideTriangle( &Point, &TestIntersection) );197 CPPUNIT_ASSERT_EQUAL( 26., triangle->GetClosestPointInsideTriangle(Point, TestIntersection) ); 194 198 Point = Vector(1.,0.,0.); 195 199 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
Note:
See TracChangeset
for help on using the changeset viewer.
