SoGetBoundingBoxAction(3)
π SoGetBoundingBoxAction(3) β the Coin manual page, bestie edition π
okay so welcome to SoGetBoundingBoxAction(3) from the Coin manual, and let me tell you, this one is a whole bop. it's the class that goes around measuring everything. like a personal shopper but for geometry. π
β¨ NAME β¨
SoGetBoundingBoxAction β the class that calculates bounding boxes for nodes and subgraphs. it's giving ruler of the scene graph. πβ¨
πΈ SYNOPSIS πΈ
#include <Inventor/actions/SoGetBoundingBoxAction.h>
Inherits SoAction. yes bestie, it's a nepo baby, but like, a talented one. π
Public Types π¦
enum ResetType { TRANSFORM = 0x1, BBOX = 0x2, ALL = TRANSFORM | BBOX }
Public Types inherited from SoAction
enum AppliedCode { NODE = 0, PATH = 1, PATH_LIST = 2 }
enum PathCode { NO_PATH = 0, IN_PATH = 1, BELOW_PATH = 2, OFF_PATH = 3 }
Public Member Functions π
virtual SoType getTypeId (void) const
SoGetBoundingBoxAction (const SbViewportRegion &vp)
virtual ~SoGetBoundingBoxAction (void)
void setViewportRegion (const SbViewportRegion &newregion)
const SbViewportRegion & getViewportRegion (void) const
SbBox3f getBoundingBox (void) const
SbXfBox3f & getXfBoundingBox (void)
const SbVec3f & getCenter (void) const
void setInCameraSpace (const SbBool flag)
SbBool isInCameraSpace (void) const
void setResetPath (const SoPath *path, const SbBool resetbefore=TRUE,
const ResetType what=ALL)
const SoPath * getResetPath (void) const
SbBool isResetPath (void) const
SbBool isResetBefore (void) const
SoGetBoundingBoxAction::ResetType getWhatReset (void) const
void checkResetBefore (void)
void checkResetAfter (void)
void extendBy (const SbBox3f &box)
void extendBy (const SbXfBox3f &box)
void setCenter (const SbVec3f ¢er, const SbBool transformcenter)
SbBool isCenterSet (void) const
void resetCenter (void)
Public Member Functions inherited from SoAction
virtual ~SoAction (void)
virtual SbBool isOfType (SoType type) const
virtual void apply (SoNode *root)
virtual void apply (SoPath *path)
virtual void apply (const SoPathList &pathlist, SbBool obeysrules=FALSE)
void apply (SoAction *beingApplied)
virtual void invalidateState (void)
AppliedCode getWhatAppliedTo (void) const
SoNode * getNodeAppliedTo (void) const
SoPath * getPathAppliedTo (void) const
const SoPathList * getPathListAppliedTo (void) const
const SoPathList * getOriginalPathListAppliedTo (void) const
SbBool isLastPathListAppliedTo (void) const
PathCode getPathCode (int &numindices, const int *&indices)
void traverse (SoNode *const node)
SbBool hasTerminated (void) const
const SoPath * getCurPath (void)
SoState * getState (void) const
PathCode getCurPathCode (void) const
virtual SoNode * getCurPathTail (void)
void usePathCode (int &numindices, const int *&indices)
void pushCurPath (const int childindex, SoNode *node=NULL)
void popCurPath (const PathCode prevpathcode)
void pushCurPath (void)
void popPushCurPath (const int childindex, SoNode *node=NULL)
void popCurPath (void)
void switchToPathTraversal (SoPath *path)
void switchToNodeTraversal (SoNode *node)
Static Public Member Functions β
static SoType getClassTypeId (void)
static void addMethod (const SoType type, SoActionMethod method)
static void enableElement (const SoType type, const int stackindex)
static void initClass (void)
Static Public Member Functions inherited from SoAction
static void initClass (void)
static void initClasses (void)
static SoType getClassTypeId (void)
static void nullAction (SoAction *action, SoNode *node)
Protected Member Functions π
virtual const SoEnabledElementsList & getEnabledElements (void) const
virtual void beginTraversal (SoNode *node)
Protected Member Functions inherited from SoAction
SoAction (void)
virtual void endTraversal (SoNode *node)
void setTerminated (const SbBool flag)
virtual SbBool shouldCompactPathList (void) const
Static Protected Member Functions π§
static SoEnabledElementsList * getClassEnabledElements (void)
static SoActionMethodList * getClassActionMethods (void)
Static Protected Member Functions inherited from SoAction
static SoEnabledElementsList * getClassEnabledElements (void)
static SoActionMethodList * getClassActionMethods (void)
Additional Inherited Members π
Protected Attributes inherited from SoAction
SoState * state
SoActionMethodList * traversalMethods
π Detailed Description π
The SoGetBoundingBoxAction class calculates bounding boxes for nodes and subgraphs. that's the whole job description. it measures. it vibes. it reports back. π
so if you apply this action to a path or a scene graph root, it will calculate the bounding box and the center point of the geometry contained within the scene. two for one, lowkey a steal.
and here's the thing β you do not have to apply an SoGetBoundingBoxAction to the root of a scene. nope. when you use the action, what you get is the bounding box of the node you're applying it to, plus that node's subtree in the scene graph (if there is one). your node, your rules. β¨
the calculated bounding box will be in the local coordinates of that subtree. but if you're applying it to a scene graph root node, then the calculated bounding box will be in global coordinates. context matters, bestie.
the use of bounding boxes is ubiquitous within the Coin library β like, everywhere, all the time, main character energy. it's needed for the correct execution of, and for performance enhancements during, rendering, picking, caching, culling, etc. so basically the whole library runs on bounding boxes. no cap. π₯
SoSeparator nodes are aggressively caching the results of bounding box calculations, so they're really only recalculated whenever the scene graph rooted below any SoSeparator node has been modified. translation: for "static" parts of the scene, running this action over and over should be very quick on successive runs. it ate and left no crumbs. π
β οΈ heads up though β the algorithm used is not guaranteed to always give an exact bounding box. what it does is combine bounding boxes in pairs and extend one of them to contain the other. and since the boxes need not be parallel to the principal axes, the new box might not be a perfect fit for the box that wasn't extended (because its coordinate system has been changed). so like, close enough is the vibe, but it is what it is. π
β οΈ also note that whatever comes back fromgetBoundingBox()will be projected so as to be oriented along the principal axes, and that can often make it become quite a lot larger than what it was before projection. if your client code wants the best bounding box that Coin can calculate (which will usually be exact), you need to use thegetXfBoundingBox()method after having applied theSoGetBoundingBoxAction. that's the move. periodt. π
See also
SoSeparator::boundingBoxCaching
π Member Enumeration Documentation π
enum SoGetBoundingBoxAction::ResetType
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer. so like, not for you bestie, it's for the library's own business. π
πΈ Constructor & Destructor Documentation πΈ
SoGetBoundingBoxAction::SoGetBoundingBoxAction (const SbViewportRegion & vp)
Constructor. hi hello welcome to the world. π«Ά
okay so you might be sitting there like "why on earth do I have to pass in a viewport region argument just to calculate a bounding box" and honestly valid question, but there is a good reason for this: a few shape nodes need to know the viewport region to calculate their bounding box β these include SoText2 and SoImage, among others. so yeah, they need the tea. β
what's particular about these shapes is that they are fundamentally 2D shapes, but they are being rendered on the screen "surface" as if they were in a 3D scene. (this is possible because we can match each pixel's depth value against the 3D shapes in the scene.) iconic honestly.
so to compute an accurate 3D bounding box of a shape rendered in 2D on the screen "surface", you need to "de-project" the screen space area it occupies to a 2D rectangle placed at some depth in the scene. and this "de-projecting" operation needs to know about the dimensions of the viewport. so there it is. mystery solved. πβ¨
also, some 3D shapes β like for instance SoNurbsSurface β get slightly distorted if there's an SoComplexity node in the scene graph with the SoComplexity::value field set to SCREEN_SPACE. when that happens, it's also necessary to know the viewport region to find out how to accurately calculate the bounding box of those shapes. so many reasons, and every single one of them is real. π
you would usually want to pass in a viewport region equal to the layout of the current render area canvas. and if you have a viewer or So@Gui@RenderArea available, you can get hold of the viewport region data simply by doing:
const SbViewportRegion & vpreg = viewer->getViewportRegion();
(and if you don't have a viewer or render area available in your application at the point where you want to get the bounding box, it probably doesn't matter much what you set it to. the accuracy of the bounding box calculation might be slightly wrong versus the actual rendered appearance of the scene, but this is usually not noticeable. so like, don't stress. πΈ)
SoGetBoundingBoxAction::~SoGetBoundingBoxAction (void ) [virtual]
Destructor. bye bestie, thanks for measuring everything. π
π Member Function Documentation π
okay bestie, this is the big one β every single member function, no skips, no cap. grab a snack π
SoType SoGetBoundingBoxAction::getTypeId (void ) const [virtual] π
Returns the type identification of an object derived from a class inheriting SoAction. It's literally what you use for runtime type checking and "downward" casting, iykyk.
Implements SoAction.
SoType SoGetBoundingBoxAction::getClassTypeId (void ) [static] β¨
This static method returns the SoType object associated with objects of this class. static girlies stay winning.
void SoGetBoundingBoxAction::addMethod (const SoType type, SoActionMethod method) [static] π§
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
void SoGetBoundingBoxAction::enableElement (const SoType type, const int stackindex) [static] π§
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
const SoEnabledElementsList & SoGetBoundingBoxAction::getEnabledElements (void ) const [protected], [virtual] π
Returns list of enabled elements.
Reimplemented from SoAction.
SoEnabledElementsList * SoGetBoundingBoxAction::getClassEnabledElements (void ) [static], [protected] π
Returns list of enabled elements for this class. The enabledElements and methods variables are protected in the original OIV API. This is not such a good idea, since exposed static class member variables is a major grievance with regard to Win32 DLLs. This function is an extension for Coin, and it is not available in the original SGI Open Inventor v2.1 API.
π yes she's spilling the tea on the OIV API design, and yes it's verbatim facts, we don't make this stuff up.
SoActionMethodList * SoGetBoundingBoxAction::getClassActionMethods (void ) [static], [protected] π
Returns list of action methods for this class. The enabledElements and methods variables are protected in the original OIV API. This is not such a good idea, since exposed static class member variables is a major grievance with regard to Win32 DLLs. This function is an extension for Coin, and it is not available in the original SGI Open Inventor v2.1 API.
void SoGetBoundingBoxAction::initClass (void ) [static] π±
Initializes the runtime type system for this class, and sets up the enabled elements and action method list. she's doing the whole setup, main character energy fr fr.
void SoGetBoundingBoxAction::setViewportRegion (const SbViewportRegion & newregion) πͺ
Set a new viewport region with this method, if it has changed from the one passed in with the constructor.
const SbViewportRegion & SoGetBoundingBoxAction::getViewportRegion (void ) const πͺ
Returns the viewport region used by the action instance.
SbBox3f SoGetBoundingBoxAction::getBoundingBox (void ) const π¦
Returns the projected bounding box after (or during) traversal.
SbXfBox3f & SoGetBoundingBoxAction::getXfBoundingBox (void ) π¦β¨
Returns the bounding box and transformation matrix to global coordinates. Use after (or during) traversal.
const SbVec3f & SoGetBoundingBoxAction::getCenter (void ) const π―
Returns center point of scene after the action has been applied.
This might differ from the geometric center of the bounding box, as shape nodes may "weight" the center point according to various criteria (i.e. a faceset could for instance weight the center point according to the area within its bounding box where there are more polygons). so basically she has opinions about where the middle is π
void SoGetBoundingBoxAction::setInCameraSpace (const SbBool on) π₯
Sets whether the returned bounding box should be calculated in the coordinate system of the camera space or not.
SbBool SoGetBoundingBoxAction::isInCameraSpace (void ) const π₯
Returns whether the bounding box returned is to be in camera space.
void SoGetBoundingBoxAction::setResetPath (const SoPath * path, const SbBool resetbefore = TRUE, const ResetType what = ALL) π
Forces the computed bounding box to be reset and the transformation to be identity before or after the tail node of path, depending on the resetbefore argument. NULL can be specified for the path argument to disable this behavior.
See also: getResetPath(), isResetPath(), isResetBefore(), getWhatReset()
const SoPath * SoGetBoundingBoxAction::getResetPath (void ) const π
Returns the reset path (or NULL).
See also: setResetPath(), isResetPath(), isResetBefore(), getWhatReset()
SbBool SoGetBoundingBoxAction::isResetPath (void ) const π
Returns whether a reset path is set or not.
See also: setResetPath(), getResetPath(), isResetBefore(), getWhatReset()
SbBool SoGetBoundingBoxAction::isResetBefore (void ) const π
Returns whether the bounding box and transformation is reset before or after the tail node of the reset path.
See also: setResetPath(), getResetPath(), isResetPath(), getWhatReset()
SoGetBoundingBoxAction::ResetType SoGetBoundingBoxAction::getWhatReset (void ) const π
Returns what type of reset has been specified for the reset path.
See also: setResetPath(), getResetPath(), isResetPath(), isResetBefore()
void SoGetBoundingBoxAction::checkResetBefore (void ) π
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
Called before node traversal of each node (from SoNode action method).
void SoGetBoundingBoxAction::checkResetAfter (void ) π
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
Called after node traversal of each node (from SoNode action method).
void SoGetBoundingBoxAction::extendBy (const SbBox3f & box) π¦β
Extend bounding box by the given box. Called from nodes during traversal.
Should usually not be of interest to application programmers, unless you're extending Coin with your own shapenode extension classes. π that's you if you're building custom nodes, bestie.
void SoGetBoundingBoxAction::extendBy (const SbXfBox3f & box) π¦β
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void SoGetBoundingBoxAction::setCenter (const SbVec3f & centerarg, const SbBool transformcenter) π―
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
Set a new center point during traversal.
SbBool SoGetBoundingBoxAction::isCenterSet (void ) const π―
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
Query about the center point during traversal.
void SoGetBoundingBoxAction::resetCenter (void ) π―
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
Reset the scene center point during traversal.
void SoGetBoundingBoxAction::beginTraversal (SoNode * node) [protected], [virtual] πͺβ¨
This virtual method is called from SoAction::apply(), and is the entry point for the actual scene graph traversal. the way that she's literally the door into the whole graph π
It can be overridden to initialize the action at traversal start, for specific initializations in the action subclasses inheriting SoAction.
Default method just calls traverse(), which any overridden implementation of the method must do too (or call SoAction::beginTraversal()) to trigger the scene graph traversal.
β οΈ real talk: if you override this and forget to calltraverse()(orSoAction::beginTraversal()), nothing traverses. no traversal, no bounding box. periodt.
Reimplemented from SoAction.
π Author
Generated automatically by Doxygen for Coin from the source code.
and that's the whole page, bestie π«Ά she's from Coin, she's version 4.0.10, and she dropped on Thu Jun 25 2026 00:00:00 β go forth and get those bounding boxes, you absolute icon π β¨π¦
π¦ where this page comes from
- fedora 43: Coin4-devel 4.0.10-1.fc43 Β· BSD-3-Clause AND GPL-3.0-or-later
- fedora 43: Coin4-devel 4.0.10-1.fc43 Β· BSD-3-Clause AND GPL-3.0-or-later
- fedora 44: Coin4-devel 4.0.10-1.fc44 Β· BSD-3-Clause AND GPL-3.0-or-later
- fedora 44: Coin4-devel 4.0.10-1.fc44 Β· BSD-3-Clause AND GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms