예제 #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.))
예제 #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))
예제 #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))
예제 #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())
예제 #5
0
 def test_volume(self):
     b1 = AABBox((-.5, -.5, -.5), (.5, .5, .5))
     
     self.assertAlmostEqual(b1.volume, 1.)
예제 #6
0
 def test_radius(self):
     b1 = AABBox((-.5, -.5, -.5), (.5, .5, .5))
     
     self.assertAlmostEqual(b1.radius, .5*sqrt(3))
예제 #7
0
 def test_center(self):
     b1 = AABBox((-.5, -.5, -.5), (.5, .5, .5))
     
     self.almostEqual(b1.center, (0., 0., 0.))
예제 #8
0
 def test_diagonal(self):
     b1 = AABBox((-.5, -.5, -.5), (.5, .5, .5))
     
     self.almostEqual(b1.diagonal, (1.0, 1.0, 1.0))
예제 #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)
예제 #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)