def test_expandBounds(self): bbox = hou.BoundingBox(-1, -1.75, -3, 1, 1.75, 3) bbox.expandBounds(1, 1, 1) self.assertEqual(bbox.minvec(), hou.Vector3(-2, -2.75, -4)) self.assertEqual(bbox.maxvec(), hou.Vector3(2, 2.75, 4))
def test_addToMin(self): bbox = hou.BoundingBox(-1, -1.75, -3, 1, 1.75, 3) bbox.addToMin(hou.Vector3(1, 0.25, 1)) self.assertEqual(bbox.minvec(), hou.Vector3(0, -1.5, -2))
def test_intersectsFail(self): bbox1 = hou.BoundingBox(-0.5, -0.5, -0.5, -0.1, -0.1, -0.1) bbox2 = hou.BoundingBox(0, 0, 0, 0.5, 0.5, 0.5) self.assertFalse(bbox1.intersects(bbox2))
def test_computeIntersectionFail(self): bbox1 = hou.BoundingBox(-0.5, -0.5, -0.5, -0.1, -0.1, -0.1) bbox2 = hou.BoundingBox(0, 0, 0, 0.5, 0.5, 0.5) self.assertFalse(bbox1.computeIntersection(bbox2))
def test_intersects(self): bbox1 = hou.BoundingBox(-0.5, -0.5, -0.5, 0.5, 0.5, 0.5) bbox2 = hou.BoundingBox(0, 0, 0, 0.5, 0.5, 0.5) self.assertTrue(bbox1.intersects(bbox2))
def test_isInsideFail(self): bbox1 = hou.BoundingBox(-0.5, -0.5, -0.5, 0.5, 0.5, 0.5) bbox2 = hou.BoundingBox(0, 0, 0, 0.5, 0.5, 0.5) self.assertFalse(bbox1.isInside(bbox2))
def test_isInside(self): bbox1 = hou.BoundingBox(-0.5, -0.5, -0.5, 0.5, 0.5, 0.5) bbox2 = hou.BoundingBox(-1, -1, -1, 1, 1, 1) self.assertTrue(bbox1.isInside(bbox2))
def fromHouBBox(self, hbb): vmin = hbb.minvec() vmax = hbb.maxvec() self.bbox = hou.BoundingBox(vmin[0], vmin[1], vmin[2], vmax[0], vmax[1], vmax[2])
def addPos(self, pos): if self.bbox: self.bbox.enlargeToContain(pos) else: self.bbox = hou.BoundingBox(pos[0], pos[1], pos[2], pos[0], pos[1], pos[2])