eradiate.scenes.shapes.SphereShape
eradiate.scenes.shapes.SphereShape#
- class eradiate.scenes.shapes.SphereShape(id='shape', bsdf=None, center=_Nothing.NOTHING, radius=_Nothing.NOTHING)[source]#
Bases:
eradiate.scenes.shapes._core.Shape
Sphere shape [
sphere
].This shape represents a sphere parametrised by its centre and radius.
- 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]
) – Location of the centre of the sphere. Unit-enabled field (default:ucc["length"]
).radius (
quantity
orfloat
, optional, default:1.0
) – Sphere radius. Unit-enabled field (default:ucc["length"]
).
- Fields
- classmethod atmosphere(top=<Quantity(100.0, 'kilometer')>, planet_radius=<Quantity(6378.1, 'kilometer')>, bsdf=None)[source]#
This class method constructor provides a simplified parametrisation of the sphere shape better suited for the definition of the surface when configuring the one-dimensional model.
The resulting sphere shape is centred at [0, 0, -planet_radius] and has a radius equal to planet_radius + top.
- Parameters
top (
quantity
or array-like, optional, default:100 km
) – Top-of-atmosphere altitude. If a unitless value is passed, it is interpreted asucc["length"]
.planet_radius (
quantity
orfloat
, optional, default:6378.1 km
) – Planet radius. If a unitless value is passed, it is interpreted asucc["length"]
. The default is Earth’s radius.bsdf (
BSDF
ordict
, optional, default:None
) – A BSDF specification, forwarded to the main constructor.
- Returns
SphereShape
– A sphere shape which can be used as the stencil of a participating medium in a spherical shell geometry.
- contains(p, strict=False)[source]#
Test whether a point lies within the sphere.
- 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 sphere.
- 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.
- classmethod surface(altitude=<Quantity(0.0, 'kilometer')>, planet_radius=<Quantity(6378.1, 'kilometer')>, bsdf=None)[source]#
This class method constructor provides a simplified parametrisation of the sphere shape better suited for the definition of the surface when configuring the one-dimensional model.
The resulting sphere shape is centred at [0, 0, -planet_radius] and has a radius equal to planet_radius + altitude.
- Parameters
altitude (
quantity
or array-like, optional, default:0 km
) – Surface altitude. If a unitless value is passed, it is interpreted asucc["length"]
.planet_radius (
quantity
orfloat
, optional, default:6378.1 km
) – Planet radius. If a unitless value is passed, it is interpreted asucc["length"]
. The default is Earth’s radius.bsdf (
BSDF
ordict
, optional, default:None
) – A BSDF specification, forwarded to the main constructor.
- Returns
SphereShape
– A sphere shape which can be used as the surface in a spherical shell geometry.