00001 #ifndef COIN_SOINTERSECTIONDETECTIONACTION_H
00002 #define COIN_SOINTERSECTIONDETECTIONACTION_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include <Inventor/actions/SoSubAction.h>
00028 #include <Inventor/actions/SoAction.h>
00029 #include <Inventor/actions/SoCallbackAction.h>
00030
00031 struct SoIntersectingPrimitive {
00032 SoPath * path;
00033 enum PrimitiveType {
00034 SEGMENT = 2,
00035 LINE_SEGMENT = 2,
00036 TRIANGLE = 3
00037 } type;
00038 SbVec3f vertex[3];
00039 SbVec3f xf_vertex[3];
00040 };
00041
00042 class SoIntersectionDetectionActionP;
00043
00044 class COIN_DLL_API SoIntersectionDetectionAction : public SoAction {
00045 typedef SoAction hinherited;
00046 SO_ACTION_HEADER(SoIntersectionDetectionAction);
00047 public:
00048 static void initClass(void);
00049 SoIntersectionDetectionAction(void);
00050 virtual ~SoIntersectionDetectionAction(void);
00051
00052 enum Resp {
00053 NEXT_PRIMITIVE,
00054 NEXT_SHAPE,
00055 ABORT
00056 };
00057
00058 typedef SoCallbackAction::Response SoIntersectionVisitationCB(void * closure, const SoPath * where);
00059 typedef SbBool SoIntersectionFilterCB(void * closure, const SoPath * p1, const SoPath * p2);
00060 typedef Resp SoIntersectionCB(void * closure, const SoIntersectingPrimitive * p1, const SoIntersectingPrimitive * p2);
00061
00062 void setIntersectionDetectionEpsilon(float epsilon);
00063 float getIntersectionDetectionEpsilon(void) const;
00064
00065 static void setIntersectionEpsilon(float epsilon);
00066 static float getIntersectionEpsilon(void);
00067
00068 void setTypeEnabled(SoType type, SbBool enable);
00069 SbBool isTypeEnabled(SoType type, SbBool checkgroups = FALSE) const;
00070
00071 void setManipsEnabled(SbBool enable);
00072 SbBool isManipsEnabled(void) const;
00073
00074 void setDraggersEnabled(SbBool enable);
00075 SbBool isDraggersEnabled(void) const;
00076
00077 void setShapeInternalsEnabled(SbBool enable);
00078 SbBool isShapeInternalsEnabled(void) const;
00079
00080 void addVisitationCallback(SoType type, SoIntersectionVisitationCB * cb, void * closure);
00081 void removeVisitationCallback(SoType type, SoIntersectionVisitationCB * cb, void * closure);
00082
00083 virtual void apply(SoNode * node);
00084 virtual void apply(SoPath * path);
00085 virtual void apply(const SoPathList & paths, SbBool obeysRules = FALSE);
00086
00087 virtual void setFilterCallback(SoIntersectionFilterCB * cb, void * closure = NULL);
00088 virtual void addIntersectionCallback(SoIntersectionCB * cb, void * closure = NULL);
00089 virtual void removeIntersectionCallback(SoIntersectionCB * cb, void * closure = NULL);
00090
00091 private:
00092 SoIntersectionDetectionActionP * pimpl;
00093 };
00094
00095 #endif // !COIN_SOINTERSECTIONDETECTIONACTION_H