The surface module

class tracer.surface.Surface(geometry, optics, location=None, rotation=None)

Defines the base of surfaces that interact with rays.

Arguments

  • geometry: a GeometryManager object responsible for finding ray intersections with the surface.
  • optics: a callable that gets the geometry manageri, bundle and selector, and returns the outgoing ray bundle generated by the geometry and bundle. location, rotation - passed directly to the HasFrame constructor.
done()

When this is called, the surface will no longer be queried on the results of the latest trace iteration, so it can discard internal data to relieve memory pressure.

get_geometry_manager()

Returns the geometry-manager instance. May be useful for introspection. Note that it is a read-only attribute.

get_optics_manager()

Returns the optics-manager callable. May be useful for introspection. Note that it is a read-only attribute.

get_outgoing()

Generates a new ray bundle, which is the reflections/refractions of the

  • user: selected rays out of the incoming ray-bundle that was previously registered.

Returns

a RayBundle object with the new bundle, with vertices on the surface and directions according to optics laws.

global_to_local(points)

Transform a set of points in the global coordinates back into the frame used during tracing.

Arguments

  • points: a 3 x n array for n 3D points

returns

  • local: a 3 x n array with the respective points in local coordinates.
mesh(resolution)

Represent the surface as a mesh in global coordinates.

Arguments

  • resolution: in points per unit length (so the number of points returned is O(A*resolution**2) for area A)

Returns

x, y, z - each a 2D array holding in its (i,j) cell the x, y, and z coordinate (respectively) of point (i,j) in the mesh.

register_incoming(ray_bundle)

Records the incoming ray bundle, and uses the geometry manager to return the parametric positions of intersection with the surface along the ray.

Arguments

  • ray_bundle: a RayBundle object with at-least its vertices and directions specified.

Returns A 1D array with the parametric position of intersection along each of the rays. Rays that missed the surface return +infinity.

select_rays(idxs)

Informs the geometry manager that only the specified rays are to be used henceforth.

Arguments

  • idxs: an array with indices into the last registered ray bundle, marking rays that will be used.

Previous topic

The object module

Next topic

The optics_callables module

This Page