source: src/unittests/LineUnittest.cpp@ 6c438f

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 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 v1.0.4
Last change on this file since 6c438f was 6c438f, checked in by Frederik Heber <heber@…>, 14 years ago

Merge branch 'StructureRefactoring' into Shapes

Conflicts:

src/Box.cpp
src/Box.hpp
src/Descriptors/AtomShapeDescriptor.cpp
src/Descriptors/AtomShapeDescriptor.hpp
src/Descriptors/AtomShapeDescriptor_impl.hpp
src/LinearAlgebra/Line.cpp
src/LinearAlgebra/Line.hpp
src/LinearAlgebra/Matrix.cpp
src/LinearAlgebra/Matrix.hpp
src/Makefile.am
src/Shapes/BaseShapes.cpp
src/Shapes/BaseShapes_impl.hpp
src/Shapes/Shape.cpp
src/Shapes/Shape.hpp
src/Shapes/ShapeOps_impl.hpp
src/Shapes/Shape_impl.hpp
src/unittests/ShapeUnittest.cpp

  • Property mode set to 100644
File size: 14.4 KB
Line 
1/*
2 * Project: MoleCuilder
3 * Description: creates and alters molecular systems
4 * Copyright (C) 2010 University of Bonn. All rights reserved.
5 * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
6 */
7
8/*
9 * LineUnittest.cpp
10 *
11 * Created on: May 27, 2010
12 * Author: crueger
13 */
14
15// include config.h
16#ifdef HAVE_CONFIG_H
17#include <config.h>
18#endif
19
20#include "LineUnittest.hpp"
21
22#include "LinearAlgebra/Vector.hpp"
23#include "Exceptions/LinearDependenceException.hpp"
24#include "Exceptions/SkewException.hpp"
25
26#include <cppunit/CompilerOutputter.h>
27#include <cppunit/extensions/TestFactoryRegistry.h>
28#include <cppunit/ui/text/TestRunner.h>
29
30#include <iostream>
31#include <cmath>
32
33using namespace std;
34
35#ifdef HAVE_TESTRUNNER
36#include "UnitTestMain.hpp"
37#endif /*HAVE_TESTRUNNER*/
38
39CPPUNIT_TEST_SUITE_REGISTRATION( LineUnittest );
40
41void LineUnittest::setUp(){
42 // three lines along the axes
43 la1 = new Line(zeroVec,unitVec[0]);
44 la2 = new Line(zeroVec,unitVec[1]);
45 la3 = new Line(zeroVec,unitVec[2]);
46
47 // the lines along the planes defined by two coordinate axes
48 lp1 = new Line(unitVec[0],unitVec[0]-unitVec[1]);
49 lp2 = new Line(unitVec[1],unitVec[1]-unitVec[2]);
50 lp3 = new Line(unitVec[2],unitVec[2]-unitVec[0]);
51}
52void LineUnittest::tearDown(){
53 delete la1;
54 delete la2;
55 delete la3;
56
57 delete lp1;
58 delete lp2;
59 delete lp3;
60}
61
62void LineUnittest::constructionErrorTest(){
63 // test some constructions
64
65 // direction+origin should never fail
66 CPPUNIT_ASSERT_NO_THROW(Line(zeroVec,unitVec[0]));
67 CPPUNIT_ASSERT_NO_THROW(Line(zeroVec,unitVec[1]));
68 CPPUNIT_ASSERT_NO_THROW(Line(zeroVec,unitVec[2]));
69
70 // two points fails if both points are the same
71 CPPUNIT_ASSERT_NO_THROW(makeLineThrough(unitVec[0],unitVec[1]));
72 CPPUNIT_ASSERT_NO_THROW(makeLineThrough(unitVec[1],unitVec[2]));
73 CPPUNIT_ASSERT_NO_THROW(makeLineThrough(unitVec[2],unitVec[0]));
74 // for zerovectors
75 CPPUNIT_ASSERT_NO_THROW(makeLineThrough(unitVec[0],zeroVec));
76 CPPUNIT_ASSERT_NO_THROW(makeLineThrough(unitVec[1],zeroVec));
77 CPPUNIT_ASSERT_NO_THROW(makeLineThrough(unitVec[2],zeroVec));
78 // now we pass two times the same point
79 CPPUNIT_ASSERT_THROW(makeLineThrough(zeroVec,zeroVec),LinearDependenceException);
80 CPPUNIT_ASSERT_THROW(makeLineThrough(unitVec[0],unitVec[0]),LinearDependenceException);
81 CPPUNIT_ASSERT_THROW(makeLineThrough(unitVec[1],unitVec[1]),LinearDependenceException);
82 CPPUNIT_ASSERT_THROW(makeLineThrough(unitVec[2],unitVec[2]),LinearDependenceException);
83
84}
85
86bool testDirection(const Vector &dir1,const Vector &dir2){
87 return (dir1==dir2) || (dir1==-1*dir2);
88}
89
90void LineUnittest::constructionResultTest(){
91 // test all directions
92 CPPUNIT_ASSERT(testDirection(la1->getDirection(),unitVec[0]));
93 CPPUNIT_ASSERT(testDirection(la2->getDirection(),unitVec[1]));
94 CPPUNIT_ASSERT(testDirection(la3->getDirection(),unitVec[2]));
95
96 // test origins
97 CPPUNIT_ASSERT_EQUAL(la1->getOrigin(),zeroVec);
98 CPPUNIT_ASSERT_EQUAL(la2->getOrigin(),zeroVec);
99 CPPUNIT_ASSERT_EQUAL(la2->getOrigin(),zeroVec);
100
101 // test if desired points are on the lines
102 CPPUNIT_ASSERT(la1->isContained(zeroVec));
103 CPPUNIT_ASSERT(la2->isContained(zeroVec));
104 CPPUNIT_ASSERT(la3->isContained(zeroVec));
105
106 CPPUNIT_ASSERT(la1->isContained(unitVec[0]));
107 CPPUNIT_ASSERT(la2->isContained(unitVec[1]));
108 CPPUNIT_ASSERT(la3->isContained(unitVec[2]));
109
110 CPPUNIT_ASSERT(lp1->isContained(unitVec[0]));
111 CPPUNIT_ASSERT(lp2->isContained(unitVec[1]));
112 CPPUNIT_ASSERT(lp3->isContained(unitVec[2]));
113
114 CPPUNIT_ASSERT(lp1->isContained(unitVec[1]));
115 CPPUNIT_ASSERT(lp2->isContained(unitVec[2]));
116 CPPUNIT_ASSERT(lp3->isContained(unitVec[0]));
117}
118
119void LineUnittest::isContainedTest(){
120 // Zerovector on the axes lines
121 CPPUNIT_ASSERT(la1->isContained(zeroVec));
122 CPPUNIT_ASSERT(la2->isContained(zeroVec));
123 CPPUNIT_ASSERT(la3->isContained(zeroVec));
124
125 // multiples of the second support vector
126 CPPUNIT_ASSERT(la1->isContained(unitVec[0]));
127 CPPUNIT_ASSERT(la2->isContained(unitVec[1]));
128 CPPUNIT_ASSERT(la3->isContained(unitVec[2]));
129
130 CPPUNIT_ASSERT(la1->isContained(2*unitVec[0]));
131 CPPUNIT_ASSERT(la2->isContained(2*unitVec[1]));
132 CPPUNIT_ASSERT(la3->isContained(2*unitVec[2]));
133
134 CPPUNIT_ASSERT(la1->isContained(3*unitVec[0]));
135 CPPUNIT_ASSERT(la2->isContained(3*unitVec[1]));
136 CPPUNIT_ASSERT(la3->isContained(3*unitVec[2]));
137
138 // negative multiples
139 CPPUNIT_ASSERT(la1->isContained(-1*unitVec[0]));
140 CPPUNIT_ASSERT(la2->isContained(-1*unitVec[1]));
141 CPPUNIT_ASSERT(la3->isContained(-1*unitVec[2]));
142
143 CPPUNIT_ASSERT(la1->isContained(-2*unitVec[0]));
144 CPPUNIT_ASSERT(la2->isContained(-2*unitVec[1]));
145 CPPUNIT_ASSERT(la3->isContained(-2*unitVec[2]));
146
147 // points that should not be on the lines
148 CPPUNIT_ASSERT(!la1->isContained(unitVec[1]));
149 CPPUNIT_ASSERT(!la2->isContained(unitVec[2]));
150 CPPUNIT_ASSERT(!la3->isContained(unitVec[0]));
151
152 CPPUNIT_ASSERT(!la1->isContained(2*unitVec[1]));
153 CPPUNIT_ASSERT(!la2->isContained(2*unitVec[2]));
154 CPPUNIT_ASSERT(!la3->isContained(2*unitVec[0]));
155
156 CPPUNIT_ASSERT(!la1->isContained(-1*unitVec[1]));
157 CPPUNIT_ASSERT(!la2->isContained(-1*unitVec[2]));
158 CPPUNIT_ASSERT(!la3->isContained(-1*unitVec[0]));
159
160 // For the plane lines
161 CPPUNIT_ASSERT(lp1->isContained(unitVec[0]));
162 CPPUNIT_ASSERT(lp2->isContained(unitVec[1]));
163 CPPUNIT_ASSERT(lp3->isContained(unitVec[2]));
164
165 CPPUNIT_ASSERT(lp1->isContained(unitVec[1]));
166 CPPUNIT_ASSERT(lp2->isContained(unitVec[2]));
167 CPPUNIT_ASSERT(lp3->isContained(unitVec[0]));
168
169 CPPUNIT_ASSERT(lp1->isContained(unitVec[0]+2*(unitVec[0]-unitVec[1])));
170 CPPUNIT_ASSERT(lp2->isContained(unitVec[1]+2*(unitVec[1]-unitVec[2])));
171 CPPUNIT_ASSERT(lp3->isContained(unitVec[2]+2*(unitVec[2]-unitVec[0])));
172
173 CPPUNIT_ASSERT(lp1->isContained(unitVec[0]-2*(unitVec[0]-unitVec[1])));
174 CPPUNIT_ASSERT(lp2->isContained(unitVec[1]-2*(unitVec[1]-unitVec[2])));
175 CPPUNIT_ASSERT(lp3->isContained(unitVec[2]-2*(unitVec[2]-unitVec[0])));
176}
177
178void LineUnittest::intersectionTest(){
179 Vector fixture;
180
181 // intersection of the axis lines
182 fixture = la1->getIntersection(*la2);
183 CPPUNIT_ASSERT_EQUAL(fixture,zeroVec);
184 fixture = la2->getIntersection(*la3);
185 CPPUNIT_ASSERT_EQUAL(fixture,zeroVec);
186 fixture = la3->getIntersection(*la1);
187 CPPUNIT_ASSERT_EQUAL(fixture,zeroVec);
188
189 // axes and plane lines
190 fixture = la1->getIntersection(*lp1);
191 CPPUNIT_ASSERT_EQUAL(fixture,unitVec[0]);
192 fixture = la2->getIntersection(*lp2);
193 CPPUNIT_ASSERT_EQUAL(fixture,unitVec[1]);
194 fixture = la3->getIntersection(*lp3);
195 CPPUNIT_ASSERT_EQUAL(fixture,unitVec[2]);
196
197 fixture = la1->getIntersection(*lp3);
198 CPPUNIT_ASSERT_EQUAL(fixture,unitVec[0]);
199 fixture = la2->getIntersection(*lp1);
200 CPPUNIT_ASSERT_EQUAL(fixture,unitVec[1]);
201 fixture = la3->getIntersection(*lp2);
202 CPPUNIT_ASSERT_EQUAL(fixture,unitVec[2]);
203
204 // two plane lines
205 fixture = lp1->getIntersection(*lp2);
206 CPPUNIT_ASSERT_EQUAL(fixture,unitVec[1]);
207 fixture = lp2->getIntersection(*lp3);
208 CPPUNIT_ASSERT_EQUAL(fixture,unitVec[2]);
209 fixture = lp3->getIntersection(*lp1);
210 CPPUNIT_ASSERT_EQUAL(fixture,unitVec[0]);
211
212 // When we have two times the same line, we check if the point is on the line
213 fixture = la1->getIntersection(*la1);
214 CPPUNIT_ASSERT(la1->isContained(fixture));
215 fixture = la2->getIntersection(*la2);
216 CPPUNIT_ASSERT(la2->isContained(fixture));
217 fixture = la3->getIntersection(*la3);
218 CPPUNIT_ASSERT(la3->isContained(fixture));
219
220 fixture = lp1->getIntersection(*lp1);
221 CPPUNIT_ASSERT(lp1->isContained(fixture));
222 fixture = lp2->getIntersection(*lp2);
223 CPPUNIT_ASSERT(lp2->isContained(fixture));
224 fixture = lp3->getIntersection(*lp3);
225 CPPUNIT_ASSERT(lp3->isContained(fixture));
226
227 // lines that are askew should produce an Error
228 CPPUNIT_ASSERT_THROW(lp1->getIntersection(*la3),SkewException);
229 CPPUNIT_ASSERT_THROW(lp2->getIntersection(*la1),SkewException);
230 CPPUNIT_ASSERT_THROW(lp3->getIntersection(*la2),SkewException);
231
232 CPPUNIT_ASSERT_THROW(la1->getIntersection(*lp2),SkewException);
233 CPPUNIT_ASSERT_THROW(la2->getIntersection(*lp3),SkewException);
234 CPPUNIT_ASSERT_THROW(la3->getIntersection(*lp1),SkewException);
235}
236
237void LineUnittest::rotationTest(){
238 Vector fixture;
239
240 // rotate zero Vector along the axes lines by various degrees
241 fixture = la1->rotateVector(zeroVec,1.);
242 CPPUNIT_ASSERT_EQUAL(fixture,zeroVec);
243 fixture = la2->rotateVector(zeroVec,1.);
244 CPPUNIT_ASSERT_EQUAL(fixture,zeroVec);
245 fixture = la3->rotateVector(zeroVec,1.);
246 CPPUNIT_ASSERT_EQUAL(fixture,zeroVec);
247
248 fixture = la1->rotateVector(zeroVec,2.);
249 CPPUNIT_ASSERT_EQUAL(fixture,zeroVec);
250 fixture = la2->rotateVector(zeroVec,2.);
251 CPPUNIT_ASSERT_EQUAL(fixture,zeroVec);
252 fixture = la3->rotateVector(zeroVec,2.);
253 CPPUNIT_ASSERT_EQUAL(fixture,zeroVec);
254
255 // rotate vectors on the axis around their lines
256 fixture = la1->rotateVector(unitVec[0],1.);
257 CPPUNIT_ASSERT_EQUAL(fixture,unitVec[0]);
258 fixture = la2->rotateVector(unitVec[1],1.);
259 CPPUNIT_ASSERT_EQUAL(fixture,unitVec[1]);
260 fixture = la3->rotateVector(unitVec[2],1.);
261 CPPUNIT_ASSERT_EQUAL(fixture,unitVec[2]);
262
263 fixture = la1->rotateVector(unitVec[0],2.);
264 CPPUNIT_ASSERT_EQUAL(fixture,unitVec[0]);
265 fixture = la2->rotateVector(unitVec[1],2.);
266 CPPUNIT_ASSERT_EQUAL(fixture,unitVec[1]);
267 fixture = la3->rotateVector(unitVec[2],2.);
268 CPPUNIT_ASSERT_EQUAL(fixture,unitVec[2]);
269
270 // more vectors on the axis
271 fixture = la1->rotateVector(2*unitVec[0],1.);
272 CPPUNIT_ASSERT_EQUAL(fixture,2*unitVec[0]);
273 fixture = la2->rotateVector(2*unitVec[1],1.);
274 CPPUNIT_ASSERT_EQUAL(fixture,2*unitVec[1]);
275 fixture = la3->rotateVector(2*unitVec[2],1.);
276 CPPUNIT_ASSERT_EQUAL(fixture,2*unitVec[2]);
277
278 fixture = la1->rotateVector(2*unitVec[0],2.);
279 CPPUNIT_ASSERT_EQUAL(fixture,2*unitVec[0]);
280 fixture = la2->rotateVector(2*unitVec[1],2.);
281 CPPUNIT_ASSERT_EQUAL(fixture,2*unitVec[1]);
282 fixture = la3->rotateVector(2*unitVec[2],2.);
283 CPPUNIT_ASSERT_EQUAL(fixture,2*unitVec[2]);
284
285 // negative factors
286 fixture = la1->rotateVector(-1*unitVec[0],1.);
287 CPPUNIT_ASSERT_EQUAL(fixture,-1*unitVec[0]);
288 fixture = la2->rotateVector(-1*unitVec[1],1.);
289 CPPUNIT_ASSERT_EQUAL(fixture,-1*unitVec[1]);
290 fixture = la3->rotateVector(-1*unitVec[2],1.);
291 CPPUNIT_ASSERT_EQUAL(fixture,-1*unitVec[2]);
292
293 fixture = la1->rotateVector(-1*unitVec[0],2.);
294 CPPUNIT_ASSERT_EQUAL(fixture,-1*unitVec[0]);
295 fixture = la2->rotateVector(-1*unitVec[1],2.);
296 CPPUNIT_ASSERT_EQUAL(fixture,-1*unitVec[1]);
297 fixture = la3->rotateVector(-1*unitVec[2],2.);
298 CPPUNIT_ASSERT_EQUAL(fixture,-1*unitVec[2]);
299
300
301
302 // now the real rotations
303 // unitVec[1] around unitVec[0]
304 fixture = la1->rotateVector(unitVec[1],0);
305 CPPUNIT_ASSERT_EQUAL(fixture,unitVec[1]);
306 fixture = la1->rotateVector(unitVec[1],1./2.*M_PI);
307 CPPUNIT_ASSERT_EQUAL(fixture,-1*unitVec[2]);
308 fixture = la1->rotateVector(unitVec[1],M_PI);
309 CPPUNIT_ASSERT_EQUAL(fixture,-1*unitVec[1]);
310 fixture = la1->rotateVector(unitVec[1],2*M_PI);
311 CPPUNIT_ASSERT_EQUAL(fixture,unitVec[1]);
312
313 // unitVec[2] around unitVec[1]
314 fixture = la2->rotateVector(unitVec[2],0);
315 CPPUNIT_ASSERT_EQUAL(fixture,unitVec[2]);
316 fixture = la2->rotateVector(unitVec[2],1./2.*M_PI);
317 CPPUNIT_ASSERT_EQUAL(fixture,-1*unitVec[0]);
318 fixture = la2->rotateVector(unitVec[2],M_PI);
319 CPPUNIT_ASSERT_EQUAL(fixture,-1*unitVec[2]);
320 fixture = la2->rotateVector(unitVec[2],2*M_PI);
321 CPPUNIT_ASSERT_EQUAL(fixture,unitVec[2]);
322
323 // unitVec[0] around unitVec[2]
324 fixture = la3->rotateVector(unitVec[0],0);
325 CPPUNIT_ASSERT_EQUAL(fixture,unitVec[0]);
326 fixture = la3->rotateVector(unitVec[0],1./2.*M_PI);
327 CPPUNIT_ASSERT_EQUAL(fixture,-1*unitVec[1]);
328 fixture = la3->rotateVector(unitVec[0],M_PI);
329 CPPUNIT_ASSERT_EQUAL(fixture,-1*unitVec[0]);
330 fixture = la3->rotateVector(unitVec[0],2*M_PI);
331 CPPUNIT_ASSERT_EQUAL(fixture,unitVec[0]);
332
333
334 // and some rotation around the plane lines
335
336 // Vectors on the line
337 fixture = lp1->rotateVector(unitVec[0],1.);
338 CPPUNIT_ASSERT_EQUAL(fixture,unitVec[0]);
339 fixture = lp1->rotateVector(unitVec[1],1.);
340 CPPUNIT_ASSERT_EQUAL(fixture,unitVec[1]);
341
342 fixture = lp2->rotateVector(unitVec[1],1.);
343 CPPUNIT_ASSERT_EQUAL(fixture,unitVec[1]);
344 fixture = lp2->rotateVector(unitVec[2],1.);
345 CPPUNIT_ASSERT_EQUAL(fixture,unitVec[2]);
346
347 fixture = lp3->rotateVector(unitVec[2],1.);
348 CPPUNIT_ASSERT_EQUAL(fixture,unitVec[2]);
349 fixture = lp3->rotateVector(unitVec[0],1.);
350 CPPUNIT_ASSERT_EQUAL(fixture,unitVec[0]);
351
352 // the real stuff
353 fixture = lp1->rotateVector(zeroVec,M_PI);
354 CPPUNIT_ASSERT_EQUAL(fixture,Vector(1,1,0));
355 fixture = lp2->rotateVector(zeroVec,M_PI);
356 CPPUNIT_ASSERT_EQUAL(fixture,Vector(0,1,1));
357 fixture = lp3->rotateVector(zeroVec,M_PI);
358 CPPUNIT_ASSERT_EQUAL(fixture,Vector(1,0,1));
359
360 fixture = lp1->rotateVector(zeroVec,2*M_PI);
361 CPPUNIT_ASSERT_EQUAL(fixture,zeroVec);
362 fixture = lp2->rotateVector(zeroVec,2*M_PI);
363 CPPUNIT_ASSERT_EQUAL(fixture,zeroVec);
364 fixture = lp3->rotateVector(zeroVec,2*M_PI);
365 CPPUNIT_ASSERT_EQUAL(fixture,zeroVec);
366}
367
368void LineUnittest::sphereIntersectionTest(){
369 {
370 std::vector<Vector> res = la1->getSphereIntersections();
371 CPPUNIT_ASSERT_EQUAL(res.size(),(size_t)2);
372 CPPUNIT_ASSERT(testDirection(res[0],unitVec[0]));
373 CPPUNIT_ASSERT(testDirection(res[1],unitVec[0]));
374 CPPUNIT_ASSERT(res[0]!=res[1]);
375 }
376
377 {
378 std::vector<Vector> res = la2->getSphereIntersections();
379 CPPUNIT_ASSERT_EQUAL(res.size(),(size_t)2);
380 CPPUNIT_ASSERT(testDirection(res[0],unitVec[1]));
381 CPPUNIT_ASSERT(testDirection(res[1],unitVec[1]));
382 CPPUNIT_ASSERT(res[0]!=res[1]);
383 }
384
385 {
386 std::vector<Vector> res = la3->getSphereIntersections();
387 CPPUNIT_ASSERT_EQUAL(res.size(),(size_t)2);
388 CPPUNIT_ASSERT(testDirection(res[0],unitVec[2]));
389 CPPUNIT_ASSERT(testDirection(res[1],unitVec[2]));
390 CPPUNIT_ASSERT(res[0]!=res[1]);
391 }
392
393 {
394 std::vector<Vector> res = lp1->getSphereIntersections();
395 CPPUNIT_ASSERT_EQUAL(res.size(),(size_t)2);
396 CPPUNIT_ASSERT((res[0]==unitVec[0]) || (res[0]==unitVec[1]));
397 CPPUNIT_ASSERT((res[1]==unitVec[0]) || (res[1]==unitVec[1]));
398 CPPUNIT_ASSERT(res[0]!=res[1]);
399 }
400
401 {
402 std::vector<Vector> res = lp2->getSphereIntersections();
403 CPPUNIT_ASSERT_EQUAL(res.size(),(size_t)2);
404 CPPUNIT_ASSERT((res[0]==unitVec[1]) || (res[0]==unitVec[2]));
405 CPPUNIT_ASSERT((res[1]==unitVec[1]) || (res[1]==unitVec[2]));
406 CPPUNIT_ASSERT(res[0]!=res[1]);
407 }
408
409 {
410 std::vector<Vector> res = lp3->getSphereIntersections();
411 CPPUNIT_ASSERT_EQUAL(res.size(),(size_t)2);
412 CPPUNIT_ASSERT((res[0]==unitVec[2]) || (res[0]==unitVec[0]));
413 CPPUNIT_ASSERT((res[1]==unitVec[2]) || (res[1]==unitVec[0]));
414 CPPUNIT_ASSERT(res[0]!=res[1]);
415 }
416}
Note: See TracBrowser for help on using the repository browser.