Aperture

template<IsSpectral TSpectral>
class Aperture

Abstract base class for optical apertures.

Defines the interface for all aperture types: area, sampling (for depth of field), and its shape (for defocus blur). The diffraction pattern is a circular aperture’s, of the aperture’s bounding radius (see PsfTables).

Template Parameters:

TSpectral – The spectral type (e.g., RGB, Visible8)

Subclassed by huira::CircularAperture< TSpectral >

Public Functions

virtual ~Aperture() = default
virtual units::SquareMeter get_area() const = 0
virtual void set_area(units::SquareMeter area) = 0
virtual Vec2<float> sample(Sampler<float> &sample) const = 0
virtual units::Meter get_bounding_radius() const = 0
virtual void rasterize_shape(Image<float> &kernel, float radius_pixels, float offset_x, float offset_y) const = 0

Rasterize the aperture’s shape as antialiased pixel coverage.

The defocus blur of a point source is the aperture’s shape, scaled. The shape is drawn with its bounding radius scaled to radius_pixels, centered offset_x, offset_y pixels beyond the center of the kernel’s center pixel. The kernel is not cleared or normalized.

Parameters:
  • kernel – Square kernel to draw into, of odd size.

  • radius_pixels – Bounding radius of the drawn shape, in pixels.

  • offset_x – Horizontal offset of the shape’s center from the center pixel, in pixels.

  • offset_y – Vertical offset of the shape’s center from the center pixel, in pixels.