def test_intersectsBox(self):
        box1 = AxisAlignedBox(minimum = Vector(5.0, 5.0, 5.0), maximum = Vector(10.0, 10.0, 10.0))

        box2 = AxisAlignedBox(minimum = Vector(-10.0, -10.0, -10.0), maximum = Vector(-5.0, -5.0, -5.0))
        self.assertEqual(box1.intersectsBox(box2), AxisAlignedBox.IntersectionResult.NoIntersection)

        box2 = AxisAlignedBox(minimum = Vector(-10.0, 0.0, -10.0), maximum = Vector(-5.0, 10.0, -5.0))
        self.assertEqual(box1.intersectsBox(box2), AxisAlignedBox.IntersectionResult.NoIntersection)

        box2 = AxisAlignedBox(minimum = Vector(0.0, -10.0, -10.0), maximum = Vector(10.0, -5.0, -5.0))
        self.assertEqual(box1.intersectsBox(box2), AxisAlignedBox.IntersectionResult.NoIntersection)

        box2 = AxisAlignedBox(minimum = Vector(-10.0, -10.0, 0.0), maximum = Vector(-5.0, -5.0, 10.0))
        self.assertEqual(box1.intersectsBox(box2), AxisAlignedBox.IntersectionResult.NoIntersection)

        box2 = AxisAlignedBox(minimum = Vector(0.0, 0.0, 0.0), maximum = Vector(7.5, 7.5, 7.5))
        self.assertEqual(box1.intersectsBox(box2), AxisAlignedBox.IntersectionResult.PartialIntersection)

        box2 = AxisAlignedBox(minimum = Vector(5.0, 0.0, 5.0), maximum = Vector(10.0, 7.5, 10.0))
        self.assertEqual(box1.intersectsBox(box2), AxisAlignedBox.IntersectionResult.PartialIntersection)

        box2 = AxisAlignedBox(minimum = Vector(6.0, 6.0, 6.0), maximum = Vector(9.0, 9.0, 9.0))
        self.assertEqual(box1.intersectsBox(box2), AxisAlignedBox.IntersectionResult.FullIntersection)

        box2 = AxisAlignedBox(minimum = Vector(5.0, 5.0, 5.0), maximum = Vector(10.0, 10.0, 10.0))
        self.assertEqual(box1.intersectsBox(box2), AxisAlignedBox.IntersectionResult.FullIntersection)
Esempio n. 2
0
    def collidesWithBbox(self, check_bbox: AxisAlignedBox) -> bool:
        bbox = self.getBoundingBox()
        if bbox is not None:
            if check_bbox.intersectsBox(bbox) != AxisAlignedBox.IntersectionResult.FullIntersection:
                return True

        return False
Esempio n. 3
0
    def collidesWithBbox(self, check_bbox: AxisAlignedBox) -> bool:
        bbox = self.getBoundingBox()
        if bbox is not None:
            # Mark the node as outside the build volume if the bounding box test fails.
            if check_bbox.intersectsBox(bbox) != AxisAlignedBox.IntersectionResult.FullIntersection:
                return True

        return False
Esempio n. 4
0
    def collidesWithBbox(self, check_bbox: AxisAlignedBox) -> bool:
        """Return if the provided bbox collides with the bbox of this SceneNode"""

        bbox = self.getBoundingBox()
        if bbox is not None:
            if check_bbox.intersectsBox(bbox) != AxisAlignedBox.IntersectionResult.FullIntersection:
                return True

        return False