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