spatialgeometry.SceneNode
- class SceneNode(pose: ndarray | SE3 = array([[1., 0., 0., 0.], [0., 1., 0., 0.], [0., 0., 1., 0.], [0., 0., 0., 1.]]), scene_parent: SceneNode | None = None, scene_children: list[SceneNode] | None = None)[source]
Bases:
objectBase class for a node in a scene graph.
Subclassed for particular shapes and provides the shape’s pose, a parent/children relationship to other nodes, and the ability to compute its pose in the world frame from the scene graph.
- Parameters:
pose – Local reference frame of this node relative to its parent in the scene graph (or the world frame if it has no parent), defaults to the identity transform.
scene_parent – Parent node of this node in the scene graph.
scene_children – Child nodes of this node in the scene graph.
- attach(object: SceneNode) None[source]
Attach a child node
- Parameters:
object – the node to attach as a child of this node
- Seealso:
- attach_to(object: SceneNode) None[source]
Attach this node to a parent node
- Parameters:
object – the node to attach this node to, this node will become a child of the parent
- Seealso:
- property scene_children: list[SceneNode]
Return the child nodes of this object in the scene graph.
Setting a new list of children updates each child’s
scene_parentto this object, but does not remove this object from any previous parent’sscene_children.This is a read/write property.
- Return type:
list(SceneNode)
- Seealso:
- property scene_parent: SceneNode | None
Return the parent node of this object in the scene graph.
Setting a new parent adds this object to the new parent’s
scene_children.This is a read/write property.
- Return type:
SceneNode | None
- Seealso:
- property T: ndarray
Pose of the shape relative to its parent frame in the scene graph (or the world frame if it has no parent), as a 4x4 homogeneous transformation matrix. Set via the
poseargument of the constructor.This is a read/write property. The getter always returns a plain
ndarray; the setter also accepts anSE3.Warning
Because the getter returns an
ndarray, in-place operators likeshape.T *= deltado an elementwise multiply, not a pose composition, even whendeltais anSE3– useshape.T = shape.T * delta(orshape.T @= delta.A) instead.- Return type:
ndarray(4,4)
- tree() str[source]
Render the whole tree this node lives in as indented text – walks up to the root first (the same root-finding as
update()), then renders down from there, with this node marked with a trailing<==so its position in the tree is visible.- Return type:
str
- tree_children() str[source]
Render this node’s own subtree as indented text (one
repr()per line), not walking through parents – the same “not through parents” scope as_propagate_scene_children().Nodes have no
.namein this package, so each line is that node’s ownrepr()(type, constructor params, color, pose) – usually enough to tell siblings apart, since it’s rare for two distinct nodes to share an identical pose as well as everything else.- Return type:
str
- update() None[source]
Recompute the world transform of every node in the scene graph this node belongs to, starting from the root and working down.
Call this after changing any node’s
T/pose(or itsscene_parent) – nothing propagates automatically. It doesn’t matter which node in the graph you call it on: this always walks up to the root first, then pushes fresh world transforms down through the whole tree, not just this node’s own subtree.