eradiate.scenes.shapes.RectangleShape#
- class eradiate.scenes.shapes.RectangleShape(id='shape', bsdf=None, to_world=None, edges=NOTHING, center=NOTHING, normal=NOTHING, up=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
orRef
ordict
, optional) – BSDF attached to the shape. If a dictionary is passed, it is interpreted bybsdf_factory.convert()
. If unset, no BSDF will be specified during the kernel dictionary generation: the kernel’s default will be used. If aBSDF
instance (or a corresponding dictionary specification) is passed, its id member is automatically overridden.to_world (
mitsuba.ScalarTransform4f
or array-like, optional) – Transform to scale, shift and rotate the shape.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:
to_world (
mitsuba.ScalarTransform4f
orNone
) – Transform to scale, shift and rotate 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.
Notes
If the to_world parameter is set, it will override the other parameters. In that case, the transformation will be applied to a rectangle that covers the [-1, -1, 0] to [1, 1, 0] area, with a normal pointing towards [0, 0, 1].
- bbox()[source]#
BoundingBox
Shape bounding box. Default implementationraises 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 asucc['length']
.width (
quantity
orfloat
, optional, default:1 km
) – Edge length. If a unitless value is passed, it is interpreted asucc['length']
.bsdf (
BSDF
ordict
, 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
] orNone
– A dictionary mapping parameter paths, consisting of dot-separated strings, to a corresponding update protocol.
See also
- 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 themitsuba.load_dict()
function, orInitParameter
instances which must be rendered.
See also