Scene

A Scene is a collection of renderables and performs intersection tests on every contained object.

class padvinder.scene.Scene(*renderable)[source]

Bases: object

A scene contains a collection of renderable objects and performs ray intersections on them. Eventually the distance to the intersection point and the intersected object are returned. If no renderable was intersected (np.inf, None) is returned.

Parameters:renderable (padvinder.geometry.Geometry) – and subclasses. A renderable has to implement the intersect(ray) method
intersect(ray)[source]

Performs intersection tests with every renderable in the scene.

Parameters:ray (Ray) – the light ray to trace through the scene has to support ray.position and ray.direction
Returns:(number, renderable) – Number is a float in the intervall of [0, np.inf] and corresponds to the distance along the ray to the intersection point on the renderable surface. The renderable is an object previously passed into the scene that was intersected by the ray. If multiple renderables are intersected in the Scene, the one with the shortest distance between intersection point and ray position is returned. If no intersection occured (np.inf, None) is returned.
Return type:(float, padvinder.geometry.Geometry)