eradiate.scenes.shapes.CuboidShape#

class eradiate.scenes.shapes.CuboidShape(id='shape', bsdf=None, center=_Nothing.NOTHING, edges=_Nothing.NOTHING)[source]#

Bases: ShapeNode

Cuboid shape [cuboid].

This shape represents an axis-aligned cuboid parametrized by the length of its edges and the coordinates of its central point.

Parameters:
  • id (str, optional, default: "shape") – Identifier of the current scene element.

  • bsdf (BSDF or Ref or dict, optional) – BSDF attached to the shape. If a dictionary is passed, it is interpreted by bsdf_factory.convert(). If unset, no BSDF will be specified during the kernel dictionary generation: the kernel’s default will be used. If a BSDF instance (or a corresponding dictionary specification) is passed, its id member is automatically overridden.

  • center (quantity or array-like, optional, default: [0, 0, 0]) – Coordinates of the centre of the cube. Unit-enabled field (default: ucc['length']).

  • edges (quantity or array-like, default: [1, 1, 1]) – Lengths of the edges of the cuboid. Unit-enabled field (default: ucc['length]).

Fields:
  • id (str or None) – Identifier of the current scene element.

  • bsdf (BSDF or Ref or None) – BSDF attached to the shape.

  • center (quantity) – Coordinates of the centre of the cube.

  • edges (quantity) – Lengths of the edges of the cuboid.

classmethod atmosphere(top=<Quantity(100.0, 'kilometer')>, bottom=<Quantity(0.0, 'kilometer')>, bottom_offset=None, width=<Quantity(100.0, 'kilometer')>, bsdf=None)[source]#

This class method constructor provides a simplified parametrization of the cuboid shape better suited for the definition of the atmosphere when configuring the one-dimensional model with a plane parallel geometry.

Parameters:
  • top (quantity, optional, default: 100 km) – Top of atmosphere altitude. If a unitless value is passed, it is interpreted as ucc[‘length’].

  • bottom (quantity, optional, default: 0 km) – Ground altitude. If a unitless value is passed, it is interpreted as ucc['length'].

  • bottom_offset (quantity, optional) – Additional offset by which the cuboid with be extended to avoid an exact match of its bottom face and the shape representing the surface. If left unset, defaults to a negative offset of 1 % of the atmosphere’s height, i.e. \(- 0.01 \times (\mathtt{top} - \mathtt{bottom})\). If a unitless value is passed, it is interpreted as ucc['length'].

  • width (quantity, optional, default: 100 km) – Length of the horizontal edges of the cuboid. If a unitless value is passed, it is interpreted as ucc['length'].

  • bsdf (BSDF or dict, optional, default: None) – A BSDF specification, forwarded to the main constructor.

Returns:

CuboidShape – A cuboid shape which can be used as the atmosphere in a plane parallel geometry.

contains(p, strict=False)[source]#

Test whether a point lies within the cuboid.

Parameters:
  • p (quantity or array-like) – An array of shape (3,) (resp. (N, 3)) representing one (resp. N) points. If a unitless value is passed, it is interpreted as ucc['length'].

  • strict (bool) – If True, comparison is done using strict inequalities (<, >).

Returns:

result (array of bool or bool) – True iff p in within the cuboid.

traverse(callback)#

Traverse this scene element and collect kernel dictionary template and parameter update map contributions.

Parameters:

callback (SceneTraversal) – Callback data structure storing the collected data.

update()#

Enforce internal state consistency. This method should be called when fields are modified. It is automatically called as a post-init step.

property bbox#

Shape bounding box. Default implementation raises a NotImplementedError.

Type:

BoundingBox

property objects#

Map of child objects associated with this scene element.

Returns:

dict – A dictionary mapping object names to a corresponding object to be inserted in the Eradiate scene graph.

property params#
Returns:

dict[str, UpdateParameter] or None – A dictionary mapping parameter paths, consisting of dot-separated strings, to a corresponding update protocol.

property template#

Kernel dictionary template contents associated with this scene element.

Returns:

dict – A flat dictionary mapping dot-separated strings describing the path of an item in the nested scene dictionary to values. Values may be objects which can be directly used by the mitsuba.load_dict() function, or InitParameter instances which must be rendered.