Example #1
0
 def test_addPoints(self):
     b1 = AABBox((-.5, -.5, -.5), (.5, .5, .5))
     
     b1.addPoints(((-1., 1., -1.), (1., -1., 1.)))
     
     self.almostEqual(b1.min, (-1., -1., -1.))
     self.almostEqual(b1.max, (1., 1., 1.))
Example #2
0
 def test_init(self):
     b1 = AABBox()
     
     self.assertTrue(b1.min == Point(-.5, -.5, -.5))
     self.assertTrue(b1.max == Point(.5, .5, .5))
     
     b2 = AABBox((-.5, -.5, -.5), (.5, .5, .5))
     
     self.almostEqual(b2.min, (-.5, -.5, -.5))
     self.almostEqual(b2.max, (.5, .5, .5))
Example #3
0
 def test_isPointIn(self):
     b1 = AABBox((-.5, -.5, -.5), (.5, .5, .5))
     
     self.assertTrue(b1.isPointIn((0.,0.,0.)))
     self.assertTrue(not b1.isPointIn((1.,1.,1.)))
     self.assertTrue(b1.isPointIn((-.5, .5, -.5)))
     self.assertTrue(not b1.isPointIn((-.5, .5, -.5), strictlyIn = True))
Example #4
0
 def test_valid(self):
     b1 = AABBox((-1., -1., -1.), (1., 1., 1.))
     
     self.assertTrue(b1.isValid())
     
     b2 = AABBox((1., 1., 1.), (-1., -1., -1.))
     
     self.assertTrue(not b2.isValid())
Example #5
0
 def test_volume(self):
     b1 = AABBox((-.5, -.5, -.5), (.5, .5, .5))
     
     self.assertAlmostEqual(b1.volume, 1.)
Example #6
0
 def test_radius(self):
     b1 = AABBox((-.5, -.5, -.5), (.5, .5, .5))
     
     self.assertAlmostEqual(b1.radius, .5*sqrt(3))
Example #7
0
 def test_center(self):
     b1 = AABBox((-.5, -.5, -.5), (.5, .5, .5))
     
     self.almostEqual(b1.center, (0., 0., 0.))
Example #8
0
 def test_diagonal(self):
     b1 = AABBox((-.5, -.5, -.5), (.5, .5, .5))
     
     self.almostEqual(b1.diagonal, (1.0, 1.0, 1.0))
Example #9
0
 def test__ne__(self):
     b1 = AABBox()
     b2 = AABBox((-1., -1., -1.), (1., 1., 1.))
     
     self.assertTrue(b1 != b2)
     self.assertTrue(not b1 == b2)
Example #10
0
 def test__eq__(self):
     b1 = AABBox()
     b2 = AABBox((-.5, -.5, -.5), (.5, .5, .5))
     
     self.assertTrue(b1 == b2)
     self.assertTrue(not b1 != b2)