| http://www.sim.no/ http://www.coin3d.org/

SoIntersectionDetectionAction.h
1 #ifndef COIN_SOINTERSECTIONDETECTIONACTION_H
2 #define COIN_SOINTERSECTIONDETECTIONACTION_H
3
4 /**************************************************************************\
5 *
6 * This file is part of the Coin 3D visualization library.
7 * Copyright (C) by Kongsberg Oil & Gas Technologies.
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * ("GPL") version 2 as published by the Free Software Foundation.
12 * See the file LICENSE.GPL at the root directory of this source
13 * distribution for additional information about the GNU GPL.
14 *
15 * For using Coin with software that can not be combined with the GNU
16 * GPL, and for taking advantage of the additional benefits of our
17 * support services, please contact Kongsberg Oil & Gas Technologies
18 * about acquiring a Coin Professional Edition License.
19 *
20 * See http://www.coin3d.org/ for more information.
21 *
22 * Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, NORWAY.
23 * http://www.sim.no/ sales@sim.no coin-support@coin3d.org
24 *
25 \**************************************************************************/
26
27 #include <Inventor/tools/SbPimplPtr.h>
28 #include <Inventor/actions/SoSubAction.h>
29 #include <Inventor/actions/SoAction.h>
30 #include <Inventor/actions/SoCallbackAction.h>
31
32 struct SoIntersectingPrimitive {
33 SoPath * path;
34 enum PrimitiveType {
35 SEGMENT = 2,
36 LINE_SEGMENT = 2,
37 TRIANGLE = 3
38 } type;
39 SbVec3f vertex[3];
40 SbVec3f xf_vertex[3];
41 };
42
43 class COIN_DLL_API SoIntersectionDetectionAction : public SoAction {
44 typedef SoAction hinherited;
45 SO_ACTION_HEADER(SoIntersectionDetectionAction);
46 public:
47 static void initClass(void);
48 SoIntersectionDetectionAction(void);
49 virtual ~SoIntersectionDetectionAction(void);
50
51 enum Resp {
52 NEXT_PRIMITIVE,
53 NEXT_SHAPE,
54 ABORT
55 };
56
57 typedef SoCallbackAction::Response SoIntersectionVisitationCB(void * closure, const SoPath * where);
58 typedef SbBool SoIntersectionFilterCB(void * closure, const SoPath * p1, const SoPath * p2);
59 typedef Resp SoIntersectionCB(void * closure, const SoIntersectingPrimitive * p1, const SoIntersectingPrimitive * p2);
60
61 void setIntersectionDetectionEpsilon(float epsilon);
62 float getIntersectionDetectionEpsilon(void) const;
63
64 static void setIntersectionEpsilon(float epsilon);
65 static float getIntersectionEpsilon(void);
66
67 void setTypeEnabled(SoType type, SbBool enable);
68 SbBool isTypeEnabled(SoType type, SbBool checkgroups = FALSE) const;
69
70 void setManipsEnabled(SbBool enable);
71 SbBool isManipsEnabled(void) const;
72
73 void setDraggersEnabled(SbBool enable);
74 SbBool isDraggersEnabled(void) const;
75
76 void setShapeInternalsEnabled(SbBool enable);
77 SbBool isShapeInternalsEnabled(void) const;
78
79 void addVisitationCallback(SoType type, SoIntersectionVisitationCB * cb, void * closure);
80 void removeVisitationCallback(SoType type, SoIntersectionVisitationCB * cb, void * closure);
81
82 virtual void apply(SoNode * node);
83 virtual void apply(SoPath * path);
84 virtual void apply(const SoPathList & paths, SbBool obeysRules = FALSE);
85
86 virtual void setFilterCallback(SoIntersectionFilterCB * cb, void * closure = NULL);
87 virtual void addIntersectionCallback(SoIntersectionCB * cb, void * closure = NULL);
88 virtual void removeIntersectionCallback(SoIntersectionCB * cb, void * closure = NULL);
89
90 private:
91 class PImpl;
92 SbPimplPtr<PImpl> pimpl;
93
94 SoIntersectionDetectionAction(const SoIntersectionDetectionAction & rhs); // N/A
95 SoIntersectionDetectionAction & operator = (const SoIntersectionDetectionAction & rhs); // N/A
96
97 };
98
99 #endif // !COIN_SOINTERSECTIONDETECTIONACTION_H
SoAction::initClass
static void initClass(void)
Definition: SoAction.cpp:366
SoPathList
The SoPathList class is a container for pointers to SoPath objects.As this class inherits SoBaseList...
Definition: SoPathList.h:31
SoNode
The SoNode class is the base class for nodes used in scene graphs.Coin is a retained mode 3D visualiz...
Definition: SoNode.h:47
SoPath
The SoPath class is a container class for traversal path descriptions.SoPath objects contain a list o...
Definition: SoPath.h:43
SoAction
The SoAction class is the base class for all traversal actions.Applying actions is the basic mechanis...
Definition: SoAction.h:68
SbVec3f
The SbVec3f class is a 3 dimensional vector with floating point coordinates.This vector class is used...
Definition: SbVec3f.h:40
SoCallbackAction::Response
Response
Definition: SoCallbackAction.h:85
SoIntersectionDetectionAction
The SoIntersectionDetectionAction class is for detecting intersecting primitives in a scene...
Definition: SoIntersectionDetectionAction.h:43
SoIntersectingPrimitive
Struct with collision information.
Definition: SoIntersectionDetectionAction.h:32
SoAction::apply
virtual void apply(SoNode *root)
Definition: SoAction.cpp:459
SoType
The SoType class is the basis for the run-time type system in Coin.Many of the classes in the Coin li...
Definition: SoType.h:50

Copyright © 1998-2010 by Kongsberg Oil & Gas Technologies. All rights reserved.