00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef COIN_SORAYPICKACTION_H
00021 #define COIN_SORAYPICKACTION_H
00022
00023 #include <Inventor/actions/SoPickAction.h>
00024
00025 class SbBox3f;
00026 class SbLine;
00027 class SbMatrix;
00028 class SbVec2f;
00029 class SbVec2s;
00030 class SbVec3f;
00031 class SbViewVolume;
00032 class SbViewportRegion;
00033 class SoPickedPoint;
00034 class SoPickedPointList;
00035
00036
00037 class COIN_DLL_API SoRayPickAction : public SoPickAction {
00038 typedef SoPickAction inherited;
00039
00040 SO_ACTION_HEADER(SoRayPickAction);
00041
00042 public:
00043 SoRayPickAction(const SbViewportRegion & viewportregion);
00044 virtual ~SoRayPickAction();
00045 static void initClass(void);
00046
00047 void setPoint(const SbVec2s & viewportPoint);
00048 void setNormalizedPoint(const SbVec2f & normpoint);
00049 void setRadius(const float radiusinpixels);
00050 void setRay(const SbVec3f & start, const SbVec3f & direction,
00051 float neardistance = -1.0,
00052 float fardistance = -1.0);
00053 void setPickAll(const SbBool flag);
00054 SbBool isPickAll(void) const;
00055 const SoPickedPointList & getPickedPointList(void) const;
00056 SoPickedPoint * getPickedPoint(const int index = 0) const;
00057
00058
00059 void computeWorldSpaceRay(void);
00060 SbBool hasWorldSpaceRay(void) const;
00061 void setObjectSpace(void);
00062 void setObjectSpace(const SbMatrix & matrix);
00063 SbBool intersect(const SbVec3f & v0, const SbVec3f & v1, const SbVec3f & v2,
00064 SbVec3f & intersection, SbVec3f & barycentric,
00065 SbBool & front) const;
00066 SbBool intersect(const SbVec3f & v0, const SbVec3f & v1,
00067 SbVec3f & intersection) const;
00068 SbBool intersect(const SbVec3f & point) const;
00069 SbBool intersect(const SbBox3f & box, const SbBool usefullviewvolume = TRUE);
00070 SbBool intersect(const SbBox3f & box, SbVec3f & intersection,
00071 const SbBool usefullviewvolume = TRUE);
00072 const SbViewVolume & getViewVolume(void);
00073 const SbLine & getLine(void);
00074 SbBool isBetweenPlanes(const SbVec3f & intersection) const;
00075 SoPickedPoint * addIntersection(const SbVec3f & objectspacepoint);
00076
00077 protected:
00078 virtual void beginTraversal(SoNode * node);
00079
00080 private:
00081 class SoRayPickActionP * pimpl;
00082 };
00083
00084 #endif // !COIN_SORAYPICKACTION_H