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

InteractionModelFactory()

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_length for thin_lens, phase_profile for phase).

Returns:

The created interaction model object.

Return type:

BaseInteractionModel

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 a BaseInteractionModel instance.

  • overwrite – Allow replacing an existing registration.

Raises:

ValueError – If name is already registered and overwrite is False.