SOGETBOUNDINGBOXACTION(3iv)
๐ NAME ๐
SoGetBoundingBoxAction โ she computes the bounding box of a scene, and she does it flawlessly ๐
(oh also this whole page lives in the 3IV manual, in case you were wondering ๐)
๐ฆ INHERITS FROM ๐ฆ
SoAction > SoGetBoundingBoxAction
like, she's an action, she inherited the whole action vibe, iykyk โจ
๐ SYNOPSIS ๐
#include <Inventor/actions/SoGetBoundingBoxAction.h>
enum ResetType {
SoGetBoundingBoxAction::TRANSFORM
Transformation
SoGetBoundingBoxAction::BBOX Bounding Box
SoGetBoundingBoxAction::ALL Both Transform and Bounding Box
}
okay so here are the methods she brings to the table, from the class SoGetBoundingBoxAction ๐
SoGetBoundingBoxAction(const SbViewportRegion
&viewportRegion)
void setViewportRegion(const SbViewportRegion
&newRegion)
const SbViewportRegion & getViewportRegion() const
SbBox3f getBoundingBox() const
SbXfBox3f & getXfBoundingBox()
const SbVec3f & getCenter() const
void setInCameraSpace(SbBool flag)
SbBool isInCameraSpace() const
void setResetPath(const SoPath *path, SbBool
resetBefore = TRUE, ResetType what = ALL)
const SoPath * getResetPath() const
SbBool isResetPath() const
SbBool isResetBefore() const
SoGetBoundingBoxAction::ResetType
getWhatReset() const
and the methods she got from the class SoAction, her ancestor, iconic family line fr fr ๐ธ
virtual void apply(SoNode *node)
virtual void apply(SoPath *path)
virtual void apply(const SoPathList &pathList, SbBool obeysRules =
FALSE)
static SoType getClassTypeId()
virtual SoType getTypeId()
virtual SbBool isOfType(SoType type)
virtual void invalidateState()
๐ DESCRIPTION ๐
So bestie, this class is literally the girl for computing a 3D bounding box that wraps around the objects defined by a scene graph. The box is a rectangular prism, no cap. โจ
She also computes the center point, and here's the tea: that center is defined differently for different objects. For example, the center of an SoFaceSet is the average of its vertices' coordinates. And for a group? The center point is defined as the average of the centers of all the shapes inside it. math queen behavior honestly ๐งฎ๐
Every single bounding box gets calculated as an SbXfBox3f, where the transformation matrix is defined so that the bounding box can be stored in the object space of the SoShape. When a group node combines two bounding boxes, the combination is done in a way that produces the smaller untransformed box. Efficiency? Obsessed. ๐ซถ
The result of the action's calculation can be handed back to you either as an SbXfBox3f or as a world-space-aligned SbBox3f. Your call, bestie.
Now โ if you wanna calculate the bounding box of a subgraph bounded by two paths? Here's how: specify the left edge of the subgraph with setResetPath(), then apply the action to the path that defines the right edge of the subgraph. The accumulated bounding box and transformation get reset when the tail of the reset path is traversed. Sneaky but so smart. ๐ญ
and if the subgraph being traversed doesn't contain any shapes at all? The returned bounding box will be empty (that is,box.isEmpty()will returnTRUE). it's giving void, it's giving nothing, truly a nothingburger ๐
โจ METHODS โจ
๐ฆ the constructor ๐ฆ
SoGetBoundingBoxAction(const SbViewportRegion &viewportRegion)โ the constructor takes the viewport region to use for picking. And yes, even though the bounding box computation may not involve a window per se, some nodes genuinely need this info to figure out their size and placement. so don't skip it bestie ๐
๐ viewport region stuff ๐
void setViewportRegion(const SbViewportRegion &newRegion)const SbViewportRegion & getViewportRegion() const
These set and return the current viewport region to use for the action. set it, get it, slay it ๐
๐ธ getting the boxes ๐ธ
SbBox3f getBoundingBox() constโ returns the computed bounding box in world space. the classic. โจSbXfBox3f & getXfBoundingBox()โ returns the computed bounding box before transformation into world space. the pre-glow-up version, lowkey iconic ๐ฅconst SbVec3f & getCenter() constโ returns the computed center point in world space. the main character of the box, fr fr ๐
๐ camera space ๐
void setInCameraSpace(SbBool flag)โ set this flag toTRUEif you want the returned bounding box to be in the space of whatever camera is in the graph. Camera space is defined to have the viewpoint at the origin, with the direction of view along the negative z axis. This space can be used to determine distances of objects from the camera. distance queen ๐โจSbBool isInCameraSpace() constโ returns the camera space flag. just checking in on her ๐ซถ
๐ reset path ๐
void setResetPath(const SoPath *path, SbBool resetBefore = TRUE, ResetType what = ALL)โ if a non-NULLpath is specified, the action will reset the computed bounding box to be empty and/or the current transformation to identity. TheresetBeforeflag indicates whether to perform the reset before or after the tail node of the path is traversed. timing is everything, bestie โฐconst SoPath * getResetPath() constโ returns the current reset path, orNULL. ๐ซSbBool isResetPath() constโ returnsTRUEif the current reset path is notNULL. โจSbBool isResetBefore() constโ returnsTRUEif theresetBeforeflag was specified for the reset path. ๐ธSoGetBoundingBoxAction::ResetType getWhatReset() constโ returns what flags were specified to be reset for the reset path. receipts, basically ๐งพ๐
๐ SEE ALSO ๐
SbBox3f, SbXfBox3f, SoGetMatrixAction
go read those too, they're all in the friend group ๐ซถโจ
okay that's the whole page bestie, no notes ๐ This was SoGetBoundingBoxAction(3IV)() โ the source/version and date live right there in that line, so consider yourself formally signed off on. mwah, go compute some boxes ๐๐
โจ
๐ฆ where this page comes from
- debian bookworm: inventor-doc 2.1.5-10+dfsg-2 ยท LGPL-2.0-or-later
- debian trixie: inventor-doc 2.1.6+ds-2 ยท LGPL-2.0-or-later
- ubuntu jammy: inventor-doc 2.1.5-10-24
- ubuntu noble: inventor-doc 2.1.5-10+dfsg-2.1build2 ยท LGPL-2.0-or-later
- ubuntu questing: inventor-doc 2.1.6+ds-2
- ubuntu resolute: inventor-doc 2.1.6.1+ds-1 ยท LGPL-2.0-or-later
- ubuntu stonking: inventor-doc 2.1.6.1+ds-1 ยท LGPL-2.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms