The flat_surface module

Contains 3 flat surface geometry managers. An infinite surface, and two derived GMs: rectangular and circular plates.

class tracer.flat_surface.FiniteFlatGM

Calculates intersection points before select_rays(), so that those outside the aperture can be dropped, and on select_rays trims it.

find_intersections(frame, ray_bundle)

Register the working frame and ray bundle, calculate intersections and save the parametric locations of intersection on the surface. Algorithm taken from [1].

In this class, global- and local-coordinates of intersection points are calculated and kept. _global is handled in select_rays(), but _local must be taken care off by subclasses.

Arguments

  • frame: the current frame, represented as a homogenous transformation matrix stored in a 4x4 array.
  • ray_bundle: a RayBundle object with the incoming rays’ data.

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)

Inform the geometry manager that only the given rays are to be used, so that internal data size is kept small.

Arguments

  • idxs: an index array stating which rays of the working bundle are active.
class tracer.flat_surface.FlatGeometryManager

Implements the geometry of an infinite flat surface, an the XY plane of its local coordinates (so the local Z is the surface normal).

done()

Discard internal data structures. This should be called after all information on the latest bundle’s results have been extracted already.

find_intersections(frame, ray_bundle)

Register the working frame and ray bundle, calculate intersections and save the parametric locations of intersection on the surface. Algorithm taken from [1].

Arguments

  • frame: the current frame, represented as a homogenous transformation matrix stored in a 4x4 array.
  • ray_bundle: a RayBundle object with the incoming rays’ data.

Returns

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

get_intersection_points_global()

Get the ray/surface intersection points in the global coordinates.

Returns

A 3-by-n array for 3 spatial coordinates and n rays selected.

get_normals()

Report the normal to the surface at the hit point of selected rays in the working bundle.

select_rays(idxs)

Inform the geometry manager that only the given rays are to be used, so that internal data size is kept small.

Arguments

  • idxs: an index array stating which rays of the working bundle are active.
class tracer.flat_surface.RectPlateGM(width, height)

Trims the infinite flat surface by marking rays whose intersection with the surface are outside the given width and height.

Arguments

  • width: the extent along the x axis in the local frame (sets self._w)
  • height: the extent along the y axis in the local frame (sets self._h)
find_intersections(frame, ray_bundle)

Extends the parent flat geometry manager by discarding in advance impact points outside a centered rectangle.

mesh(resolution)

Represent the surface as a mesh in local 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.

class tracer.flat_surface.RoundPlateGM(R)

Trims the infinite flat surface by marking as missing the rays falling outside the given radius.

Arguments

  • R: the plate’s radius
find_intersections(frame, ray_bundle)

Extends the parent flat geometry manager by discarding in advance impact points outside a centered circle.

mesh(resolution)

Represent the surface as a mesh in local coordinates. Uses polar bins, i.e. the points are equally distributed by angle and radius, not by x,y.

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.

Previous topic

Surface geometry managers

Next topic

The sphere_surface module

This Page