lsurf.sources.PointSource
- class lsurf.sources.PointSource(position, num_rays, wavelength, power=1.0)[source]
Isotropic point source emitting in all directions.
Generates rays from a single point with directions uniformly distributed over the unit sphere.
- Parameters:
- position
Source position in meters.
- Type:
ndarray, shape (3,)
Notes
The angular distribution is uniform over the full 4π steradians. Each ray carries equal intensity (power / num_rays).
Examples
>>> # Monochromatic point source >>> source = PointSource( ... position=(0, 0, 0), ... num_rays=10000, ... wavelength=532e-9, ... power=1e-3 ... ) >>> rays = source.generate()
>>> # Polychromatic source (white light LED) >>> source = PointSource( ... position=(0, 0.1, 0), ... num_rays=5000, ... wavelength=(400e-9, 700e-9), ... power=0.5 ... )
Methods
__init__(position, num_rays, wavelength[, power])Initialize point source.
generate()Generate isotropic ray distribution.
- generate()[source]
Generate isotropic ray distribution.
Creates rays emanating from the source position with directions uniformly distributed over the unit sphere.
- Returns:
Ray batch with isotropic direction distribution.
- Return type:
Notes
Uses the standard method for uniform sphere sampling: - θ uniformly distributed in [0, 2π) - cos(φ) uniformly distributed in [-1, 1]