eradiate.scenes.shapes.SphereShape¶
- class eradiate.scenes.shapes.SphereShape(id='shape', bsdf=None, to_world=None, center=NOTHING, radius=NOTHING)[source]¶
Bases:
ShapeNodeSphere shape [
sphere].This shape represents a sphere parametrized by its centre and radius.
- Parameters:
id (
str, optional, default:"shape") – Identifier of the current scene element.bsdf (
BSDForRefordict, 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 aBSDFinstance (or a corresponding dictionary specification) is passed, its id member is automatically overridden.to_world (
mitsuba.ScalarTransform4for array-like, optional) – Transform to scale, shift and rotate the shape.center (
quantityor array-like, optional, default:[0,0,0]) – Location of the centre of the sphere. Unit-enabled field (default:ucc['length']).radius (
quantityorfloat, optional, default:1.0) – Sphere radius. Unit-enabled field (default:ucc['length']).
- Fields:
Notes
If the to_world parameter is set, it will be appended to the position and scaling defined by the center and radius parameters.
- classmethod atmosphere(top=<Quantity(100.0, 'kilometer')>, planet_radius=<Quantity(6378.1, 'kilometer')>, bsdf=None)[source]¶
This class method constructor provides a simplified parametrization 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, 0] and has a radius equal to planet_radius + top.
- Parameters:
top (
quantityor array-like, optional, default:100 km) – Top-of-atmosphere altitude. If a unitless value is passed, it is interpreted asucc['length'].planet_radius (
quantityorfloat, optional) – Planet radius. If a unitless value is passed, it is interpreted asucc['length']. The default is Earth’s radius.bsdf (
BSDFordict, 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 (
quantityor 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
boolorbool) –Trueiffpin within the sphere.
- classmethod surface(altitude=<Quantity(0.0, 'kilometer')>, planet_radius=<Quantity(6378.1, 'kilometer')>, bsdf=None)[source]¶
This class method constructor provides a simplified parametrization 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 (
quantityor array-like, optional, default:0 km) – Surface altitude. If a unitless value is passed, it is interpreted asucc['length'].planet_radius (
quantityorfloat, optional) – Planet radius. If a unitless value is passed, it is interpreted asucc['length']. The default is Earth’s radius.bsdf (
BSDFordict, 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.
- 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:
- 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,SceneParameter] 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, orDictParameterinstances which must be rendered.
See also