MCPcopy Create free account
hub / github.com/ImageEngine/cortex / testMiscMethods

Method testMiscMethods

test/IECore/Imath.py:517–553  ·  view source on GitHub ↗

Test Box3f miscellaneous methods

(self)

Source from the content-addressed store, hash-verified

515 self.assertTrue( b1 != b2 )
516
517 def testMiscMethods(self):
518 """Test Box3f miscellaneous methods"""
519
520 b1 = imath.Box3f( imath.V3f(-1.0, -1.0, -1.0), imath.V3f(2.0, 2.0, 2.0) )
521 self.assertEqual( b1.isEmpty(), False )
522 self.assertTrue( b1.hasVolume() )
523
524 b1.makeEmpty()
525 self.assertTrue( b1.isEmpty() )
526 self.assertEqual( b1.hasVolume(), False )
527
528 b1 = imath.Box3f( imath.V3f(-1.0, -1.0, -1.0), imath.V3f(10.0, 2.0, 2.0) )
529
530 X_AXIS = 0
531 self.assertEqual( b1.majorAxis(), X_AXIS )
532
533 self.assertEqual( b1.center(), (b1.min() + b1.max()) / 2.0 )
534
535 b2 = imath.Box3f( imath.V3f(-0.5), imath.V3f(1.0) )
536 self.assertTrue( b2.intersects(b1) )
537
538 b2 = imath.Box3f( imath.V3f(-5.0), imath.V3f(-2.0) )
539 self.assertFalse( b2.intersects(b1) )
540
541 self.assertEqual( b2.size(), b2.max() - b2.min() )
542
543 b = imath.Box3f( imath.V3f(1), imath.V3f(2) )
544 m = imath.M44f()
545 m[0][0]=2
546 m[1][1]=2
547 m[2][2]=2
548 self.assertEqual( b * m, imath.Box3f( imath.V3f(2), imath.V3f(4) ) )
549 m = imath.M44d()
550 m[0][0]=2
551 m[1][1]=2
552 m[2][2]=2
553 self.assertEqual( b * m, imath.Box3f( imath.V3f(2), imath.V3f(4) ) )
554
555class ImathQuatf(unittest.TestCase):
556 def testConstructors(self):

Callers

nothing calls this directly

Calls 5

makeEmptyMethod · 0.80
minMethod · 0.80
maxMethod · 0.80
isEmptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected