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

Method is_reflected

pvtrace/material/surface.py:231–240  ·  view source on GitHub ↗

Returns `True` is the ray is reflected.

(self, ray, geometry, container, adjacent)

Source from the content-addressed store, hash-verified

229 return self._delegate
230
231 def is_reflected(self, ray, geometry, container, adjacent):
232 """ Returns `True` is the ray is reflected.
233 """
234 r = self.delegate.reflectivity(self, ray, geometry, container, adjacent)
235 if not isinstance(r, (int, float, np.float, np.int)):
236 raise ValueError("Reflectivity must be a number.")
237 if r == 0.0:
238 return False
239 gamma = np.random.uniform()
240 return gamma < r
241
242 def reflect(self, ray, geometry, container, adjacent):
243 """ Returns ray which is reflected from the interface.

Callers 1

followFunction · 0.45

Calls 1

reflectivityMethod · 0.45

Tested by

no test coverage detected