eradiate.scenes.shapes.CuboidShape
eradiate.scenes.shapes.CuboidShape#
- class eradiate.scenes.shapes.CuboidShape(id='shape', bsdf=None, center=_Nothing.NOTHING, edges=_Nothing.NOTHING)[source]#
Bases:
eradiate.scenes.shapes._core.Shape
Cuboid shape [
cuboid
].This shape represents an axis-aligned cuboid parametrised by the length of its edges and the coordinates of its central point.
- Parameters
id (
str
, optional, default:"shape"
) – User-defined object identifier.bsdf (
BSDF
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.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
- 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 parametrisation 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 asucc["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 asucc["length"]
.width (
quantity
, optional, default:100 km
) – Length of the horizontal edges of the cuboid. 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
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 asucc["length"]
.strict (
bool
) – IfTrue
, comparison is done using strict inequalities (<, >).
- Returns
result (array of
bool
orbool
) –True
iffp
in within the cuboid.
- kernel_dict(ctx)[source]#
Return a dictionary suitable for kernel scene configuration.
- Parameters
ctx (
KernelDictContext
) – A context data structure containing parameters relevant for kernel dictionary generation.- Returns
KernelDict
– Kernel dictionary which can be loaded as a Mitsuba object.