Traceable Components


Components with strikethrough() are in development and not yet supported. PyRayT is still in the alpha stages and more components are being added regularly.


As a forward ray tracer, PyRayT’s rays are generated by sources and traced through the system until terminated. All sources inherit from the Source base class, which can be used to create custom sources. By default, all rays are propogating along the +X axis, but they can be moved and rotated in world space like any traceable object.

Basic Sources

  • LineOfRays - A set of rays linearly spaced in one dimension

  • ConeOfRays - A radially distributed set of rays originating from a point, with a predefined diverging angle

  • WedgeOfRays - A set of rays angularly distributed in one dimension

  • CircleOfRays - A set of parallel rays uniformly distributed about a circular arc.

  • PointOfRays - A spatically distributed set of rays originating from a point, with a predefined diverging angle

  • GridOfRays - A set of rays uniformly distributed about an aperture, propogating alonge the +X axis

Additional Sources

  • Lamp - A randomly generated set of rays, uniformly distributed over an aperture with a Lambertian intensity distribution.

  • StaticLamp - Identical to Lamp, but uses caching to ensure successive calls to generate_rays() generate the same RaySet object.

  • ImageSource - Generates a set of Rays based on the pixel values of an image.

Built in Parts


The next to components link to additional resources for the describing the simulated components.

Specifying Apertures

All component factory functions accept an aperture keyword argument. Internally, components are created from Constructive Solid Geometry operations performed on primitives in the tinygfx package. For example, the object returned by biconvex_lens() is the intersection of two spheres and an aperture primitive that sets the lens boundaries.

The aperture argument accepts either a single or tuple of floats, whose sign determines the final aperture.


argument type

aperture shape

CSG primitive



Circle with diameter x



Tuple[float, float]

Rectangle with side lengths y1 and z1


(-y1, -z1)

Tuple[float, float]

Ellipse with diameters y1 and z1



Lens Keyword arguments

Any of the following keyword arguments can be passed to a lens function.

  • material (TracableMaterial) - The lens material, defaults to a simple refractive material with n=1.5

  • aperture (specified aperture) - The lenses aperture, defaults to a circular aperture with a diameter of 1

Spherical Lenses

Nonstandard Lenses

  • cylindrical_lens()

  • aspheric_lens()

  • ball_lens()

  • halfball_lens()


Mirror Keyword arguments

  • material (TracableMaterial) - The mirror material. Defaults to a perfect reflector

  • aperture (specified aperture) - The mirror aperture. Defaults to a circular aperture with a diameter of 1.

Planar Mirrors

Conic Mirrors

Nonstandard Mirrors

  • corner_cube()

  • cylindrical_mirror()