source: src/Shapes/unittests/BaseShapesUnitTest.cpp@ e9e86f

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
Last change on this file since e9e86f was 94d5ac6, checked in by Frederik Heber <heber@…>, 12 years ago

FIX: As we use GSL internally, we are as of now required to use GPL v2 license.

  • GNU Scientific Library is used at every place in the code, especially the sub-package LinearAlgebra is based on it which in turn is used really everywhere in the remainder of MoleCuilder. Hence, we have to use the GPL license for the whole of MoleCuilder. In effect, GPL's COPYING was present all along and stated the terms of the GPL v2 license.
  • Hence, I added the default GPL v2 disclaimer to every source file and removed the note about a (actually missing) LICENSE file.
  • also, I added a help-redistribute action which again gives the disclaimer of the GPL v2.
  • also, I changed in the disclaimer that is printed at every program start in builder_init.cpp.
  • TEST: Added check on GPL statement present in every module to test CodeChecks project-disclaimer.
  • Property mode set to 100644
File size: 27.4 KB
Line 
1/*
2 * Project: MoleCuilder
3 * Description: creates and alters molecular systems
4 * Copyright (C) 2010-2012 University of Bonn. All rights reserved.
5 *
6 *
7 * This file is part of MoleCuilder.
8 *
9 * MoleCuilder is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation, either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * MoleCuilder is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with MoleCuilder. If not, see <http://www.gnu.org/licenses/>.
21 */
22
23/*
24 * BaseShapesUnitTest.cpp
25 *
26 * Created on: Jun 18, 2010
27 * Author: crueger
28 */
29
30// include config.h
31#ifdef HAVE_CONFIG_H
32#include <config.h>
33#endif
34
35#include <cppunit/CompilerOutputter.h>
36#include <cppunit/extensions/TestFactoryRegistry.h>
37#include <cppunit/ui/text/TestRunner.h>
38
39#include <cmath>
40
41#ifdef HAVE_TESTRUNNER
42#include "UnitTestMain.hpp"
43#endif /*HAVE_TESTRUNNER*/
44
45#include "CodePatterns/Assert.hpp"
46
47#include "Helpers/defs.hpp"
48#include "LinearAlgebra/Vector.hpp"
49#include "Shapes/BaseShapes.hpp"
50#include "Shapes/Shape.hpp"
51#include "Shapes/ShapeOps.hpp"
52
53#include "BaseShapesUnitTest.hpp"
54
55// Registers the fixture into the 'registry'
56CPPUNIT_TEST_SUITE_REGISTRATION( BaseShapesTest );
57
58void BaseShapesTest::setUp()
59{
60 // failing asserts should be thrown
61 ASSERT_DO(Assert::Throw);
62
63 v000 = 0*unitVec[0]+0*unitVec[1]+0*unitVec[2];
64 v100 = 1*unitVec[0]+0*unitVec[1]+0*unitVec[2];
65 v200 = -1*unitVec[0]+0*unitVec[1]+0*unitVec[2];
66 v010 = 0*unitVec[0]+1*unitVec[1]+0*unitVec[2];
67 v110 = 1*unitVec[0]+1*unitVec[1]+0*unitVec[2];
68 v210 = -1*unitVec[0]+1*unitVec[1]+0*unitVec[2];
69 v020 = 0*unitVec[0]-1*unitVec[1]+0*unitVec[2];
70 v120 = 1*unitVec[0]-1*unitVec[1]+0*unitVec[2];
71 v220 = -1*unitVec[0]-1*unitVec[1]+0*unitVec[2];
72 v001 = 0*unitVec[0]+0*unitVec[1]+1*unitVec[2];
73 v101 = 1*unitVec[0]+0*unitVec[1]+1*unitVec[2];
74 v201 = -1*unitVec[0]+0*unitVec[1]+1*unitVec[2];
75 v011 = 0*unitVec[0]+1*unitVec[1]+1*unitVec[2];
76 v111 = 1*unitVec[0]+1*unitVec[1]+1*unitVec[2];
77 v211 = -1*unitVec[0]+1*unitVec[1]+1*unitVec[2];
78 v021 = 0*unitVec[0]-1*unitVec[1]+1*unitVec[2];
79 v121 = 1*unitVec[0]-1*unitVec[1]+1*unitVec[2];
80 v221 = -1*unitVec[0]-1*unitVec[1]+1*unitVec[2];
81 v002 = 0*unitVec[0]+0*unitVec[1]-1*unitVec[2];
82 v102 = 1*unitVec[0]+0*unitVec[1]-1*unitVec[2];
83 v202 = -1*unitVec[0]+0*unitVec[1]-1*unitVec[2];
84 v012 = 0*unitVec[0]+1*unitVec[1]-1*unitVec[2];
85 v112 = 1*unitVec[0]+1*unitVec[1]-1*unitVec[2];
86 v212 = -1*unitVec[0]+1*unitVec[1]-1*unitVec[2];
87 v022 = 0*unitVec[0]-1*unitVec[1]-1*unitVec[2];
88 v122 = 1*unitVec[0]-1*unitVec[1]-1*unitVec[2];
89 v222 = -1*unitVec[0]-1*unitVec[1]-1*unitVec[2];
90}
91
92void BaseShapesTest::tearDown()
93{}
94
95void BaseShapesTest::cylinderTest()
96{
97 Shape s = Cylinder();
98 // z = 0
99 // Quadrant 1 1
100 CPPUNIT_ASSERT( s.isInside(v000));
101 CPPUNIT_ASSERT( s.isInside(v100));
102 CPPUNIT_ASSERT(!s.isInside(v110));
103 CPPUNIT_ASSERT( s.isInside(v010));
104 // Quadrant 0 1
105 CPPUNIT_ASSERT(!s.isInside(v210));
106 CPPUNIT_ASSERT( s.isInside(v200));
107 // Quadrant 0 0
108 CPPUNIT_ASSERT(!s.isInside(v220));
109 CPPUNIT_ASSERT( s.isInside(v020));
110 // Quadrant 1 0
111 CPPUNIT_ASSERT(!s.isInside(v120));
112
113 // z = 1
114 // Quadrant 1 1
115 CPPUNIT_ASSERT( s.isInside(v001));
116 CPPUNIT_ASSERT( s.isInside(v101));
117 CPPUNIT_ASSERT(!s.isInside(v111));
118 CPPUNIT_ASSERT( s.isInside(v011));
119 // Quadrant 0 1
120 CPPUNIT_ASSERT(!s.isInside(v211));
121 CPPUNIT_ASSERT( s.isInside(v201));
122 // Quadrant 0 0
123 CPPUNIT_ASSERT(!s.isInside(v221));
124 CPPUNIT_ASSERT( s.isInside(v021));
125 // Quadrant 1 0
126 CPPUNIT_ASSERT(!s.isInside(v121));
127
128 // z = 2
129 // Quadrant 1 1
130 CPPUNIT_ASSERT( s.isInside(v002));
131 CPPUNIT_ASSERT( s.isInside(v102));
132 CPPUNIT_ASSERT(!s.isInside(v112));
133 CPPUNIT_ASSERT( s.isInside(v012));
134 // Quadrant 0 1
135 CPPUNIT_ASSERT(!s.isInside(v212));
136 CPPUNIT_ASSERT( s.isInside(v202));
137 // Quadrant 0 0
138 CPPUNIT_ASSERT(!s.isInside(v222));
139 CPPUNIT_ASSERT( s.isInside(v022));
140 // Quadrant 1 0
141 CPPUNIT_ASSERT(!s.isInside(v122));
142
143
144 // More special cylinder
145 s = Cylinder(Vector(0.5, 0.5, 0.0), 0.0, 30.0/180.0*M_PI, 4.0, 1.5);
146
147 CPPUNIT_ASSERT(!s.isInside(v222));
148 CPPUNIT_ASSERT(!s.isInside(v022));
149 CPPUNIT_ASSERT(!s.isInside(v122));
150 CPPUNIT_ASSERT( s.isInside(v202));
151 CPPUNIT_ASSERT( s.isInside(v002));
152 CPPUNIT_ASSERT( s.isInside(v102));
153 CPPUNIT_ASSERT( s.isInside(v212));
154 CPPUNIT_ASSERT( s.isInside(v012));
155 CPPUNIT_ASSERT( s.isInside(v112));
156
157 CPPUNIT_ASSERT(!s.isInside(v220));
158 CPPUNIT_ASSERT(!s.isInside(v020));
159 CPPUNIT_ASSERT(!s.isInside(v120));
160 CPPUNIT_ASSERT( s.isInside(v200));
161 CPPUNIT_ASSERT( s.isInside(v000));
162 CPPUNIT_ASSERT( s.isInside(v100));
163 CPPUNIT_ASSERT( s.isInside(v210));
164 CPPUNIT_ASSERT( s.isInside(v010));
165 CPPUNIT_ASSERT( s.isInside(v110));
166
167 CPPUNIT_ASSERT(!s.isInside(v221));
168 CPPUNIT_ASSERT(!s.isInside(v021));
169 CPPUNIT_ASSERT(!s.isInside(v121));
170 CPPUNIT_ASSERT(!s.isInside(v201));
171 CPPUNIT_ASSERT( s.isInside(v001));
172 CPPUNIT_ASSERT( s.isInside(v101));
173 CPPUNIT_ASSERT(!s.isInside(v211));
174 CPPUNIT_ASSERT( s.isInside(v011));
175 CPPUNIT_ASSERT( s.isInside(v111));
176}
177
178void BaseShapesTest::baseShapesTest(){
179 CPPUNIT_ASSERT(!Nowhere().isInside(v000));
180 CPPUNIT_ASSERT(!Nowhere().isInside(v100));
181 CPPUNIT_ASSERT(!Nowhere().isInside(v200));
182 CPPUNIT_ASSERT(!Nowhere().isInside(v010));
183 CPPUNIT_ASSERT(!Nowhere().isInside(v110));
184 CPPUNIT_ASSERT(!Nowhere().isInside(v210));
185 CPPUNIT_ASSERT(!Nowhere().isInside(v020));
186 CPPUNIT_ASSERT(!Nowhere().isInside(v120));
187 CPPUNIT_ASSERT(!Nowhere().isInside(v220));
188 CPPUNIT_ASSERT(!Nowhere().isInside(v001));
189 CPPUNIT_ASSERT(!Nowhere().isInside(v101));
190 CPPUNIT_ASSERT(!Nowhere().isInside(v201));
191 CPPUNIT_ASSERT(!Nowhere().isInside(v011));
192 CPPUNIT_ASSERT(!Nowhere().isInside(v111));
193 CPPUNIT_ASSERT(!Nowhere().isInside(v211));
194 CPPUNIT_ASSERT(!Nowhere().isInside(v021));
195 CPPUNIT_ASSERT(!Nowhere().isInside(v121));
196 CPPUNIT_ASSERT(!Nowhere().isInside(v221));
197 CPPUNIT_ASSERT(!Nowhere().isInside(v002));
198 CPPUNIT_ASSERT(!Nowhere().isInside(v102));
199 CPPUNIT_ASSERT(!Nowhere().isInside(v202));
200 CPPUNIT_ASSERT(!Nowhere().isInside(v012));
201 CPPUNIT_ASSERT(!Nowhere().isInside(v112));
202 CPPUNIT_ASSERT(!Nowhere().isInside(v212));
203 CPPUNIT_ASSERT(!Nowhere().isInside(v022));
204 CPPUNIT_ASSERT(!Nowhere().isInside(v122));
205 CPPUNIT_ASSERT(!Nowhere().isInside(v222));
206
207 CPPUNIT_ASSERT(Everywhere().isInside(v000));
208 CPPUNIT_ASSERT(Everywhere().isInside(v100));
209 CPPUNIT_ASSERT(Everywhere().isInside(v200));
210 CPPUNIT_ASSERT(Everywhere().isInside(v010));
211 CPPUNIT_ASSERT(Everywhere().isInside(v110));
212 CPPUNIT_ASSERT(Everywhere().isInside(v210));
213 CPPUNIT_ASSERT(Everywhere().isInside(v020));
214 CPPUNIT_ASSERT(Everywhere().isInside(v120));
215 CPPUNIT_ASSERT(Everywhere().isInside(v220));
216 CPPUNIT_ASSERT(Everywhere().isInside(v001));
217 CPPUNIT_ASSERT(Everywhere().isInside(v101));
218 CPPUNIT_ASSERT(Everywhere().isInside(v201));
219 CPPUNIT_ASSERT(Everywhere().isInside(v011));
220 CPPUNIT_ASSERT(Everywhere().isInside(v111));
221 CPPUNIT_ASSERT(Everywhere().isInside(v211));
222 CPPUNIT_ASSERT(Everywhere().isInside(v021));
223 CPPUNIT_ASSERT(Everywhere().isInside(v121));
224 CPPUNIT_ASSERT(Everywhere().isInside(v221));
225 CPPUNIT_ASSERT(Everywhere().isInside(v002));
226 CPPUNIT_ASSERT(Everywhere().isInside(v102));
227 CPPUNIT_ASSERT(Everywhere().isInside(v202));
228 CPPUNIT_ASSERT(Everywhere().isInside(v012));
229 CPPUNIT_ASSERT(Everywhere().isInside(v112));
230 CPPUNIT_ASSERT(Everywhere().isInside(v212));
231 CPPUNIT_ASSERT(Everywhere().isInside(v022));
232 CPPUNIT_ASSERT(Everywhere().isInside(v122));
233 CPPUNIT_ASSERT(Everywhere().isInside(v222));
234
235 Shape s1 = Sphere();
236
237 CPPUNIT_ASSERT(s1.isInside(v000));
238 CPPUNIT_ASSERT(s1.isInside(v100));
239 CPPUNIT_ASSERT(s1.isInside(v200));
240 CPPUNIT_ASSERT(s1.isInside(v010));
241 CPPUNIT_ASSERT(!s1.isInside(v110));
242 CPPUNIT_ASSERT(!s1.isInside(v210));
243 CPPUNIT_ASSERT(s1.isInside(v020));
244 CPPUNIT_ASSERT(!s1.isInside(v120));
245 CPPUNIT_ASSERT(!s1.isInside(v220));
246 CPPUNIT_ASSERT(s1.isInside(v001));
247 CPPUNIT_ASSERT(!s1.isInside(v101));
248 CPPUNIT_ASSERT(!s1.isInside(v201));
249 CPPUNIT_ASSERT(!s1.isInside(v011));
250 CPPUNIT_ASSERT(!s1.isInside(v111));
251 CPPUNIT_ASSERT(!s1.isInside(v211));
252 CPPUNIT_ASSERT(!s1.isInside(v021));
253 CPPUNIT_ASSERT(!s1.isInside(v121));
254 CPPUNIT_ASSERT(!s1.isInside(v221));
255 CPPUNIT_ASSERT(s1.isInside(v002));
256 CPPUNIT_ASSERT(!s1.isInside(v102));
257 CPPUNIT_ASSERT(!s1.isInside(v202));
258 CPPUNIT_ASSERT(!s1.isInside(v012));
259 CPPUNIT_ASSERT(!s1.isInside(v112));
260 CPPUNIT_ASSERT(!s1.isInside(v212));
261 CPPUNIT_ASSERT(!s1.isInside(v022));
262 CPPUNIT_ASSERT(!s1.isInside(v122));
263 CPPUNIT_ASSERT(!s1.isInside(v222));
264
265 Shape s2 = Cuboid();
266
267 CPPUNIT_ASSERT(s2.isInside(v000));
268 CPPUNIT_ASSERT(s2.isInside(v100));
269 CPPUNIT_ASSERT(!s2.isInside(v200));
270 CPPUNIT_ASSERT(s2.isInside(v010));
271 CPPUNIT_ASSERT(s2.isInside(v110));
272 CPPUNIT_ASSERT(!s2.isInside(v210));
273 CPPUNIT_ASSERT(!s2.isInside(v020));
274 CPPUNIT_ASSERT(!s2.isInside(v120));
275 CPPUNIT_ASSERT(!s2.isInside(v220));
276 CPPUNIT_ASSERT(s2.isInside(v001));
277 CPPUNIT_ASSERT(s2.isInside(v101));
278 CPPUNIT_ASSERT(!s2.isInside(v201));
279 CPPUNIT_ASSERT(s2.isInside(v011));
280 CPPUNIT_ASSERT(s2.isInside(v111));
281 CPPUNIT_ASSERT(!s2.isInside(v211));
282 CPPUNIT_ASSERT(!s2.isInside(v021));
283 CPPUNIT_ASSERT(!s2.isInside(v121));
284 CPPUNIT_ASSERT(!s2.isInside(v221));
285 CPPUNIT_ASSERT(!s2.isInside(v002));
286 CPPUNIT_ASSERT(!s2.isInside(v102));
287 CPPUNIT_ASSERT(!s2.isInside(v202));
288 CPPUNIT_ASSERT(!s2.isInside(v012));
289 CPPUNIT_ASSERT(!s2.isInside(v112));
290 CPPUNIT_ASSERT(!s2.isInside(v212));
291 CPPUNIT_ASSERT(!s2.isInside(v022));
292 CPPUNIT_ASSERT(!s2.isInside(v122));
293 CPPUNIT_ASSERT(!s2.isInside(v222));
294}
295
296void BaseShapesTest::surfaceTest(){
297 CPPUNIT_ASSERT(!Nowhere().isOnSurface(v000));
298 CPPUNIT_ASSERT(!Nowhere().isOnSurface(v100));
299 CPPUNIT_ASSERT(!Nowhere().isOnSurface(v200));
300 CPPUNIT_ASSERT(!Nowhere().isOnSurface(v010));
301 CPPUNIT_ASSERT(!Nowhere().isOnSurface(v110));
302 CPPUNIT_ASSERT(!Nowhere().isOnSurface(v210));
303 CPPUNIT_ASSERT(!Nowhere().isOnSurface(v020));
304 CPPUNIT_ASSERT(!Nowhere().isOnSurface(v120));
305 CPPUNIT_ASSERT(!Nowhere().isOnSurface(v220));
306 CPPUNIT_ASSERT(!Nowhere().isOnSurface(v001));
307 CPPUNIT_ASSERT(!Nowhere().isOnSurface(v101));
308 CPPUNIT_ASSERT(!Nowhere().isOnSurface(v201));
309 CPPUNIT_ASSERT(!Nowhere().isOnSurface(v011));
310 CPPUNIT_ASSERT(!Nowhere().isOnSurface(v111));
311 CPPUNIT_ASSERT(!Nowhere().isOnSurface(v211));
312 CPPUNIT_ASSERT(!Nowhere().isOnSurface(v021));
313 CPPUNIT_ASSERT(!Nowhere().isOnSurface(v121));
314 CPPUNIT_ASSERT(!Nowhere().isOnSurface(v221));
315 CPPUNIT_ASSERT(!Nowhere().isOnSurface(v002));
316 CPPUNIT_ASSERT(!Nowhere().isOnSurface(v102));
317 CPPUNIT_ASSERT(!Nowhere().isOnSurface(v202));
318 CPPUNIT_ASSERT(!Nowhere().isOnSurface(v012));
319 CPPUNIT_ASSERT(!Nowhere().isOnSurface(v112));
320 CPPUNIT_ASSERT(!Nowhere().isOnSurface(v212));
321 CPPUNIT_ASSERT(!Nowhere().isOnSurface(v022));
322 CPPUNIT_ASSERT(!Nowhere().isOnSurface(v122));
323 CPPUNIT_ASSERT(!Nowhere().isOnSurface(v222));
324
325 CPPUNIT_ASSERT(Cuboid().isOnSurface(v000));
326 CPPUNIT_ASSERT(Cuboid().isOnSurface(v100));
327 CPPUNIT_ASSERT(!Cuboid().isOnSurface(v200));
328 CPPUNIT_ASSERT(Cuboid().isOnSurface(v010));
329 CPPUNIT_ASSERT(Cuboid().isOnSurface(v110));
330 CPPUNIT_ASSERT(!Cuboid().isOnSurface(v210));
331 CPPUNIT_ASSERT(!Cuboid().isOnSurface(v020));
332 CPPUNIT_ASSERT(!Cuboid().isOnSurface(v120));
333 CPPUNIT_ASSERT(!Cuboid().isOnSurface(v220));
334 CPPUNIT_ASSERT(Cuboid().isOnSurface(v001));
335 CPPUNIT_ASSERT(Cuboid().isOnSurface(v101));
336 CPPUNIT_ASSERT(!Cuboid().isOnSurface(v201));
337 CPPUNIT_ASSERT(Cuboid().isOnSurface(v011));
338 CPPUNIT_ASSERT(Cuboid().isOnSurface(v111));
339 CPPUNIT_ASSERT(!Cuboid().isOnSurface(v211));
340 CPPUNIT_ASSERT(!Cuboid().isOnSurface(v021));
341 CPPUNIT_ASSERT(!Cuboid().isOnSurface(v121));
342 CPPUNIT_ASSERT(!Cuboid().isOnSurface(v221));
343 CPPUNIT_ASSERT(!Cuboid().isOnSurface(v002));
344 CPPUNIT_ASSERT(!Cuboid().isOnSurface(v102));
345 CPPUNIT_ASSERT(!Cuboid().isOnSurface(v202));
346 CPPUNIT_ASSERT(!Cuboid().isOnSurface(v012));
347 CPPUNIT_ASSERT(!Cuboid().isOnSurface(v112));
348 CPPUNIT_ASSERT(!Cuboid().isOnSurface(v212));
349 CPPUNIT_ASSERT(!Cuboid().isOnSurface(v022));
350 CPPUNIT_ASSERT(!Cuboid().isOnSurface(v122));
351 CPPUNIT_ASSERT(!Cuboid().isOnSurface(v222));
352
353 CPPUNIT_ASSERT(!Sphere().isOnSurface(v000));
354 CPPUNIT_ASSERT(Sphere().isOnSurface(v100));
355 CPPUNIT_ASSERT(Sphere().isOnSurface(v200));
356 CPPUNIT_ASSERT(Sphere().isOnSurface(v010));
357 CPPUNIT_ASSERT(!Sphere().isOnSurface(v110));
358 CPPUNIT_ASSERT(!Sphere().isOnSurface(v210));
359 CPPUNIT_ASSERT(Sphere().isOnSurface(v020));
360 CPPUNIT_ASSERT(!Sphere().isOnSurface(v120));
361 CPPUNIT_ASSERT(!Sphere().isOnSurface(v220));
362 CPPUNIT_ASSERT(Sphere().isOnSurface(v001));
363 CPPUNIT_ASSERT(!Sphere().isOnSurface(v101));
364 CPPUNIT_ASSERT(!Sphere().isOnSurface(v201));
365 CPPUNIT_ASSERT(!Sphere().isOnSurface(v011));
366 CPPUNIT_ASSERT(!Sphere().isOnSurface(v111));
367 CPPUNIT_ASSERT(!Sphere().isOnSurface(v211));
368 CPPUNIT_ASSERT(!Sphere().isOnSurface(v021));
369 CPPUNIT_ASSERT(!Sphere().isOnSurface(v121));
370 CPPUNIT_ASSERT(!Sphere().isOnSurface(v221));
371 CPPUNIT_ASSERT(Sphere().isOnSurface(v002));
372 CPPUNIT_ASSERT(!Sphere().isOnSurface(v102));
373 CPPUNIT_ASSERT(!Sphere().isOnSurface(v202));
374 CPPUNIT_ASSERT(!Sphere().isOnSurface(v012));
375 CPPUNIT_ASSERT(!Sphere().isOnSurface(v112));
376 CPPUNIT_ASSERT(!Sphere().isOnSurface(v212));
377 CPPUNIT_ASSERT(!Sphere().isOnSurface(v022));
378 CPPUNIT_ASSERT(!Sphere().isOnSurface(v122));
379 CPPUNIT_ASSERT(!Sphere().isOnSurface(v222));
380}
381
382void BaseShapesTest::assignmentTest(){
383 Shape s1 = Nowhere();
384 s1 = Everywhere();
385
386 CPPUNIT_ASSERT(s1.isInside(v000));
387 CPPUNIT_ASSERT(s1.isInside(v100));
388 CPPUNIT_ASSERT(s1.isInside(v200));
389 CPPUNIT_ASSERT(s1.isInside(v010));
390 CPPUNIT_ASSERT(s1.isInside(v110));
391 CPPUNIT_ASSERT(s1.isInside(v210));
392 CPPUNIT_ASSERT(s1.isInside(v020));
393 CPPUNIT_ASSERT(s1.isInside(v120));
394 CPPUNIT_ASSERT(s1.isInside(v220));
395 CPPUNIT_ASSERT(s1.isInside(v001));
396 CPPUNIT_ASSERT(s1.isInside(v101));
397 CPPUNIT_ASSERT(s1.isInside(v201));
398 CPPUNIT_ASSERT(s1.isInside(v011));
399 CPPUNIT_ASSERT(s1.isInside(v111));
400 CPPUNIT_ASSERT(s1.isInside(v211));
401 CPPUNIT_ASSERT(s1.isInside(v021));
402 CPPUNIT_ASSERT(s1.isInside(v121));
403 CPPUNIT_ASSERT(s1.isInside(v221));
404 CPPUNIT_ASSERT(s1.isInside(v002));
405 CPPUNIT_ASSERT(s1.isInside(v102));
406 CPPUNIT_ASSERT(s1.isInside(v202));
407 CPPUNIT_ASSERT(s1.isInside(v012));
408 CPPUNIT_ASSERT(s1.isInside(v112));
409 CPPUNIT_ASSERT(s1.isInside(v212));
410 CPPUNIT_ASSERT(s1.isInside(v022));
411 CPPUNIT_ASSERT(s1.isInside(v122));
412 CPPUNIT_ASSERT(s1.isInside(v222));
413
414 Shape s2 = Everywhere();
415 s2 = Nowhere();
416
417 CPPUNIT_ASSERT(!s2.isInside(v000));
418 CPPUNIT_ASSERT(!s2.isInside(v100));
419 CPPUNIT_ASSERT(!s2.isInside(v200));
420 CPPUNIT_ASSERT(!s2.isInside(v010));
421 CPPUNIT_ASSERT(!s2.isInside(v110));
422 CPPUNIT_ASSERT(!s2.isInside(v210));
423 CPPUNIT_ASSERT(!s2.isInside(v020));
424 CPPUNIT_ASSERT(!s2.isInside(v120));
425 CPPUNIT_ASSERT(!s2.isInside(v220));
426 CPPUNIT_ASSERT(!s2.isInside(v001));
427 CPPUNIT_ASSERT(!s2.isInside(v101));
428 CPPUNIT_ASSERT(!s2.isInside(v201));
429 CPPUNIT_ASSERT(!s2.isInside(v011));
430 CPPUNIT_ASSERT(!s2.isInside(v111));
431 CPPUNIT_ASSERT(!s2.isInside(v211));
432 CPPUNIT_ASSERT(!s2.isInside(v021));
433 CPPUNIT_ASSERT(!s2.isInside(v121));
434 CPPUNIT_ASSERT(!s2.isInside(v221));
435 CPPUNIT_ASSERT(!s2.isInside(v002));
436 CPPUNIT_ASSERT(!s2.isInside(v102));
437 CPPUNIT_ASSERT(!s2.isInside(v202));
438 CPPUNIT_ASSERT(!s2.isInside(v012));
439 CPPUNIT_ASSERT(!s2.isInside(v112));
440 CPPUNIT_ASSERT(!s2.isInside(v212));
441 CPPUNIT_ASSERT(!s2.isInside(v022));
442 CPPUNIT_ASSERT(!s2.isInside(v122));
443 CPPUNIT_ASSERT(!s2.isInside(v222));
444
445}
446
447void BaseShapesTest::operatorTest(){
448 {
449 Shape s1 = !Nowhere();
450 CPPUNIT_ASSERT(s1.isInside(v000));
451 CPPUNIT_ASSERT(s1.isInside(v100));
452 CPPUNIT_ASSERT(s1.isInside(v200));
453 CPPUNIT_ASSERT(s1.isInside(v010));
454 CPPUNIT_ASSERT(s1.isInside(v110));
455 CPPUNIT_ASSERT(s1.isInside(v210));
456 CPPUNIT_ASSERT(s1.isInside(v020));
457 CPPUNIT_ASSERT(s1.isInside(v120));
458 CPPUNIT_ASSERT(s1.isInside(v220));
459 CPPUNIT_ASSERT(s1.isInside(v001));
460 CPPUNIT_ASSERT(s1.isInside(v101));
461 CPPUNIT_ASSERT(s1.isInside(v201));
462 CPPUNIT_ASSERT(s1.isInside(v011));
463 CPPUNIT_ASSERT(s1.isInside(v111));
464 CPPUNIT_ASSERT(s1.isInside(v211));
465 CPPUNIT_ASSERT(s1.isInside(v021));
466 CPPUNIT_ASSERT(s1.isInside(v121));
467 CPPUNIT_ASSERT(s1.isInside(v221));
468 CPPUNIT_ASSERT(s1.isInside(v002));
469 CPPUNIT_ASSERT(s1.isInside(v102));
470 CPPUNIT_ASSERT(s1.isInside(v202));
471 CPPUNIT_ASSERT(s1.isInside(v012));
472 CPPUNIT_ASSERT(s1.isInside(v112));
473 CPPUNIT_ASSERT(s1.isInside(v212));
474 CPPUNIT_ASSERT(s1.isInside(v022));
475 CPPUNIT_ASSERT(s1.isInside(v122));
476 CPPUNIT_ASSERT(s1.isInside(v222));
477
478 Shape s2 = !Everywhere();
479 CPPUNIT_ASSERT(!s2.isInside(v000));
480 CPPUNIT_ASSERT(!s2.isInside(v100));
481 CPPUNIT_ASSERT(!s2.isInside(v200));
482 CPPUNIT_ASSERT(!s2.isInside(v010));
483 CPPUNIT_ASSERT(!s2.isInside(v110));
484 CPPUNIT_ASSERT(!s2.isInside(v210));
485 CPPUNIT_ASSERT(!s2.isInside(v020));
486 CPPUNIT_ASSERT(!s2.isInside(v120));
487 CPPUNIT_ASSERT(!s2.isInside(v220));
488 CPPUNIT_ASSERT(!s2.isInside(v001));
489 CPPUNIT_ASSERT(!s2.isInside(v101));
490 CPPUNIT_ASSERT(!s2.isInside(v201));
491 CPPUNIT_ASSERT(!s2.isInside(v011));
492 CPPUNIT_ASSERT(!s2.isInside(v111));
493 CPPUNIT_ASSERT(!s2.isInside(v211));
494 CPPUNIT_ASSERT(!s2.isInside(v021));
495 CPPUNIT_ASSERT(!s2.isInside(v121));
496 CPPUNIT_ASSERT(!s2.isInside(v221));
497 CPPUNIT_ASSERT(!s2.isInside(v002));
498 CPPUNIT_ASSERT(!s2.isInside(v102));
499 CPPUNIT_ASSERT(!s2.isInside(v202));
500 CPPUNIT_ASSERT(!s2.isInside(v012));
501 CPPUNIT_ASSERT(!s2.isInside(v112));
502 CPPUNIT_ASSERT(!s2.isInside(v212));
503 CPPUNIT_ASSERT(!s2.isInside(v022));
504 CPPUNIT_ASSERT(!s2.isInside(v122));
505 CPPUNIT_ASSERT(!s2.isInside(v222));
506 }
507
508 {
509 Shape s1 = Nowhere() || Everywhere();
510 CPPUNIT_ASSERT(s1.isInside(v000));
511 CPPUNIT_ASSERT(s1.isInside(v100));
512 CPPUNIT_ASSERT(s1.isInside(v200));
513 CPPUNIT_ASSERT(s1.isInside(v010));
514 CPPUNIT_ASSERT(s1.isInside(v110));
515 CPPUNIT_ASSERT(s1.isInside(v210));
516 CPPUNIT_ASSERT(s1.isInside(v020));
517 CPPUNIT_ASSERT(s1.isInside(v120));
518 CPPUNIT_ASSERT(s1.isInside(v220));
519 CPPUNIT_ASSERT(s1.isInside(v001));
520 CPPUNIT_ASSERT(s1.isInside(v101));
521 CPPUNIT_ASSERT(s1.isInside(v201));
522 CPPUNIT_ASSERT(s1.isInside(v011));
523 CPPUNIT_ASSERT(s1.isInside(v111));
524 CPPUNIT_ASSERT(s1.isInside(v211));
525 CPPUNIT_ASSERT(s1.isInside(v021));
526 CPPUNIT_ASSERT(s1.isInside(v121));
527 CPPUNIT_ASSERT(s1.isInside(v221));
528 CPPUNIT_ASSERT(s1.isInside(v002));
529 CPPUNIT_ASSERT(s1.isInside(v102));
530 CPPUNIT_ASSERT(s1.isInside(v202));
531 CPPUNIT_ASSERT(s1.isInside(v012));
532 CPPUNIT_ASSERT(s1.isInside(v112));
533 CPPUNIT_ASSERT(s1.isInside(v212));
534 CPPUNIT_ASSERT(s1.isInside(v022));
535 CPPUNIT_ASSERT(s1.isInside(v122));
536 CPPUNIT_ASSERT(s1.isInside(v222));
537
538 Shape s2 = Nowhere() && Everywhere();
539 CPPUNIT_ASSERT(!s2.isInside(v000));
540 CPPUNIT_ASSERT(!s2.isInside(v100));
541 CPPUNIT_ASSERT(!s2.isInside(v200));
542 CPPUNIT_ASSERT(!s2.isInside(v010));
543 CPPUNIT_ASSERT(!s2.isInside(v110));
544 CPPUNIT_ASSERT(!s2.isInside(v210));
545 CPPUNIT_ASSERT(!s2.isInside(v020));
546 CPPUNIT_ASSERT(!s2.isInside(v120));
547 CPPUNIT_ASSERT(!s2.isInside(v220));
548 CPPUNIT_ASSERT(!s2.isInside(v001));
549 CPPUNIT_ASSERT(!s2.isInside(v101));
550 CPPUNIT_ASSERT(!s2.isInside(v201));
551 CPPUNIT_ASSERT(!s2.isInside(v011));
552 CPPUNIT_ASSERT(!s2.isInside(v111));
553 CPPUNIT_ASSERT(!s2.isInside(v211));
554 CPPUNIT_ASSERT(!s2.isInside(v021));
555 CPPUNIT_ASSERT(!s2.isInside(v121));
556 CPPUNIT_ASSERT(!s2.isInside(v221));
557 CPPUNIT_ASSERT(!s2.isInside(v002));
558 CPPUNIT_ASSERT(!s2.isInside(v102));
559 CPPUNIT_ASSERT(!s2.isInside(v202));
560 CPPUNIT_ASSERT(!s2.isInside(v012));
561 CPPUNIT_ASSERT(!s2.isInside(v112));
562 CPPUNIT_ASSERT(!s2.isInside(v212));
563 CPPUNIT_ASSERT(!s2.isInside(v022));
564 CPPUNIT_ASSERT(!s2.isInside(v122));
565 CPPUNIT_ASSERT(!s2.isInside(v222));
566 }
567
568 {
569 Shape s1 = Everywhere() || Nowhere();
570 CPPUNIT_ASSERT(s1.isInside(v000));
571 CPPUNIT_ASSERT(s1.isInside(v100));
572 CPPUNIT_ASSERT(s1.isInside(v200));
573 CPPUNIT_ASSERT(s1.isInside(v010));
574 CPPUNIT_ASSERT(s1.isInside(v110));
575 CPPUNIT_ASSERT(s1.isInside(v210));
576 CPPUNIT_ASSERT(s1.isInside(v020));
577 CPPUNIT_ASSERT(s1.isInside(v120));
578 CPPUNIT_ASSERT(s1.isInside(v220));
579 CPPUNIT_ASSERT(s1.isInside(v001));
580 CPPUNIT_ASSERT(s1.isInside(v101));
581 CPPUNIT_ASSERT(s1.isInside(v201));
582 CPPUNIT_ASSERT(s1.isInside(v011));
583 CPPUNIT_ASSERT(s1.isInside(v111));
584 CPPUNIT_ASSERT(s1.isInside(v211));
585 CPPUNIT_ASSERT(s1.isInside(v021));
586 CPPUNIT_ASSERT(s1.isInside(v121));
587 CPPUNIT_ASSERT(s1.isInside(v221));
588 CPPUNIT_ASSERT(s1.isInside(v002));
589 CPPUNIT_ASSERT(s1.isInside(v102));
590 CPPUNIT_ASSERT(s1.isInside(v202));
591 CPPUNIT_ASSERT(s1.isInside(v012));
592 CPPUNIT_ASSERT(s1.isInside(v112));
593 CPPUNIT_ASSERT(s1.isInside(v212));
594 CPPUNIT_ASSERT(s1.isInside(v022));
595 CPPUNIT_ASSERT(s1.isInside(v122));
596 CPPUNIT_ASSERT(s1.isInside(v222));
597
598 Shape s2 = Everywhere() && Nowhere();
599 CPPUNIT_ASSERT(!s2.isInside(v000));
600 CPPUNIT_ASSERT(!s2.isInside(v100));
601 CPPUNIT_ASSERT(!s2.isInside(v200));
602 CPPUNIT_ASSERT(!s2.isInside(v010));
603 CPPUNIT_ASSERT(!s2.isInside(v110));
604 CPPUNIT_ASSERT(!s2.isInside(v210));
605 CPPUNIT_ASSERT(!s2.isInside(v020));
606 CPPUNIT_ASSERT(!s2.isInside(v120));
607 CPPUNIT_ASSERT(!s2.isInside(v220));
608 CPPUNIT_ASSERT(!s2.isInside(v001));
609 CPPUNIT_ASSERT(!s2.isInside(v101));
610 CPPUNIT_ASSERT(!s2.isInside(v201));
611 CPPUNIT_ASSERT(!s2.isInside(v011));
612 CPPUNIT_ASSERT(!s2.isInside(v111));
613 CPPUNIT_ASSERT(!s2.isInside(v211));
614 CPPUNIT_ASSERT(!s2.isInside(v021));
615 CPPUNIT_ASSERT(!s2.isInside(v121));
616 CPPUNIT_ASSERT(!s2.isInside(v221));
617 CPPUNIT_ASSERT(!s2.isInside(v002));
618 CPPUNIT_ASSERT(!s2.isInside(v102));
619 CPPUNIT_ASSERT(!s2.isInside(v202));
620 CPPUNIT_ASSERT(!s2.isInside(v012));
621 CPPUNIT_ASSERT(!s2.isInside(v112));
622 CPPUNIT_ASSERT(!s2.isInside(v212));
623 CPPUNIT_ASSERT(!s2.isInside(v022));
624 CPPUNIT_ASSERT(!s2.isInside(v122));
625 CPPUNIT_ASSERT(!s2.isInside(v222));
626 }
627
628 {
629 Shape s1 = Sphere() && Cuboid(); // Sphere in upper place
630
631 CPPUNIT_ASSERT(s1.isInside(v000));
632 CPPUNIT_ASSERT(s1.isInside(v100));
633 CPPUNIT_ASSERT(!s1.isInside(v200));
634 CPPUNIT_ASSERT(s1.isInside(v010));
635 CPPUNIT_ASSERT(!s1.isInside(v110));
636 CPPUNIT_ASSERT(!s1.isInside(v210));
637 CPPUNIT_ASSERT(!s1.isInside(v020));
638 CPPUNIT_ASSERT(!s1.isInside(v120));
639 CPPUNIT_ASSERT(!s1.isInside(v220));
640 CPPUNIT_ASSERT(s1.isInside(v001));
641 CPPUNIT_ASSERT(!s1.isInside(v101));
642 CPPUNIT_ASSERT(!s1.isInside(v201));
643 CPPUNIT_ASSERT(!s1.isInside(v011));
644 CPPUNIT_ASSERT(!s1.isInside(v111));
645 CPPUNIT_ASSERT(!s1.isInside(v211));
646 CPPUNIT_ASSERT(!s1.isInside(v021));
647 CPPUNIT_ASSERT(!s1.isInside(v121));
648 CPPUNIT_ASSERT(!s1.isInside(v221));
649 CPPUNIT_ASSERT(!s1.isInside(v002));
650 CPPUNIT_ASSERT(!s1.isInside(v102));
651 CPPUNIT_ASSERT(!s1.isInside(v202));
652 CPPUNIT_ASSERT(!s1.isInside(v012));
653 CPPUNIT_ASSERT(!s1.isInside(v112));
654 CPPUNIT_ASSERT(!s1.isInside(v212));
655 CPPUNIT_ASSERT(!s1.isInside(v022));
656 CPPUNIT_ASSERT(!s1.isInside(v122));
657 CPPUNIT_ASSERT(!s1.isInside(v222));
658
659 CPPUNIT_ASSERT(s1.isOnSurface(v000));
660 CPPUNIT_ASSERT(s1.isOnSurface(v100));
661 CPPUNIT_ASSERT(!s1.isOnSurface(v200));
662 CPPUNIT_ASSERT(s1.isOnSurface(v010));
663 CPPUNIT_ASSERT(!s1.isOnSurface(v110));
664 CPPUNIT_ASSERT(!s1.isOnSurface(v210));
665 CPPUNIT_ASSERT(!s1.isOnSurface(v020));
666 CPPUNIT_ASSERT(!s1.isOnSurface(v120));
667 CPPUNIT_ASSERT(!s1.isOnSurface(v220));
668 CPPUNIT_ASSERT(s1.isOnSurface(v001));
669 CPPUNIT_ASSERT(!s1.isOnSurface(v101));
670 CPPUNIT_ASSERT(!s1.isOnSurface(v201));
671 CPPUNIT_ASSERT(!s1.isOnSurface(v011));
672 CPPUNIT_ASSERT(!s1.isOnSurface(v111));
673 CPPUNIT_ASSERT(!s1.isOnSurface(v211));
674 CPPUNIT_ASSERT(!s1.isOnSurface(v021));
675 CPPUNIT_ASSERT(!s1.isOnSurface(v121));
676 CPPUNIT_ASSERT(!s1.isOnSurface(v221));
677 CPPUNIT_ASSERT(!s1.isOnSurface(v002));
678 CPPUNIT_ASSERT(!s1.isOnSurface(v102));
679 CPPUNIT_ASSERT(!s1.isOnSurface(v202));
680 CPPUNIT_ASSERT(!s1.isOnSurface(v012));
681 CPPUNIT_ASSERT(!s1.isOnSurface(v112));
682 CPPUNIT_ASSERT(!s1.isOnSurface(v212));
683 CPPUNIT_ASSERT(!s1.isOnSurface(v022));
684 CPPUNIT_ASSERT(!s1.isOnSurface(v122));
685 CPPUNIT_ASSERT(!s1.isOnSurface(v222));
686
687
688 Shape s2 = Sphere() || Cuboid(); // Should be same as Cuboid
689
690 CPPUNIT_ASSERT(s2.isInside(v000));
691 CPPUNIT_ASSERT(s2.isInside(v100));
692 CPPUNIT_ASSERT(s2.isInside(v200));
693 CPPUNIT_ASSERT(s2.isInside(v010));
694 CPPUNIT_ASSERT(s2.isInside(v110));
695 CPPUNIT_ASSERT(!s2.isInside(v210));
696 CPPUNIT_ASSERT(s2.isInside(v020));
697 CPPUNIT_ASSERT(!s2.isInside(v120));
698 CPPUNIT_ASSERT(!s2.isInside(v220));
699 CPPUNIT_ASSERT(s2.isInside(v001));
700 CPPUNIT_ASSERT(s2.isInside(v101));
701 CPPUNIT_ASSERT(!s2.isInside(v201));
702 CPPUNIT_ASSERT(s2.isInside(v011));
703 CPPUNIT_ASSERT(s2.isInside(v111));
704 CPPUNIT_ASSERT(!s2.isInside(v211));
705 CPPUNIT_ASSERT(!s2.isInside(v021));
706 CPPUNIT_ASSERT(!s2.isInside(v121));
707 CPPUNIT_ASSERT(!s2.isInside(v221));
708 CPPUNIT_ASSERT(s2.isInside(v002));
709 CPPUNIT_ASSERT(!s2.isInside(v102));
710 CPPUNIT_ASSERT(!s2.isInside(v202));
711 CPPUNIT_ASSERT(!s2.isInside(v012));
712 CPPUNIT_ASSERT(!s2.isInside(v112));
713 CPPUNIT_ASSERT(!s2.isInside(v212));
714 CPPUNIT_ASSERT(!s2.isInside(v022));
715 CPPUNIT_ASSERT(!s2.isInside(v122));
716 CPPUNIT_ASSERT(!s2.isInside(v222));
717
718 CPPUNIT_ASSERT(!s2.isOnSurface(v000));
719 CPPUNIT_ASSERT(s2.isOnSurface(v100));
720 CPPUNIT_ASSERT(s2.isOnSurface(v200));
721 CPPUNIT_ASSERT(s2.isOnSurface(v010));
722 CPPUNIT_ASSERT(s2.isOnSurface(v110));
723 CPPUNIT_ASSERT(!s2.isOnSurface(v210));
724 CPPUNIT_ASSERT(s2.isOnSurface(v020));
725 CPPUNIT_ASSERT(!s2.isOnSurface(v120));
726 CPPUNIT_ASSERT(!s2.isOnSurface(v220));
727 CPPUNIT_ASSERT(s2.isOnSurface(v001));
728 CPPUNIT_ASSERT(s2.isOnSurface(v101));
729 CPPUNIT_ASSERT(!s2.isOnSurface(v201));
730 CPPUNIT_ASSERT(s2.isOnSurface(v011));
731 CPPUNIT_ASSERT(s2.isOnSurface(v111));
732 CPPUNIT_ASSERT(!s2.isOnSurface(v211));
733 CPPUNIT_ASSERT(!s2.isOnSurface(v021));
734 CPPUNIT_ASSERT(!s2.isOnSurface(v121));
735 CPPUNIT_ASSERT(!s2.isOnSurface(v221));
736 CPPUNIT_ASSERT(s2.isOnSurface(v002));
737 CPPUNIT_ASSERT(!s2.isOnSurface(v102));
738 CPPUNIT_ASSERT(!s2.isOnSurface(v202));
739 CPPUNIT_ASSERT(!s2.isOnSurface(v012));
740 CPPUNIT_ASSERT(!s2.isOnSurface(v112));
741 CPPUNIT_ASSERT(!s2.isOnSurface(v212));
742 CPPUNIT_ASSERT(!s2.isOnSurface(v022));
743 CPPUNIT_ASSERT(!s2.isOnSurface(v122));
744 CPPUNIT_ASSERT(!s2.isOnSurface(v222));
745 }
746
747}
748
749void BaseShapesTest::PointsOnSurfaceTest(){
750 Shape s = Sphere();
751 for (size_t N = 20; N <=200; N+= 45) {
752 std::vector<Vector> PointsOnSurface = s.getHomogeneousPointsOnSurface(N);
753 for (std::vector<Vector>::const_iterator iter = PointsOnSurface.begin();
754 iter != PointsOnSurface.end();
755 ++iter) {
756 CPPUNIT_ASSERT(fabs(1. - (*iter).NormSquared()) < MYEPSILON);
757 }
758 CPPUNIT_ASSERT_EQUAL( N, PointsOnSurface.size());
759 }
760}
Note: See TracBrowser for help on using the repository browser.