SoIntersectionDetectionAction(3)
π SoIntersectionDetectionAction π
okay so bestie, we're talking about the <rainbow>SoIntersectionDetectionAction</rainbow> manual page from the Coin docs β SoIntersectionDetectionAction(3). It's the class that goes and finds intersecting primitives in a scene. Yes, like collision detection energy. It's giving "my polygons are touching and I need to know about it." π¦
heads up: this page is LONG so it's split into parts β this is part 1, more is coming, don't go anywhere. π
β¨ NAME β¨
SoIntersectionDetectionAction β the class that's for detecting intersecting primitives in a scene. π―
β¨ SYNOPSIS β¨
#include <Inventor/collision/SoIntersectionDetectionAction.h>
It Inherits SoAction. So yeah, it's a whole action, it does action things. π
πΈ Public Types πΈ
enum Resp { NEXT_PRIMITIVE, NEXT_SHAPE, ABORT }β the response enum, i.e. your three ways of telling it "okay keep going with the next primitive", "next shape please", or "ABORT, we're done here." πtypedef SoCallbackAction::Response SoIntersectionVisitationCB(void *closure, const SoPath *where)β the visitation callback type, borrowed straight fromSoCallbackAction::Response.typedef SbBool SoIntersectionFilterCB(void *closure, const SoPath *p1, const SoPath *p2)β the filter callback type, takes two paths and a closure, hands you back anSbBool.typedef Resp SoIntersectionCB(void *closure, const SoIntersectingPrimitive *p1, const SoIntersectingPrimitive *p2)β the intersection callback type: two intersecting primitives and a closure, and you return aResp.
π 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) constvoid setIntersectionDetectionEpsilon (float epsilon)float getIntersectionDetectionEpsilon (void) constvoid setTypeEnabled (SoType type, SbBool enable)SbBool isTypeEnabled (SoType type, SbBool checkgroups=FALSE) constvoid setManipsEnabled (SbBool enable)SbBool isManipsEnabled (void) constvoid setDraggersEnabled (SbBool enable)SbBool isDraggersEnabled (void) constvoid setShapeInternalsEnabled (SbBool enable)SbBool isShapeInternalsEnabled (void) constvoid addVisitationCallback (SoType type, SoIntersectionVisitationCB *cb, void *closure)void removeVisitationCallback (SoType type, SoIntersectionVisitationCB *cb, void *closure)virtual void apply (SoNode *node)virtual void apply (SoPath *path)virtual void apply (const SoPathList &paths, SbBool obeysRules=FALSE)virtual void setFilterCallback (SoIntersectionFilterCB *cb, void *closure=NULL)virtual void addIntersectionCallback (SoIntersectionCB *cb, void *closure=NULL)virtual void removeIntersectionCallback (SoIntersectionCB *cb, void *closure=NULL)
π Public Member Functions inherited from SoAction
virtual ~SoAction (void)virtual SbBool isOfType (SoType type) constvoid apply (SoAction *beingApplied)virtual void invalidateState (void)AppliedCode getWhatAppliedTo (void) constSoNode * getNodeAppliedTo (void) constSoPath * getPathAppliedTo (void) constconst SoPathList * getPathListAppliedTo (void) constconst SoPathList * getOriginalPathListAppliedTo (void) constSbBool isLastPathListAppliedTo (void) constPathCode getPathCode (int &numindices, const int *&indices)void traverse (SoNode *const node)SbBool hasTerminated (void) constconst SoPath * getCurPath (void)SoState * getState (void) constPathCode getCurPathCode (void) constvirtual 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 void setIntersectionEpsilon (float epsilon)static float getIntersectionEpsilon (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
π Protected Member Functions inherited from SoAction
SoAction (void)virtual void beginTraversal (SoNode *node)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 * stateSoActionMethodList * traversalMethods
β¨ Detailed Description β¨
okay so SoIntersectionDetectionAction is the class for detecting intersecting primitives in a scene. that's the whole vibe. π―
β οΈ real talk: only collisions between actual geometry in the scene get detected. so the contents of some special nodes β like e.g.SoText2andSoImage(which project to screen-plane bitmap graphics, and not actual polygons) β will not be considered for collision detection. they're not invited to the party, no cap.
β οΈ also real talk: SoIntersectionDetectionAction is not a high-performance component in Coin. using it in a continuous manner over complex scene graphs is doomed to be a performance killer. like, genuinely doomed. bestie, don't do that to your frame rate. π
Below is a simple usage example for this class. It was written as a standalone framework set up for profiling and optimization of the SoIntersectionDetectionAction. It tests intersection of all shapes against each other for the loaded file. π₯
#include <cstdlib>
#include <Inventor/SbTime.h>
#include <Inventor/SoDB.h>
#include <Inventor/SoInteraction.h>
#include <Inventor/collision/SoIntersectionDetectionAction.h>
#include <Inventor/errors/SoDebugError.h>
#include <Inventor/nodekits/SoNodeKit.h>
#include <Inventor/nodes/SoSeparator.h>
static SoIntersectionDetectionAction::Resp
intersectionCB(void * closure,
const SoIntersectingPrimitive * pr1,
const SoIntersectingPrimitive * pr2)
{
(void)fprintf(stdout, "intersection hit!\n");
return SoIntersectionDetectionAction::NEXT_PRIMITIVE;
}
int
main(int argc, char ** argv)
{
SoDB::init();
SoNodeKit::init();
SoInteraction::init();
if (argc != 2) {
(void)fprintf(stderr, "\n\tUsage: testapp <filename.iv>\n\n");
exit(1);
}
SoInput in;
SbBool ok = in.openFile(argv[1]);
assert(ok);
SoSeparator * root = SoDB::readAll(&in);
assert(root);
root->ref();
SoIntersectionDetectionAction ida;
ida.addIntersectionCallback(intersectionCB, NULL);
ida.setManipsEnabled(FALSE);
ida.setDraggersEnabled(FALSE);
ida.setIntersectionDetectionEpsilon(10.0f);
SbTime starttime = SbTime::getTimeOfDay();
SoDebugError::postInfo("main", "SoIntersectionDetectionAction::apply");
ida.apply(root);
SoDebugError::postInfo("main", "apply() done after %f seconds.",
(SbTime::getTimeOfDay() - starttime).getValue());
root->unref();
return 0;
}
β¨ Since β¨
- Coin 2.1 π
- TGS Inventor 2.4 π
and that's part 1, bestie β there's more coming so stay tuned π
β¨ Member Function Documentation β¨
okay bestie, this is the part where we go function by function. no cap, there are a lot, but we're gonna get through them together. each one is a little building block for making intersection detection happen. let's go! π
π¦ SoType SoIntersectionDetectionAction::getTypeId (void ) const [virtual] π¦
Returns the type identification of an object derived from a class inheriting SoAction. This is used for runtime type checking and "downward" casting.
Implements SoAction.
πΈ SoType SoIntersectionDetectionAction::getClassTypeId (void ) [static] πΈ
This static method returns the SoType object associated with objects of this class.
π void SoIntersectionDetectionAction::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 SoIntersectionDetectionAction::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 & SoIntersectionDetectionAction::getEnabledElements (void ) const [protected], [virtual] π
Returns list of enabled elements.
Reimplemented from SoAction.
π SoEnabledElementsList * SoIntersectionDetectionAction::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.
π SoActionMethodList * SoIntersectionDetectionAction::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 SoIntersectionDetectionAction::setIntersectionDetectionEpsilon (float epsilon) β
Sets the intersection detection distance epsilon value for the action object. This overrides the global value.
See also SoIntersectionDetectionAction::setIntersectionEpsilon() for important information about how this setting influences performance.
β float SoIntersectionDetectionAction::getIntersectionDetectionEpsilon (void ) const β
Returns the set intersection detection distance epsilon value for the action object.
π₯ void SoIntersectionDetectionAction::setIntersectionEpsilon (float epsilon) [static] π₯
Sets the global intersection detection distance epsilon value.
This makes primitives within the epsilon distance be considered to intersect each other.
This will affect all intersection detection action objects in use that don't have a locally set value.
The epsilon value is a world space value.
β οΈ Be aware that increasing the epsilon value can dramatically increase the number of primitive intersection tests being done to decide intersections. Increasing the epsilon value can therefore cause serious slow-downs in the running time of the intersections checks. π
π₯ float SoIntersectionDetectionAction::getIntersectionEpsilon (void ) [static] π₯
Returns the globally set intersection detection distance epsilon value.
π¦ void SoIntersectionDetectionAction::setTypeEnabled (SoType type, SbBool enable) π¦
Sets whether nodes of specific types (including derived objects) should be tested for intersection or not.
See also isTypeEnabled(), setManipsEnabled(), setDraggersEnabled()
π¦ SbBool SoIntersectionDetectionAction::isTypeEnabled (SoType type, SbBool checkgroups = FALSE) const π¦
Returns whether nodes of specific types are enabled or not. The checkgroups argument can be set to TRUE if you want the return value to reflect whether the node will be implicit enabled/disabled through the settings controlled by the setManipsEnabled() and setDraggersEnabled() functions.
The default is that all node types are enabled.
Note that derivation checks are not performed - the type needs to be the exact same type as has been disabled with setTypeEnabled()
See also setTypeEnabled()
π void SoIntersectionDetectionAction::setManipsEnabled (SbBool enable) π
Sets whether manipulators in the scene graph should be tested for intersection with other geometry or not.
Note that when draggers are disabled with setDraggersEnabled(), this setting has no effect - manipulators are disabled too.
See also isManipsEnabled(), setDraggersEnabled(), setTypeEnabled()
π SbBool SoIntersectionDetectionAction::isManipsEnabled (void ) const π
Returns whether the actions is set up to test intersection on manipulators in the scene or not.
Note that when draggers are disabled with setDraggersEnabled(), this setting has no effect - manipulators are disabled too.
The default is that manipulators are enabled for intersection testing with other geometry in the scene.
See also setManipsEnabled()
π
void SoIntersectionDetectionAction::setDraggersEnabled (SbBool enable) π
Sets whether draggers in the scene graph should be tested for intersection with other geometry or not.
Note that when you disable draggers, manipulators are also automatically disabled, although the isManipsDisabled() setting might reflect otherwise.
See also isDraggersEnabled(), setManipsEnabled(), setTypeEnabled()
π
SbBool SoIntersectionDetectionAction::isDraggersEnabled (void ) const π
Returns whether the actions is set up to test intersection on draggers in the scene or not.
The default is that draggers are enabled for intersection testing with other geometry in the scene.
See also setDraggersEnabled()
π¦ void SoIntersectionDetectionAction::setShapeInternalsEnabled (SbBool enable) π¦
Sets whether nodes in the scene graph should be checked for intersecting primitives within themselves.
Default is FALSE.
See also isShapeInternalsEnabled()
π¦ SbBool SoIntersectionDetectionAction::isShapeInternalsEnabled (void ) const π¦
Returns whether nodes in the scene graph will be checked for intersecting primitives within themselves.
The default value for this setting is FALSE.
See also setShapeInternalsEnabled()
π void SoIntersectionDetectionAction::addVisitationCallback (SoType type, SoIntersectionVisitationCB * cb, void * closure) π
The scene graph traversal can be controlled with callbacks which you set with this method. Use just like you would use SoCallbackAction::addPreCallback().
See also SoCallbackAction::addPreCallback()
π void SoIntersectionDetectionAction::removeVisitationCallback (SoType type, SoIntersectionVisitationCB * cb, void * closure) π
The scene graph traversal can be controlled with callbacks which you remove with this method. Use just like you would use SoCallbackAction::removePreCallback().
See also SoCallbackAction::removePreCallback()
β void SoIntersectionDetectionAction::apply (SoNode * root) [virtual] β
Applies the action to the scene graph rooted at root.
β οΈ Note that you should not apply an action to a node with a zero reference count. The behavior in that case is undefined.
Reimplemented from SoAction.
β void SoIntersectionDetectionAction::apply (SoPath * path) [virtual] β
Applies the action to the parts of the graph defined by path.
Note that an SoPath will also contain all nodes that may influence e.g. geometry nodes in the path. So for instance applying an SoGLRenderAction on an SoPath will render that path as expected in the view, where geometry will get its materials, textures, and other appearance settings correctly.
If the path ends in an SoGroup node, the action will also traverse the tail node's children.
Reimplemented from SoAction.
β void SoIntersectionDetectionAction::apply (const SoPathList & pathlist, SbBool obeysrules = FALSE) [virtual] β
Applies action to the graphs defined by pathlist. If obeysrules is set to TRUE, pathlist must obey the following four conditions (which is the case for path lists returned from search actions for non-group nodes and path lists returned from picking actions):
- All paths must start at the same head node.
- All paths must be sorted in traversal order.
- The paths must be unique.
- No path can continue through the end point of another path.
See also SoAction::apply(SoPath * path)
Reimplemented from SoAction.
π void SoIntersectionDetectionAction::setFilterCallback (SoIntersectionFilterCB * cb, void * closure = NULL) [virtual] π
This callback is called when two shapes are found to have intersecting bounding boxes, and are about to be checked for real intersection between their primitives.
When intersection epsilon values are in use, bounding box intersection testing is done approximately and will trigger the filter callback on boxes that are further from each other than the epsilon length.
If the callback returns TRUE, the intersection test will be performed. If the callback returns FALSE, the intersection testing will be skipped.
The API allows only one filter callback.
π void SoIntersectionDetectionAction::addIntersectionCallback (SoIntersectionCB * cb, void * closure = NULL) [virtual] π
Adds a callback to be called when two intersecting primitives are found in the scene.
If the callback returns ABORT, the intersection detection is aborted. If the callback returns NEXT_SHAPE, the intersection detection between these two shapes are aborted and the action continues checking other shapes. If the callback returns NEXT_PRIMITIVE, the intersection detection testing continues checking the other primitives in these two shapes.
See also removeIntersectionCallback()
π void SoIntersectionDetectionAction::removeIntersectionCallback (SoIntersectionCB * cb, void * closure = NULL) [virtual] π
Removes a callback set with addIntersectionCallback().
See also addIntersectionCallback()
β¨ Author β¨
Generated automatically by Doxygen for Coin from the source code.
And that's a wrap, bestie! This page is from the SoIntersectionDetectionAction(3) man page, brought to you by Coin version 4.0.10, auto-generated by Doxygen on Thu Jun 25 2026 00: (yep, the timestamp got a lil cut off, no cap). Stay intersection-free (or not, depending on your epsilon). π
π¦ 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