Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

# SoRayPickAction.h

    00001 #ifndef COIN_SORAYPICKACTION_H
    00002 #define COIN_SORAYPICKACTION_H
    00003
    00004 /**************************************************************************\
    00005  *
    00006  *  This file is part of the Coin 3D visualization library.
    00007  *  Copyright (C) 1998-2003 by Systems in Motion.  All rights reserved.
    00008  *
    00009  *  This library is free software; you can redistribute it and/or
    00010  *  modify it under the terms of the GNU General Public License
    00011  *  ("GPL") version 2 as published by the Free Software Foundation.
    00012  *  See the file LICENSE.GPL at the root directory of this source
    00013  *  distribution for additional information about the GNU GPL.
    00014  *
    00015  *  For using Coin with software that can not be combined with the GNU
    00016  *  GPL, and for taking advantage of the additional benefits of our
    00017  *  support services, please contact Systems in Motion about acquiring
    00018  *  a Coin Professional Edition License.
    00019  *
    00020  *  See <URL:http://www.coin3d.org> for  more information.
    00021  *
    00022  *  Systems in Motion, Teknobyen, Abels Gate 5, 7030 Trondheim, NORWAY.
    00023  *  <URL:http://www.sim.no>.
    00024  *
    00025 \**************************************************************************/
    00026
    00027 #include <Inventor/actions/SoPickAction.h>
    00028
    00029 class SbBox3f;
    00030 class SbLine;
    00031 class SbMatrix;
    00032 class SbVec2f;
    00033 class SbVec2s;
    00034 class SbVec3f;
    00035 class SbViewVolume;
    00036 class SbViewportRegion;
    00037 class SoPickedPoint;
    00038 class SoPickedPointList;
    00039
    00040 class COIN_DLL_API SoRayPickAction : public SoPickAction {
    00041   typedef SoPickAction inherited;
    00042
    00043   SO_ACTION_HEADER(SoRayPickAction);
    00044
    00045 public:
    00046   SoRayPickAction(const SbViewportRegion & viewportregion);
    00047   virtual ~SoRayPickAction();
    00048   static void initClass(void);
    00049
    00050   void setPoint(const SbVec2s & viewportPoint);
    00051   void setNormalizedPoint(const SbVec2f & normpoint);
    00052   void setRadius(const float radiusinpixels);
    00053   void setRay(const SbVec3f & start, const SbVec3f & direction,
    00054               float neardistance = -1.0,
    00055               float fardistance = -1.0);
    00056   void setPickAll(const SbBool flag);
    00057   SbBool isPickAll(void) const;
    00058   const SoPickedPointList & getPickedPointList(void) const;
    00059   SoPickedPoint * getPickedPoint(const int index = 0) const;
    00060
    00061
    00062   void computeWorldSpaceRay(void);
    00063   SbBool hasWorldSpaceRay(void) const;
    00064   void setObjectSpace(void);
    00065   void setObjectSpace(const SbMatrix & matrix);
    00066   SbBool intersect(const SbVec3f & v0, const SbVec3f & v1, const SbVec3f & v2,
    00067                    SbVec3f & intersection, SbVec3f & barycentric,
    00068                    SbBool & front) const;
    00069   SbBool intersect(const SbVec3f & v0, const SbVec3f & v1,
    00070                    SbVec3f & intersection) const;
    00071   SbBool intersect(const SbVec3f & point) const;
    00072   SbBool intersect(const SbBox3f & box, const SbBool usefullviewvolume = TRUE);
    00073   SbBool intersect(const SbBox3f & box, SbVec3f & intersection,
    00074                    const SbBool usefullviewvolume = TRUE);
    00075   const SbViewVolume & getViewVolume(void);
    00076   const SbLine & getLine(void);
    00077   SbBool isBetweenPlanes(const SbVec3f & intersection) const;
    00078   SoPickedPoint * addIntersection(const SbVec3f & objectspacepoint);
    00079
    00080 protected:
    00081   virtual void beginTraversal(SoNode * node);
    00082
    00083 private:
    00084   class SoRayPickActionP * pimpl;
    00085 };
    00086
    00087 #endif // !COIN_SORAYPICKACTION_H