MCPcopy Create free account
hub / github.com/danieljfarrell/pvtrace / test_intersections

Method test_intersections

tests/test_node.py:64–72  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

62 assert np.allclose(c.vector_to_node((0, 0, 1), d), (0, 0, 1))
63
64 def test_intersections(self):
65 a = Node(name="A", parent=None)
66 b = Node(name="B", parent=a)
67 b.geometry = Sphere(radius=1.0)
68 loc = (-1.0, 0.0, 0.0)
69 vec = (1.0, 0.0, 0.0)
70 intersections = b.intersections(loc, vec)
71 points = np.array([x.point for x in intersections])
72 assert np.allclose(points, ((-1.0, 0.0, 0.0), (1.0, 0.0, 0.0)))
73
74 def test_intersection_when_on_surface(self):
75 """ Make sure we return intersection points even with zero distance from ray.

Callers

nothing calls this directly

Calls 3

intersectionsMethod · 0.95
NodeClass · 0.90
SphereClass · 0.90

Tested by

no test coverage detected