- Timestamp:
- Apr 15, 2010, 10:54:26 AM (16 years ago)
- Children:
- 32842d8
- Parents:
- 1f591b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/unittests/tesselation_boundarytriangleunittest.cpp
r1f591b re7ea64 86 86 87 87 // simple test on y line 88 Point .Init(-1.,0.5,0.);89 CPPUNIT_ASSERT_EQUAL( 1., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) ); 90 Point .Init(0.,0.5,0.);91 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 92 Point .Init(-4.,0.5,0.);88 Point = Vector(-1.,0.5,0.); 89 CPPUNIT_ASSERT_EQUAL( 1., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) ); 90 Point = Vector(0.,0.5,0.); 91 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 92 Point = Vector(-4.,0.5,0.); 93 93 CPPUNIT_ASSERT_EQUAL( 16., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) ); 94 Point .Init(0.,0.5,0.);94 Point = Vector(0.,0.5,0.); 95 95 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 96 96 97 97 // simple test on x line 98 Point .Init(0.5,-1.,0.);99 CPPUNIT_ASSERT_EQUAL( 1., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) ); 100 Point .Init(0.5,0.,0.);101 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 102 Point .Init(0.5,-6.,0.);98 Point = Vector(0.5,-1.,0.); 99 CPPUNIT_ASSERT_EQUAL( 1., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) ); 100 Point = Vector(0.5,0.,0.); 101 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 102 Point = Vector(0.5,-6.,0.); 103 103 CPPUNIT_ASSERT_EQUAL( 36., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) ); 104 Point .Init(0.5,0.,0.);104 Point = Vector(0.5,0.,0.); 105 105 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 106 106 107 107 // simple test on slanted line 108 Point .Init(1.,1.,0.);108 Point = Vector(1.,1.,0.); 109 109 CPPUNIT_ASSERT_EQUAL( 0.5, triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) ); 110 Point .Init(0.5,0.5,0.);111 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 112 Point .Init(5.,5.,0.);110 Point = Vector(0.5,0.5,0.); 111 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 112 Point = Vector(5.,5.,0.); 113 113 CPPUNIT_ASSERT_EQUAL( 40.5, triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) ); 114 Point .Init(0.5,0.5,0.);114 Point = Vector(0.5,0.5,0.); 115 115 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 116 116 117 117 // simple test on first node 118 Point .Init(-1.,-1.,0.);118 Point = Vector(-1.,-1.,0.); 119 119 CPPUNIT_ASSERT_EQUAL( 2., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) ); 120 Point .Init(0.,0.,0.);120 Point = Vector(0.,0.,0.); 121 121 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 122 122 123 123 // simple test on second node 124 Point .Init(0.,2.,0.);125 CPPUNIT_ASSERT_EQUAL( 1., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) ); 126 Point .Init(0.,1.,0.);124 Point = Vector(0.,2.,0.); 125 CPPUNIT_ASSERT_EQUAL( 1., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) ); 126 Point = Vector(0.,1.,0.); 127 127 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 128 128 129 129 // simple test on third node 130 Point .Init(2.,0.,0.);131 CPPUNIT_ASSERT_EQUAL( 1., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) ); 132 Point .Init(1.,0.,0.);130 Point = Vector(2.,0.,0.); 131 CPPUNIT_ASSERT_EQUAL( 1., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) ); 132 Point = Vector(1.,0.,0.); 133 133 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 134 134 }; … … 142 142 143 143 // straight down/up 144 Point .Init(1./3.,1./3.,+5.);144 Point = Vector(1./3.,1./3.,+5.); 145 145 CPPUNIT_ASSERT_EQUAL( 25. , triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) ); 146 Point .Init(1./3.,1./3.,0.);147 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 148 Point .Init(1./3.,1./3.,-5.);146 Point = Vector(1./3.,1./3.,0.); 147 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 148 Point = Vector(1./3.,1./3.,-5.); 149 149 CPPUNIT_ASSERT_EQUAL( 25. , triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) ); 150 Point .Init(1./3.,1./3.,0.);150 Point = Vector(1./3.,1./3.,0.); 151 151 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 152 152 153 153 // simple test on y line 154 Point .Init(-1.,0.5,+2.);154 Point = Vector(-1.,0.5,+2.); 155 155 CPPUNIT_ASSERT_EQUAL( 5., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) ); 156 Point .Init(0.,0.5,0.);157 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 158 Point .Init(-1.,0.5,-3.);156 Point = Vector(0.,0.5,0.); 157 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 158 Point = Vector(-1.,0.5,-3.); 159 159 CPPUNIT_ASSERT_EQUAL( 10., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) ); 160 Point .Init(0.,0.5,0.);160 Point = Vector(0.,0.5,0.); 161 161 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 162 162 163 163 // simple test on x line 164 Point .Init(0.5,-1.,+1.);164 Point = Vector(0.5,-1.,+1.); 165 165 CPPUNIT_ASSERT_EQUAL( 2., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) ); 166 Point .Init(0.5,0.,0.);167 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 168 Point .Init(0.5,-1.,-2.);166 Point = Vector(0.5,0.,0.); 167 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 168 Point = Vector(0.5,-1.,-2.); 169 169 CPPUNIT_ASSERT_EQUAL( 5., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) ); 170 Point .Init(0.5,0.,0.);170 Point = Vector(0.5,0.,0.); 171 171 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 172 172 173 173 // simple test on slanted line 174 Point .Init(1.,1.,+3.);174 Point = Vector(1.,1.,+3.); 175 175 CPPUNIT_ASSERT_EQUAL( 9.5, triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) ); 176 Point .Init(0.5,0.5,0.);177 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 178 Point .Init(1.,1.,-4.);176 Point = Vector(0.5,0.5,0.); 177 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 178 Point = Vector(1.,1.,-4.); 179 179 CPPUNIT_ASSERT_EQUAL( 16.5, triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) ); 180 Point .Init(0.5,0.5,0.);180 Point = Vector(0.5,0.5,0.); 181 181 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 182 182 183 183 // simple test on first node 184 Point .Init(-1.,-1.,5.);184 Point = Vector(-1.,-1.,5.); 185 185 CPPUNIT_ASSERT_EQUAL( 27., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) ); 186 Point .Init(0.,0.,0.);186 Point = Vector(0.,0.,0.); 187 187 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 188 188 189 189 // simple test on second node 190 Point .Init(0.,2.,5.);190 Point = Vector(0.,2.,5.); 191 191 CPPUNIT_ASSERT_EQUAL( 26., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) ); 192 Point .Init(0.,1.,0.);192 Point = Vector(0.,1.,0.); 193 193 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 194 194 195 195 // simple test on third node 196 Point .Init(2.,0.,5.);196 Point = Vector(2.,0.,5.); 197 197 CPPUNIT_ASSERT_EQUAL( 26., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) ); 198 Point .Init(1.,0.,0.);199 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 200 }; 198 Point = Vector(1.,0.,0.); 199 CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection ); 200 };
Note:
See TracChangeset
for help on using the changeset viewer.
