eradiate.scenes.biosphere.InstancedCanopyElement¶
- class eradiate.scenes.biosphere.InstancedCanopyElement(id=None, canopy_element=None, instance_positions=NOTHING)[source]¶
Bases:
CompositeSceneElementInstanced canopy element [
instanced].This class wraps a canopy element and defines locations where to position instances (i.e. clones) of it.
Class method constructors
from_file(filename[, canopy_element])Construct a
InstancedCanopyElementfrom a text file specifying instance positions.- Parameters:
id (
str, optional) – Identifier of the current scene element.canopy_element (
CanopyElement, optional) – Instanced canopy element. Can be specified as a dictionary, which will be converted bybiosphere_factory.instance_positions (array-like, default:
[]) – Instance positions as an (n, 3)-array.Unit-enabled field (default: ucc[‘length’])
- Fields:
canopy_element (
CanopyElement, optional) – Instanced canopy element.instance_positions (
quantity) – Instance positions as an (n, 3)-array.
- classmethod from_file(filename, canopy_element=None)[source]¶
Construct a
InstancedCanopyElementfrom a text file specifying instance positions.File format
Each line defines an instance position as a whitespace-separated 3-vector of Cartesian coordinates.
Important
Location coordinates are assumed to be given in meters.
- Parameters:
filename (path-like) – Path to the text file specifying the leaves in the canopy. Can be absolute or relative.
canopy_element (
CanopyElementordict, optional) –CanopyElementto be instanced. If a dictionary is passed, if is interpreted bybiosphere_factory. If set toNone, an empty leaf cloud will be created.
- Returns:
InstancedCanopyElement– CreatedInstancedCanopyElement.- Raises:
ValueError – If
filenameis set toNone.FileNotFoundError – If
filenamedoes not point to an existing file.
- 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,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