def ray_2(): aabb = numpy.array( [ [-1.0,-1.0,-1.0 ], [ 1.0, 1.0, 1.0 ] ] ) ray = numpy.array( [ [2.0, 2.0, 2.0 ], [ -1.0, -1.0, -1.0 ] ] ) expected = numpy.array( [1.0, 1.0, 1.0] ) result = gt.ray_intersect_aabb( ray, aabb ) self.assertTrue( numpy.array_equal( result, expected ), "Ray vs AABB intersection incorrect: expected %s, got %s" % ( expected, result ) )
def test_ray_intersect_aabb_invalid_1(self): a = np.array([[-1.0,-1.0,-1.0], [ 1.0, 1.0, 1.0]]) r = np.array([[2.0, 2.0, 2.0], [ 1.0, 1.0, 1.0]]) result = gt.ray_intersect_aabb(r, a) self.assertEqual(result, None)
def test_ray_intersect_aabb_valid_2(self): a = np.array([[-1.0,-1.0,-1.0], [ 1.0, 1.0, 1.0]]) r = np.array([[2.0, 2.0, 2.0], [ -1.0, -1.0, -1.0]]) result = gt.ray_intersect_aabb(r, a) self.assertTrue(np.array_equal(result, [1.0, 1.0, 1.0]))