MCPcopy Create free account
hub / github.com/apple/ml-pointersect / test_1

Method test_1

tests/plib/test_utils.py:10–24  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

8
9class Test_AABB_Intersection(unittest.TestCase):
10 def test_1(self):
11 N = 10000
12 stime = timer()
13 for _ in range(N):
14 out_dict = utils.ray_aabb_intersection(
15 ray_origin=torch.zeros(3),
16 ray_direction=torch.tensor([0,0,1.]),
17 bbox_min_bounds=torch.tensor([0,0,2.]),
18 bbox_max_bounds=torch.tensor([10, 10, 10.]),
19 )
20 etime = timer()
21 print(f'v1 takes {(etime - stime) / N} secs per test')
22 assert out_dict['is_intersected']
23 assert np.isclose(out_dict['t_near'].detach().cpu().numpy(), 2.)
24 assert np.isclose(out_dict['t_far'].detach().cpu().numpy(), 10.)
25
26
27 def test_2(self):

Callers

nothing calls this directly

Calls 1

detachMethod · 0.45

Tested by

no test coverage detected