Example #1
0
    def test_create_from_points(self):
        points = np.array([[-1.0, -1.0, -1.0]])
        result = aabb.create_from_points(points)
        expected = np.array([[-1.0, -1.0, -1.0], [-1.0, -1.0, -1.0]])
        self.assertTrue(np.array_equal(result, expected))

        points = np.array([
            [-1.0, -1.0, -1.0],
            [-1.0, 2.0, -2.0],
        ])
        result = aabb.create_from_points(points)
        expected = np.array([
            [-1.0, -1.0, -2.0],
            [-1.0, 2.0, -1.0],
        ])
        self.assertTrue(np.array_equal(result, expected))
Example #2
0
 def test_centre_point_multiple_points(self):
     points = np.array([
         [ 1.0, 1.0, 1.0],
         [-1.0,-1.0,-1.0]
     ])
     obj = aabb.create_from_points(points)
     result = aabb.centre_point(obj)
     expected = np.zeros(3)
     self.assertTrue(np.array_equal(result, expected))
Example #3
0
    def test_create_from_points(self):
        points = np.array([[-1.0,-1.0,-1.0]])
        result = aabb.create_from_points(points)
        expected = np.array([
                [-1.0,-1.0,-1.0],
                [-1.0,-1.0,-1.0]
        ])
        self.assertTrue(np.array_equal(result, expected))

        points = np.array([
            [-1.0,-1.0,-1.0],
            [-1.0, 2.0,-2.0],
        ])
        result = aabb.create_from_points(points)
        expected = np.array([
            [-1.0,-1.0,-2.0],
            [-1.0, 2.0,-1.0],
        ])
        self.assertTrue(np.array_equal(result, expected))
Example #4
0
        def single_point():
            points = numpy.array( [ [-1.0,-1.0,-1.0 ] ] )
            obj = aabb.create_from_points( points )
            result = aabb.centre_point( obj )

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

            self.assertTrue(
                numpy.array_equal( result, expected ),
                "AABB single point centre point incorrect"
                )
Example #5
0
        def multiple_points():
            points = numpy.array(
                [
                    [ 1.0, 1.0, 1.0 ],
                    [-1.0,-1.0,-1.0 ]
                    ]
                )
            obj = aabb.create_from_points( points )
            result = aabb.centre_point( obj )

            expected = numpy.zeros( 3 )

            self.assertTrue(
                numpy.array_equal( result, expected ),
                "AABB multiple points centre point incorrect"
                )
Example #6
0
    def test_create_from_points( self ):
        """
        points = numpy.array(
            [
                [-1.0,-1.0,-1.0]
                ]
            )
        """
        points = numpy.array( [ [-1.0,-1.0,-1.0 ] ] )
        result = aabb.create_from_points( points )
        
        expected = numpy.tile( points, (2,1) )

        self.assertTrue(
            numpy.array_equal( result, expected ),
            "Create from points failed"
            )
Example #7
0
 def test_centre_point_multiple_points(self):
     points = np.array([[1.0, 1.0, 1.0], [-1.0, -1.0, -1.0]])
     obj = aabb.create_from_points(points)
     result = aabb.centre_point(obj)
     expected = np.zeros(3)
     self.assertTrue(np.array_equal(result, expected))
Example #8
0
 def test_centre_point_single_point(self):
     points = np.array([[-1.0, -1.0, -1.0]])
     obj = aabb.create_from_points(points)
     result = aabb.centre_point(obj)
     expected = np.array([-1.0, -1.0, -1.0])
     self.assertTrue(np.array_equal(result, expected))
Example #9
0
 def test_centre_point_single_point(self):
     points = np.array([[-1.0,-1.0,-1.0]])
     obj = aabb.create_from_points(points)
     result = aabb.centre_point(obj)
     expected = np.array([-1.0,-1.0,-1.0])
     self.assertTrue(np.array_equal(result, expected))