Scene.trace

giant.ray_tracer.scene:

Scene.trace(trace_rays)[source]

Trace trace_rays through the current scene and return the intersections with the objects in the scene for each ray (optionally only the first intersection for each ray).

This method iterates through each object in the target_objs property and traces the ray through that object using the object’s trace method. The results from the tracing of each object are then reduced to only the first intersection for each ray.

This method handles determining whether things are to be ignored for each target, as well as updating the facet component of the return to have the appropriate id (encoding the target number at the head of the id).

This method returns a numpy array of shape (n,) where n is the number of rays traced with dtype INTERSECT_DTYPE.

Parameters:

trace_rays (Rays) – The rays to be traced through the scene

Returns:

a numpy structured array of the intersections for each ray.

Return type:

ndarray