eradiate.scenes.shapes.SphereShape#

class eradiate.scenes.shapes.SphereShape(id='shape', bsdf=None, to_world=None, center=NOTHING, radius=NOTHING)[source]#

Bases: ShapeNode

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

  • to_world (mitsuba.ScalarTransform4f or array-like, optional) – Transform to scale, shift and rotate the shape.

  • 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 or float, optional, default: 1.0) – Sphere radius. Unit-enabled field (default: ucc['length']).

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

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

  • to_world (mitsuba.ScalarTransform4f or None) – Transform to scale, shift and rotate the shape.

  • center (quantity) – Location of the centre of the sphere.

  • radius (quantity) – Sphere radius.

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 (quantity or array-like, optional, default: 100 km) – Top-of-atmosphere altitude. If a unitless value is passed, it is interpreted as ucc['length'].

  • planet_radius (quantity or float, optional) – Planet radius. If a unitless value is passed, it is interpreted as ucc['length']. The default is Earth’s radius.

  • bsdf (BSDF or dict, 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 as ucc['length'].

  • strict (bool) – If True, comparison is done using strict inequalities (<, >).

Returns:

result (array of bool or bool) – True iff p in 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 (quantity or array-like, optional, default: 0 km) – Surface altitude. If a unitless value is passed, it is interpreted as ucc['length'].

  • planet_radius (quantity or float, optional) – Planet radius. If a unitless value is passed, it is interpreted as ucc['length']. The default is Earth’s radius.

  • bsdf (BSDF or dict, 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:

BoundingBox

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.