surfaces.factories.interaction_model_factory
Interaction Model Factory
This module contains the InteractionModelFactory class, which is used to create interaction model objects based on the given parameters.
Kramer Harrison, 2025
Classes
A factory class for creating interaction model objects. |
- class InteractionModelFactory[source]
A factory class for creating interaction model objects.
- create(parent_surface: Surface | None, interaction_type: str, is_reflective: bool, coating: BaseCoating | None, bsdf: BaseBSDF | None, **kwargs) BaseInteractionModel[source]
Creates an interaction model object based on the given parameters.
- Parameters:
parent_surface – The parent surface (hooked up later in Surface.__init__).
interaction_type (str) – The type of interaction model to create.
is_reflective (bool) – Indicates whether the surface is reflective.
coating (Optional[BaseCoating]) – The coating of the surface.
bsdf (Optional[BaseBSDF]) – The BSDF of the surface.
**kwargs – Additional keyword arguments forwarded to the builder (e.g.
focal_lengthfor thin_lens,phase_profilefor phase).
- Returns:
The created interaction model object.
- Return type:
- Raises:
ValueError – If the interaction_type is unknown.
- classmethod register(name: str, builder: Callable, *, overwrite: bool = False) None[source]
Register a new interaction model builder.
- Parameters:
name – The string key used when specifying interaction_type.
builder – A callable with signature
(parent_surface, is_reflective, coating, bsdf, **kwargs)that returns aBaseInteractionModelinstance.overwrite – Allow replacing an existing registration.
- Raises:
ValueError – If name is already registered and overwrite is False.