gradoptics.optics.bounding_sphere
- class gradoptics.optics.bounding_sphere.BoundingSphere(radii=0.001, xc=0.31, yc=0.0, zc=0.0)
Bases:
gradoptics.optics.bounding_shape.BoundingShape
Models a sphere that can be used to bound a volume or a scene. Intersections with the sphere will not modify the orientation of the incoming rays (no reflection nor refraction).
- __init__(radii=0.001, xc=0.31, yc=0.0, zc=0.0)
- Parameters
radii – Radii of the sphere (
float
)xc – Position of the center of the sphere along the x axis (
float
)yc – Position of the center of the sphere along the y axis (
float
)zc – Position of the center of the sphere along the z axis (
float
)
- get_ray_intersection_(incident_rays, eps=1e-15)
Computes the times t_min and t_max at which the incident rays will intersect the bounding shape
- Parameters
incident_rays – The incident rays (
Rays
)- Returns
(
tuple
) - Times t_min (torch.tensor
) - Times t_max (torch.tensor
)
- get_ray_intersection(incident_rays, eps=1e-15)
Computes the times t at which the incident rays will intersect the object.
- Parameters
incident_rays – The incident rays (
Rays
)- Returns
Times t (
torch.tensor
)
- intersect(incident_rays, t)
Returns the rays reflected or refracted by the optical element.
- Parameters
incident_rays – The incident rays (
Rays
)t – The times at which the incident rays will intersect the optical element (
torch.tensor
)
- Returns
(
tuple
) - Reflected or refracted rays (Rays
) - A boolean mask that indicates which incident rays were reflected or refracted ― some rays may not bereflected or refracted for example, due to total internal reflection, which is not modelled at this point (
torch.tensor
)
- plot(ax, color='grey', alpha=0.4)
Plots the optical element on the provided axes.
- Parameters
ax – 3d axes (
mpl_toolkits.mplot3d.axes3d.Axes3D
)