Physical Object¶
- class diffinytrace.physical_object.PhysicalObject[source]¶
Bases:
ModuleAbstract base class for physical objects in the optical system. This class can be used to define surface distance constraints and is also used for plotting.
- get_transformation_matrix()[source]¶
Returns the transformation matrix of the object.
- Returns:
The transformation matrix.
- Return type:
torch.Tensor
- to_global_dir(direction)[source]¶
Converts a direction vector from local to global coordinates.
- Parameters:
direction (torch.Tensor) – Direction vector in local coordinates.
- Returns:
Direction vector in global coordinates.
- Return type:
torch.Tensor
- to_local_dir(direction)[source]¶
Converts a direction vector from global to local coordinates.
- Parameters:
direction (torch.Tensor) – Direction vector in global coordinates.
- Returns:
Direction vector in local coordinates.
- Return type:
torch.Tensor
- to_global_pos(position)[source]¶
Converts a position from local to global coordinates.
- Parameters:
position (torch.Tensor) – Position in local coordinates.
- Returns:
Position in global coordinates.
- Return type:
torch.Tensor
- class diffinytrace.physical_object.PhysicalSurface[source]¶
Bases:
PhysicalObjectAbstract base class for physical surfaces in the optical system. This class can be used to define surface distance constraints and is also used for plotting.
- get_constraint_funs_leq_zero()[source]¶
Returns constraint functions for the surface that must be less than or equal to zero.
- Raises:
NotImplementedError – If not implemented in subclass.
- Returns:
List of constraint functions.
- Return type:
list[Callable]
- parametric_sample(num_points: int, method: str = 'sobol') tuple[Tensor, Tensor][source]¶
Samples points on the surface in parameter space.
- Parameters:
num_points (int) – Number of points to sample.
method (str, optional) – Sampling method. Defaults to “sobol”.
- Raises:
NotImplementedError – If not implemented in subclass.
- Returns:
Sampled parameter positions and corresponding surface positions.
- Return type:
tuple[torch.Tensor, torch.Tensor]
- parametric_surface(parametric_pos: Tensor) Tensor[source]¶
Maps parameter space positions to surface positions.
- Parameters:
parametric_pos (torch.Tensor) – Positions in parameter space.
- Raises:
NotImplementedError – If not implemented in subclass.
- Returns:
Surface positions.
- Return type:
torch.Tensor