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

Method test_intersection_when_on_surface

tests/test_node.py:74–84  ·  view source on GitHub ↗

Make sure we return intersection points even with zero distance from ray.

(self)

Source from the content-addressed store, hash-verified

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.
76 """
77 a = Node(name="A", parent=None)
78 a.geometry = Sphere(radius=1.0)
79 loc = (-1.0, 0.0, 0.0)
80 vec = (1.0, 0.0, 0.0)
81 intersections = a.intersections(loc, vec)
82 points = np.array([x.point for x in intersections])
83 expected = np.array([(-1.0, 0.0, 0.0), (1.0, 0.0, 0.0)])
84 assert np.allclose(points, expected)
85
86 def test_intersection_with_translation(self):
87 a = Node(name="A", parent=None)

Callers

nothing calls this directly

Calls 3

intersectionsMethod · 0.95
NodeClass · 0.90
SphereClass · 0.90

Tested by

no test coverage detected