Coin  4.0.3
Coin3D core library
Loading...
Searching...
No Matches
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
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
52class COIN_DLL_API SoIntersectionDetectionAction : public SoAction {
53 typedef SoAction hinherited;
54 SO_ACTION_HEADER(SoIntersectionDetectionAction);
55public:
56 static void initClass(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
104 SoIntersectionDetectionAction & operator = (const SoIntersectionDetectionAction & rhs); // N/A
105
106};
107
108#endif // !COIN_SOINTERSECTIONDETECTIONACTION_H
Definition SbPimplPtr.h:55
The SbVec3f class is a 3 dimensional vector with floating point coordinates.
Definition SbVec3f.h:51
The SoAction class is the base class for all traversal actions.
Definition SoAction.h:77
static void initClass(void)
Definition SoAction.cpp:370
virtual void apply(SoNode *root)
Definition SoAction.cpp:463
Response
Definition SoCallbackAction.h:94
The SoIntersectionDetectionAction class is for detecting intersecting primitives in a scene.
Definition SoIntersectionDetectionAction.h:52
The SoNode class is the base class for nodes used in scene graphs.
Definition SoNode.h:56
The SoPathList class is a container for pointers to SoPath objects.
Definition SoPathList.h:40
The SoPath class is a container class for traversal path descriptions.
Definition SoPath.h:52
The SoType class is the basis for the runtime type system in Coin.
Definition SoType.h:59
Struct with collision information.
Definition SoIntersectionDetectionAction.h:41