gradoptics.optics.ray
- class gradoptics.optics.ray.Ray(origin, direction, luminosity=tensor([1.]), meta=None, device='cpu')
Bases:
objectModels a ray characterized by an origin and a direction. The ray carries some luminosity and meta data which can be used for storing information, for example during surface intersections.
- __init__(origin, direction, luminosity=tensor([1.]), meta=None, device='cpu')
- Parameters
origin – Origin of the ray (
torch.tensor)direction – Direction of the ray (
torch.tensor)luminosity – Luminosity carried by the ray (
torch.tensor)meta – Meta data carried by the ray (
dict)device – The desired device of returned tensor (
str)
- plot(ax, t)
Plots the ray at time
t- Parameters
ax – 3d axes (
mpl_toolkits.mplot3d.axes3d.Axes3D)t – times t (
torch.tensor)
- class gradoptics.optics.ray.Rays(origins, directions, luminosities=None, meta=None, device='cpu')
Bases:
objectModels a batch of rays characterized by their origins and directions. The rays carry some luminosity and meta data which can be used for storing information, for example during surface intersections.
- __init__(origins, directions, luminosities=None, meta=None, device='cpu')
- Parameters
origins – Origins of the rays (
torch.tensor)directions – Directions of the rays (
torch.tensor)luminosities – Luminosities carried by the rays (
torch.tensor)meta – Meta data carried by the rays (
dict)device – The desired device of returned tensor (
str)
- __getitem__(condition)
Returns the rays where the
conditionis true- Parameters
condition – Boolean tensor (
torch.tensor)- Returns
A batch of rays where the
conditionis true (Rays)
- __call__(t)
Returns the positions of the rays at times
t- Parameters
t – Times t (
torch.tensor)- Returns
The positions of the rays at times t (
torch.tensor)
- get_origin_and_direction()
Returns the origins and directions of the rays
- Returns
The origins and directions of the batch of rays (
tuple)
- get_size()
Returns the number of rays in the batch
- Returns
The number of rays in the batch (
int)
- plot(ax, t, **kwargs)
Plots the rays at times
t- Parameters
ax – 3d axes (
mpl_toolkits.mplot3d.axes3d.Axes3D)t – times t (
torch.tensor)
- gradoptics.optics.ray.empty_like(rays)
Returns an uninitialized batch of rays with the same size as
rays