Click or drag to resize
SoGetBoundingBoxAction Class

Computes bounding box of a scene.

Inheritance Hierarchy
SystemObject
  OIV.InventorSoNetBase
    OIV.Inventor.ActionsSoAction
      OIV.Inventor.ActionsSoGetBoundingBoxAction

Namespace: OIV.Inventor.Actions
Assembly: OIV.Inventor (in OIV.Inventor.dll) Version: 2024.2.2.0 (10.16.2.0)
Syntax
public class SoGetBoundingBoxAction : SoAction

The SoGetBoundingBoxAction type exposes the following members.

Constructors
  NameDescription
Public methodSoGetBoundingBoxAction

Constructor.

Top
Methods
  NameDescription
Public methodApply(SoNode)

Initiates an action on the graph defined by a node.

(Inherited from SoAction.)
Public methodApply(SoPath)

Initiates an action on the graph defined by a path.

(Inherited from SoAction.)
Public methodApply(SoPathList)
Calls Apply(pathList, false).
(Inherited from SoAction.)
Public methodApply(SoPathList, Boolean)

Initiates an action on the graph defined by a list of paths.

(Inherited from SoAction.)
Public methodCheckResetAfter
Public methodCheckResetBefore
Public methodClearApplyResult

When applied, an action may reference nodes or create objects (e.g.

(Inherited from SoAction.)
Public methodStatic memberEnableElement
Public methodEnableElements Obsolete.
Returns the list of enabled elements for a given action subclass.
(Inherited from SoAction.)
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Public methodExtendBy(SbBox3d)
Public methodExtendBy(SbBox3f)
Public methodExtendBy(SbXfBox3d)
Public methodExtendBy(SbXfBox3f)
Public methodForwardTraversal(SoNode)

Traverse a node that is not part of the current scenegraph.

(Inherited from SoAction.)
Public methodForwardTraversal(SoPath)

Traverse a path that is not part of the current scenegraph.

(Inherited from SoAction.)
Public methodGetBoundingBox

Returns computed bounding box in world space.

Public methodGetCenter

Returns computed center point in world space.

Public methodGetContinueActionInBranchFlag

This function indicates if the action must stop in the current branch.

(Inherited from SoAction.)
Public methodGetCurPath

Returns the path accumulated during traversal, i.e., the chain of nodes from the root of the traversed graph to the current node being traversed.

(Inherited from SoAction.)
Public methodGetDistribMode

Returns the distribution mode of this action across a cluster (ScaleViz-Cluster only).

(Inherited from SoAction.)
Public methodGetHashCode
Overrides GetHashCode().
(Inherited from SoNetBase.)
Public methodGetNodeAppliedTo

Returns the node the action is being applied to.

(Inherited from SoAction.)
Public methodGetOriginalPathListAppliedTo

Returns the original path list the action is being applied to.

(Inherited from SoAction.)
Public methodGetPathAppliedTo

Returns the path the action is being applied to.

(Inherited from SoAction.)
Public methodGetPathCode

Returns path code based on where current node (the node at the end of the current path) lies with respect to the path(s) the action is being applied to.

(Inherited from SoAction.)
Public methodGetPathListAppliedTo

Returns the path list the action is being applied to.

(Inherited from SoAction.)
Public methodGetPipeId

Gets pipe identifier in the range [1..N] associated to this render action while running a ScaleViz Multipipe configuration.

(Inherited from SoAction.)
Public methodGetResetPath

Returns the current reset path, or NULL.

Public methodGetSceneManager

Return the OIV.Inventor.SoSceneManager associated with this action.

(Inherited from SoAction.)
Public methodGetState

Gets the state from the action.

(Inherited from SoAction.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodGetViewportRegion

Returns current viewport region to use for action.

Public methodGetWhatAppliedTo

Returns code indicating what action is being applied to.

(Inherited from SoAction.)
Public methodGetWhatReset

Returns what flags were specified to be reset for the reset path.

Public methodGetXfBoundingBox

Returns computed bounding box before transformation into world space.

Public methodHasTerminated

Returns true if the traversal has reached a termination condition.

(Inherited from SoAction.)
Public methodInvalidateState

Invalidates the current traversal state in the action, forcing it to be recreated when the action is next applied.

(Inherited from SoAction.)
Public methodIsBeingApplied

Returns true if this action is currently being applied.

(Inherited from SoAction.)
Public methodIsCenterSet
Public methodIsInCameraSpace

Returns camera space flag.

Public methodIsLastPathListAppliedTo

Returns true if the current list is the last one from the original.

(Inherited from SoAction.)
Public methodIsResetBefore

Returns true if the resetBefore flag was specified for the reset path.

Public methodIsResetPath

Returns true if the current reset path is not NULL.

Public methodIsUsingAlternateRep

Returns true if current action is using alternate representations.

(Inherited from SoAction.)
Public methodPostDelayedTraversal

Method called by SoMultiPassManager after delayed pass traversals.

(Inherited from SoAction.)
Public methodPreDelayedTraversal

Method called by SoMultiPassManager before delayed pass traversals.

(Inherited from SoAction.)
Public methodResetCenter
Public methodResetContinueActionInBranchFlag

This function resets the continue action flag.

(Inherited from SoAction.)
Public methodSetCenter(SbVec3d, Boolean)
Public methodSetCenter(SbVec3f, Boolean)
Public methodSetInCameraSpace

Set this flag to true if you want the returned bounding box to be in the space of whatever camera is in the graph.

Public methodSetPipeId

Sets pipe identifier in the range [1..N] associated to this render action while running a ScaleViz Multipipe configuration.

(Inherited from SoAction.)
Public methodSetResetPath(SoPath)
Calls SetResetPath(path, true, OIV.Inventor.Actions.SoGetBoundingBoxAction.ResetTypes( .SoGetBoundingBoxAction.ALL )).
Public methodSetResetPath(SoPath, Boolean)
Calls SetResetPath(path, resetBefore, OIV.Inventor.Actions.SoGetBoundingBoxAction.ResetTypes( .SoGetBoundingBoxAction.ALL )).
Public methodSetResetPath(SoPath, Boolean, SoGetBoundingBoxActionResetTypes)

If a non-NULL path is specified, the action will reset the computed bounding box to be empty and/or the current transformation to identity.

Public methodSetSceneManager

Set the scene manager associated with this action (if any ).

(Inherited from SoAction.)
Public methodSetUpState

Creates state if it is NULL or it is no longer valid because new elements have been enabled since it was created.

(Inherited from SoAction.)
Public methodSetViewportRegion

Sets current viewport region to use for action.

Public methodStopActionInBranch

This function stops the action in the current Scene Graph branch.

(Inherited from SoAction.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodTraverse

Does traversal of a graph rooted by a node.

(Inherited from SoAction.)
Public methodUseAlternateRep

Tell the action to use alternate representations during traversal when available.

(Inherited from SoAction.)
Top
Remarks

This class is used to compute a 3D bounding box enclosing objects defined by a scene graph. The box is a rectangular prism. The action also computes the center point, which is defined differently for different objects. (For example, the center of an OIV.Inventor.Nodes.SoFaceSet is the average of its vertices' coordinates.) For a group, the center point is defined as the average of the centers of all shapes in it.

Each bounding box is calculated as an OIV.Inventor.SbXfBox3f, where the transformation matrix is defined so that the bounding box can be stored in the object space of the OIV.Inventor.Nodes.SoShape. When two bounding boxes are combined by a group node, the combination is performed so as to produce the smaller object-space box. Note that this does not necessarily yield the smallest world-space-aligned box, especially in the case of few OIV.Inventor.Nodes.SoShape nodes. The application can accomodate this by using OIV.Inventor.Nodes.SoBBox nodes. The result of the calculation by the action can be returned as an OIV.Inventor.SbXfBox3f or as a world-space-aligned OIV.Inventor.SbBox3f.

To calculate the bounding box of a subgraph bounded by two paths, specify the left edge of the subgraph with OIV.Inventor.Actions.SoGetBoundingBoxAction.SetResetPath(OIV.Inventor.SoPath, System.Boolean, OIV.Inventor.Actions.SoGetBoundingBoxAction.ResetTypes), and apply the action to the path that defines the right edge of the subgraph. The accumulated bounding box and transformation will be reset when the tail of the reset path is traversed.

If the subgraph being traversed does not contain any shapes, the returned bounding box will be empty (that is, SbBox3f.isEmpty() will return true).

The OIV.Inventor.Nodes.SoBBox node can be used to specify the bounding box for a shape or portion of the scene graph. This is useful, for example, to avoid the cost of computing the bounding box of a large (or frequently changing) geometry. The OIV.Inventor.Nodes.SoBBox node can also be used to specify that a shape or portion of the scene graph should not be included in the bounding box calculation. This is useful, for example, to avoid considering screen aligned "annotation" graphics like legends.

Bounding boxes are used internally by Open Inventor to optimize rendering, picking, culling and other operations. For example, the standard viewer classes apply an OIV.Inventor.Actions.SoGetBoundingBoxAction to the scene graph when automatic adjustment of the near and far clipping planes is enabled (which is the default).

Bounding boxes are cached by some grouping nodes, primarily OIV.Inventor.Nodes.SoSeparator. When this action is applied to a scene graph, it will use the cached bounding box whenever possible. So querying the bounding box of a (relatively) static scene graph is normally very fast. Open Inventor automatically detects when bounding caches become invalid and they are re-computed the next time an OIV.Inventor.Actions.SoGetBoundingBoxAction is applied.

NOTES:

  • The bounding box will only include shapes that are actually traversed. For example the bounding box will not include shapes under an OIV.Inventor.Nodes.SoSwitch with whichChild set to SO_SWITCH_NONE.

  • The action does not consider the visibility of shapes that are traversed. In other words the bounding box will include shapes that are invisible because of an OIV.Inventor.Nodes.SoDrawStyle, shapes that are clipped out because of an OIV.Inventor.Nodes.SoClipPlane, etc. Use OIV.Inventor.Nodes.SoBBox if necessary to exclude shapes from the bounding box computation.

  • Using the correct viewport region is critical when computing the bounding box of OIV.Inventor.Nodes.SoText2 (and a few other screen space related) nodes. However the bounding box of most shape nodes does not depend on the size of the viewport region and an approximate value may be passed to the constructor.

Sets: OIV.Inventor.Elements.SoViewportRegionElement

EXAMPLE

SoGetBoundingBoxAction gba = new SoGetBoundingBoxAction( viewer.GetViewportRegion() );
gba.Apply( root );
SbBox3f bbox = gba.GetBoundingBox();

See Also