SoSurroundScale – transformation node that adjusts the current matrix so a default cube will surround other objects
When traversed by an action, this node appends a transformation to the current transformation matrix so that a default size cube will surround the objects specified by its fields. Transform manipulators,
such as
SoHandleBoxManip, use these nodes to make themselves surround other objects.
This node only recalculates after the
invalidate() method has been called. Otherwise it uses a saved scale and translation.
When calculating what
to surround, the
SoSurroundScale looks at the current path in the action and at its own field values. Then
SoSurroundScale applies an
SoGetBoundingBoxAction to the node that is
numNodesUpToContainer nodes above it on the path.
SoSurroundScale also tells the action to reset the bounding
box upon traversal of the node located
numNodesUpToReset nodes above it in the path. The
SoSurroundScale then appends a translation and scale to the current transformation so that a default size
SoCube will translate and scale to fit this
bounding box.
For example, when an
SoHandleBoxManip wants to surround the objects it is going to move, the scene graph will look something like this:
\*(Cr
RootNode
-------------------------
| |
handleBoxManip movingStuff
|
handleBoxDragger
|
separator
-----------------------------------
| | |
motionMatrix surroundScale cubeGeom
The
SoHandleBoxDragger wants to transform the
cubeGeom so that it surrounds the
movingStuff. So it sets
the
surroundScale fields to:
numNodesUpToContainer = 4;
numNodesUpToReset = 3;
The
SoBoundingBoxAction will then be applied to
RootNode, with a reset after traversing the
SoHandleBoxManip. So the
SoSurroundScale will surround the objects below
separator, and to the right of
handleBoxManip, producing the desired effect.