Coin Logo http://www.sim.no/
http://www.coin3d.org/

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) by Kongsberg Oil & Gas Technologies.
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 Kongsberg Oil & Gas Technologies
00018  *  about acquiring a Coin Professional Edition License.
00019  *
00020  *  See http://www.coin3d.org/ for more information.
00021  *
00022  *  Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, NORWAY.
00023  *  http://www.sim.no/  sales@sim.no  coin-support@coin3d.org
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 class SoRayPickActionP;
00040 
00041 class COIN_DLL_API SoRayPickAction : public SoPickAction {
00042   typedef SoPickAction inherited;
00043 
00044   SO_ACTION_HEADER(SoRayPickAction);
00045 
00046 public:
00047   SoRayPickAction(const SbViewportRegion & viewportregion);
00048   virtual ~SoRayPickAction();
00049   static void initClass(void);
00050 
00051   void setPoint(const SbVec2s & viewportPoint);
00052   void setNormalizedPoint(const SbVec2f & normpoint);
00053   void setRadius(const float radiusinpixels);
00054   void setRay(const SbVec3f & start, const SbVec3f & direction,
00055               float neardistance = -1.0,
00056               float fardistance = -1.0);
00057   void setPickAll(const SbBool flag);
00058   SbBool isPickAll(void) const;
00059   const SoPickedPointList & getPickedPointList(void) const;
00060   SoPickedPoint * getPickedPoint(const int index = 0) const;
00061 
00062 
00063   void computeWorldSpaceRay(void);
00064   SbBool hasWorldSpaceRay(void) const;
00065   void setObjectSpace(void);
00066   void setObjectSpace(const SbMatrix & matrix);
00067   SbBool intersect(const SbVec3f & v0, const SbVec3f & v1, const SbVec3f & v2,
00068                    SbVec3f & intersection, SbVec3f & barycentric,
00069                    SbBool & front) const;
00070   SbBool intersect(const SbVec3f & v0, const SbVec3f & v1,
00071                    SbVec3f & intersection) const;
00072   SbBool intersect(const SbVec3f & point) const;
00073   SbBool intersect(const SbBox3f & box, const SbBool usefullviewvolume = TRUE);
00074   SbBool intersect(const SbBox3f & box, SbVec3f & intersection,
00075                    const SbBool usefullviewvolume = TRUE);
00076   const SbViewVolume & getViewVolume(void);
00077   const SbLine & getLine(void);
00078   SbBool isBetweenPlanes(const SbVec3f & intersection) const;
00079   SoPickedPoint * addIntersection(const SbVec3f & objectspacepoint, SbBool frontpick = TRUE);
00080 
00081   void reset(void);
00082 
00083 protected:
00084   virtual void beginTraversal(SoNode * node);
00085 
00086 private:
00087   SbPimplPtr<SoRayPickActionP> pimpl;
00088 
00089   // NOT IMPLEMENTED:
00090   SoRayPickAction(const SoRayPickAction & rhs);
00091   SoRayPickAction & operator = (const SoRayPickAction & rhs);
00092 }; // SoRayPickAction
00093 
00094 #endif // !COIN_SORAYPICKACTION_H

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

Generated on Fri Dec 11 2015 03:24:55 for Coin by Doxygen 1.7.6.1.