Exemple #1
0
    def test_create_from_aabbs( self ):
        # -1
        a1 = numpy.array(
            [
                [-1.0,-1.0,-1.0 ],
                [-1.0,-1.0,-1.0 ]
                ]
            )
        # +1
        a2 = numpy.array(
            [
                [ 1.0, 1.0, 1.0 ],
                [ 1.0, 1.0, 1.0 ]
                ]
            )

        # -1 to +1
        result = aabb.create_from_aabbs( numpy.array( [ a1, a2 ] ) )

        expected = numpy.array(
            [
                [-1.0,-1.0,-1.0 ],
                [ 1.0, 1.0, 1.0 ]
                ]
            )

        self.assertTrue(
            numpy.array_equal( result, expected ),
            "Create from AABBS failed"
            )
Exemple #2
0
    def BoxForShapes(shapes):
        if not len(shapes):
            return Box()

        boxes = [x.bounding_box()._box for x in shapes]
        nb = aabb.create_from_aabbs(boxes)

        return Box(nb[0], nb[1])
Exemple #3
0
    def test_create_from_aabbs(self):
        # -1
        a1 = np.array([[-1.0, 0.0, 0.0], [-1.0, -1.0, -1.0]])
        # +1
        a2 = np.array([[1.0, -1.0, -1.0], [1.0, 1.0, 1.0]])

        # -1 to +1
        result = aabb.create_from_aabbs(np.array([a1, a2]))
        expected = np.array([[-1.0, -1.0, -1.0], [1.0, 1.0, 1.0]])

        self.assertTrue(np.array_equal(result, expected))
Exemple #4
0
    def test_create_from_aabbs(self):
        # -1
        a1 = np.array([
            [-1.0, 0.0, 0.0 ],
            [-1.0,-1.0,-1.0 ]
        ])
        # +1
        a2 = np.array([
            [ 1.0,-1.0,-1.0 ],
            [ 1.0, 1.0, 1.0 ]
        ])

        # -1 to +1
        result = aabb.create_from_aabbs(np.array([a1, a2]))
        expected = np.array([
            [-1.0,-1.0,-1.0 ],
            [ 1.0, 1.0, 1.0 ]
        ])

        self.assertTrue(np.array_equal(result, expected))
Exemple #5
0
 def extend(self, other):
     return aabb.create_from_aabbs([self._box, other._box])