Coin: SoIntersectionDetectionAction.h Source File

| Coin3D is Free Software, published under the BSD 3-clause license. | https://coin3d.github.io https://www.kongsberg.com/en/kogt/

SoIntersectionDetectionAction.h
1#ifndef COIN_SOINTERSECTIONDETECTIONACTION_H
2#define COIN_SOINTERSECTIONDETECTIONACTION_H
3
4/**************************************************************************\
5 * Copyright (c) Kongsberg Oil & Gas Technologies AS
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are
10 * met:
11 *
12 * Redistributions of source code must retain the above copyright notice,
13 * this list of conditions and the following disclaimer.
14 *
15 * Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * Neither the name of the copyright holder nor the names of its
20 * contributors may be used to endorse or promote products derived from
21 * this software without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34\**************************************************************************/
35
36#include <Inventor/tools/SbPimplPtr.h>
37#include <Inventor/actions/SoSubAction.h>
38#include <Inventor/actions/SoAction.h>
39#include <Inventor/actions/SoCallbackAction.h>
40
41 struct SoIntersectingPrimitive {
42 SoPath * path;
43 enum PrimitiveType {
44 SEGMENT = 2,
45 LINE_SEGMENT = 2,
46 TRIANGLE = 3
47 } type;
48 SbVec3f vertex[3];
49 SbVec3f xf_vertex[3];
50};
51
52 class COIN_DLL_API SoIntersectionDetectionAction : public SoAction {
53 typedef SoAction hinherited;
54 SO_ACTION_HEADER(SoIntersectionDetectionAction);
55public:
56 static void initClass(void);
57 SoIntersectionDetectionAction(void);
58 virtual ~SoIntersectionDetectionAction(void);
59
60 enum Resp {
61 NEXT_PRIMITIVE,
62 NEXT_SHAPE,
63 ABORT
64 };
65
66 typedef SoCallbackAction::Response SoIntersectionVisitationCB(void * closure, const SoPath * where);
67 typedef SbBool SoIntersectionFilterCB(void * closure, const SoPath * p1, const SoPath * p2);
68 typedef Resp SoIntersectionCB(void * closure, const SoIntersectingPrimitive * p1, const SoIntersectingPrimitive * p2);
69
70 void setIntersectionDetectionEpsilon(float epsilon);
71 float getIntersectionDetectionEpsilon(void) const;
72
73 static void setIntersectionEpsilon(float epsilon);
74 static float getIntersectionEpsilon(void);
75
76 void setTypeEnabled(SoType type, SbBool enable);
77 SbBool isTypeEnabled(SoType type, SbBool checkgroups = FALSE) const;
78
79 void setManipsEnabled(SbBool enable);
80 SbBool isManipsEnabled(void) const;
81
82 void setDraggersEnabled(SbBool enable);
83 SbBool isDraggersEnabled(void) const;
84
85 void setShapeInternalsEnabled(SbBool enable);
86 SbBool isShapeInternalsEnabled(void) const;
87
88 void addVisitationCallback(SoType type, SoIntersectionVisitationCB * cb, void * closure);
89 void removeVisitationCallback(SoType type, SoIntersectionVisitationCB * cb, void * closure);
90
91 virtual void apply(SoNode * node);
92 virtual void apply(SoPath * path);
93 virtual void apply(const SoPathList & paths, SbBool obeysRules = FALSE);
94
95 virtual void setFilterCallback(SoIntersectionFilterCB * cb, void * closure = NULL);
96 virtual void addIntersectionCallback(SoIntersectionCB * cb, void * closure = NULL);
97 virtual void removeIntersectionCallback(SoIntersectionCB * cb, void * closure = NULL);
98
99private:
100 class PImpl;
101 SbPimplPtr<PImpl> pimpl;
102
103 SoIntersectionDetectionAction(const SoIntersectionDetectionAction & rhs); // N/A
104 SoIntersectionDetectionAction & operator = (const SoIntersectionDetectionAction & rhs); // N/A
105
106};
107
108#endif // !COIN_SOINTERSECTIONDETECTIONACTION_H
SbPimplPtr
Definition SbPimplPtr.h:55
SbVec3f
The SbVec3f class is a 3 dimensional vector with floating point coordinates.
Definition SbVec3f.h:51
SoAction::initClass
static void initClass(void)
Definition SoAction.cpp:370
SoAction::SoAction
SoAction(void)
Definition SoAction.cpp:337
SoAction::apply
virtual void apply(SoNode *root)
Definition SoAction.cpp:463
SoCallbackAction::Response
Response
Definition SoCallbackAction.h:94
SoIntersectionDetectionAction::isShapeInternalsEnabled
SbBool isShapeInternalsEnabled(void) const
Definition SoIntersectionDetectionAction.cpp:540
SoIntersectionDetectionAction::isDraggersEnabled
SbBool isDraggersEnabled(void) const
Definition SoIntersectionDetectionAction.cpp:510
SoIntersectionDetectionAction::setIntersectionEpsilon
static void setIntersectionEpsilon(float epsilon)
Definition SoIntersectionDetectionAction.cpp:351
SoIntersectionDetectionAction::getIntersectionEpsilon
static float getIntersectionEpsilon(void)
Definition SoIntersectionDetectionAction.cpp:362
SoIntersectionDetectionAction::setShapeInternalsEnabled
void setShapeInternalsEnabled(SbBool enable)
Definition SoIntersectionDetectionAction.cpp:525
SoIntersectionDetectionAction::addVisitationCallback
void addVisitationCallback(SoType type, SoIntersectionVisitationCB *cb, void *closure)
Definition SoIntersectionDetectionAction.cpp:554
SoIntersectionDetectionAction::setIntersectionDetectionEpsilon
void setIntersectionDetectionEpsilon(float epsilon)
Definition SoIntersectionDetectionAction.cpp:375
SoIntersectionDetectionAction::getIntersectionDetectionEpsilon
float getIntersectionDetectionEpsilon(void) const
Definition SoIntersectionDetectionAction.cpp:387
SoIntersectionDetectionAction::isManipsEnabled
SbBool isManipsEnabled(void) const
Definition SoIntersectionDetectionAction.cpp:478
SoIntersectionDetectionAction::isTypeEnabled
SbBool isTypeEnabled(SoType type, SbBool checkgroups=FALSE) const
Definition SoIntersectionDetectionAction.cpp:425
SoIntersectionDetectionAction::removeVisitationCallback
void removeVisitationCallback(SoType type, SoIntersectionVisitationCB *cb, void *closure)
Definition SoIntersectionDetectionAction.cpp:570
SoIntersectionDetectionAction::setTypeEnabled
void setTypeEnabled(SoType type, SbBool enable)
Definition SoIntersectionDetectionAction.cpp:400
SoIntersectionDetectionAction::setFilterCallback
virtual void setFilterCallback(SoIntersectionFilterCB *cb, void *closure=NULL)
Definition SoIntersectionDetectionAction.cpp:608
SoIntersectionDetectionAction::setManipsEnabled
void setManipsEnabled(SbBool enable)
Definition SoIntersectionDetectionAction.cpp:459
SoIntersectionDetectionAction::removeIntersectionCallback
virtual void removeIntersectionCallback(SoIntersectionCB *cb, void *closure=NULL)
Definition SoIntersectionDetectionAction.cpp:641
SoIntersectionDetectionAction::setDraggersEnabled
void setDraggersEnabled(SbBool enable)
Definition SoIntersectionDetectionAction.cpp:494
SoIntersectionDetectionAction::addIntersectionCallback
virtual void addIntersectionCallback(SoIntersectionCB *cb, void *closure=NULL)
Definition SoIntersectionDetectionAction.cpp:628
SoNode
The SoNode class is the base class for nodes used in scene graphs.
Definition SoNode.h:56
SoPathList
The SoPathList class is a container for pointers to SoPath objects.
Definition SoPathList.h:40
SoPath
The SoPath class is a container class for traversal path descriptions.
Definition SoPath.h:52
SoType
The SoType class is the basis for the runtime type system in Coin.
Definition SoType.h:59
SoIntersectingPrimitive
Struct with collision information.
Definition SoIntersectionDetectionAction.h:41