| 71 | assert np.allclose(points, ((0.0, 0.0, 0.0), (2.0, 0.0, 0.0))) |
| 72 | |
| 73 | def test_intersection_coordinate_system(self): |
| 74 | root = Node(name="Root", geometry=Sphere(radius=10.0)) |
| 75 | a = Node(name="A", parent=root, geometry=Sphere(radius=1.0)) |
| 76 | a.translate((1.0, 0.0, 0.0)) |
| 77 | scene = Scene(root) |
| 78 | initial_ray = Ray( |
| 79 | position=(-2.0, 0.0, 0.0), |
| 80 | direction=(1.0, 0.0, 0.0), |
| 81 | wavelength=None, |
| 82 | is_alive=True, |
| 83 | ) |
| 84 | scene_intersections = scene.intersections( |
| 85 | initial_ray.position, |
| 86 | initial_ray.direction |
| 87 | ) |
| 88 | a_intersections = tuple(map(lambda x: x.to(root), scene_intersections)) |
| 89 | assert scene_intersections == a_intersections |
| 90 | |
| 91 | if __name__ == '__main__': |
| 92 | pass |