The object module

class tracer.object.AssembledObject(surfs=None, bounds=None, transform=None)

Defines an assembly of surfaces as an object. The object has its own set of coordinates such that each surface composing the object can be described in terms of the object’s coordinate system, and thus the user can rotate or translate the entire object together as one piece. The object also tracks refractive indices as a ray bundle leaves or enters a new material.

Attributes

  • surfaces: a list of Surface objects
  • boundaries: a list of Boundary objects that the surfaces are limited by.
  • transform: a 4x4 array representing the homogenous transformation matrix of this object relative to the coordinate system of its container
add_boundary(boundary)

Adds a boundary to the object. Surfaces not enclosed by the boundary sphere will not count as hit. Arguments: boundary - a spherical boundary objects

add_surface(surface)

Adds a surface to the object Arguments: surface - a surface object

own_rays(rays, surface_id)

Decide which of the rays continue to propagate inside the object, so only the object’s surfaces need be checked for intersection. This default implementation owns nothing.

Arguments

  • rays: the RayBundle to check.
  • surface_id: the index of the surface which generated this bundle.

Returns

a boolean array of length rays.get_num_rays() with False if not owned, True if owned.

surfaces_for_next_iteration(rays, surface_id)

Informs the ray tracer that some of the surfaces can be skipped in the next ireration for some of the rays. This default implementation marks all surfaces as relevant to all rays.

Arguments

  • rays: the RayBundle to check.
  • surface_id: the index of the surface which generated this bundle.

Returns

an array of size s by r for s surfaces in this object and r rays, stating whether ray i=1..r should be intersected with surface j=1..s in the next iteration.

AssembledObject.transform_children(assembly_transform=array([[ 1., 0., 0., 0.],
[ 0., 1., 0., 0.],
[ 0., 0., 1., 0.],
[ 0., 0., 0., 1.]]))

Transforms an object if the assembly is transformed

Previous topic

The assembly module

Next topic

The surface module

This Page