eradiate.scenes.shapes.RectangleShape#

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

Bases: ShapeNode

Rectangle shape [rectangle].

This shape represents a rectangle parametrized by the length of its edges, the coordinates of its central point, a normal vector and an orientation vector.

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.

  • edges (quantity or array-like, optional, default: [1, 1]) – Length of the rectangle’s edges. Unit-enabled field (default: ucc['length']).

  • center (quantity or array-like, optional, default: [0, 0, 0]) – Cartesian coordinates of the rectangle’s central point. Unit-enabled field (default: ucc['length]).

  • normal (array-like, optional, default: [0, 0, 1]) – Normal vector of the plane containing the rectangle. Defaults to the +Z direction.

  • up (array-like, optional, default: [0, 1, 0]) – Orientation vector defining the rotation of the rectangle around the normal vector. Defaults to the +Y direction.

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

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

  • edges (quantity) – Length of the rectangle’s edges.

  • center (quantity) – Cartesian coordinates of the rectangle’s central point.

  • normal (array) – Normal vector of the plane containing the rectangle.

  • up (array) – Orientation vector defining the rotation of the rectangle around the normal vector.

bbox()[source]#
BoundingBoxShape bounding box. Default implementation

raises a NotImplementedError.

classmethod surface(altitude=<Quantity(0.0, 'kilometer')>, width=<Quantity(1.0, 'kilometer')>, bsdf=None)[source]#

This class method constructor provides a simplified parametrization of the rectangle shape better suited for the definition of the surface when configuring the one-dimensional model.

The resulting rectangle shape is a square with edge length equal to width, centred at [0, 0, altitude], with normal vector +Z.

Parameters:
  • altitude (quantity or array-like, optional, default: 0 km) – Surface altitude. If a unitless value is passed, it is interpreted as ucc['length'].

  • width (quantity or float, optional, default: 1 km) – Edge length. 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:

RectangleShape – A rectangle shape which can be used as the surface in a plane parallel geometry.

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 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.