Coin: SoRayPickAction.h Source File

| Coin3D is Free Software, published under the BSD 3-clause license. | https://coin3d.github.io https://www.kongsberg.com/en/kogt/

SoRayPickAction.h
1#ifndef COIN_SORAYPICKACTION_H
2#define COIN_SORAYPICKACTION_H
3
4/**************************************************************************\
5 * Copyright (c) Kongsberg Oil & Gas Technologies AS
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are
10 * met:
11 *
12 * Redistributions of source code must retain the above copyright notice,
13 * this list of conditions and the following disclaimer.
14 *
15 * Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * Neither the name of the copyright holder nor the names of its
20 * contributors may be used to endorse or promote products derived from
21 * this software without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34\**************************************************************************/
35
36#include <Inventor/actions/SoPickAction.h>
37
38class SbBox3f;
39class SbLine;
40class SbMatrix;
41class SbVec2f;
42class SbVec2s;
43class SbVec3f;
44class SbViewVolume;
45class SbViewportRegion;
46class SoPickedPoint;
47class SoPickedPointList;
48class SoRayPickActionP;
49
50 class COIN_DLL_API SoRayPickAction : public SoPickAction {
51 typedef SoPickAction inherited;
52
53 SO_ACTION_HEADER(SoRayPickAction);
54
55public:
56 SoRayPickAction(const SbViewportRegion & viewportregion);
57 virtual ~SoRayPickAction();
58 static void initClass(void);
59
60 void setPoint(const SbVec2s & viewportPoint);
61 void setNormalizedPoint(const SbVec2f & normpoint);
62 void setRadius(const float radiusinpixels);
63 float getRadius(void) const;
64 void setRay(const SbVec3f & start, const SbVec3f & direction,
65 float neardistance = -1.0,
66 float fardistance = -1.0);
67 void setPickAll(const SbBool flag);
68 SbBool isPickAll(void) const;
69 const SoPickedPointList & getPickedPointList(void) const;
70 SoPickedPoint * getPickedPoint(const int index = 0) const;
71
72
73 void computeWorldSpaceRay(void);
74 SbBool hasWorldSpaceRay(void) const;
75 void setObjectSpace(void);
76 void setObjectSpace(const SbMatrix & matrix);
77 SbBool intersect(const SbVec3f & v0, const SbVec3f & v1, const SbVec3f & v2,
78 SbVec3f & intersection, SbVec3f & barycentric,
79 SbBool & front) const;
80 SbBool intersect(const SbVec3f & v0, const SbVec3f & v1,
81 SbVec3f & intersection) const;
82 SbBool intersect(const SbVec3f & point) const;
83 SbBool intersect(const SbBox3f & box, const SbBool usefullviewvolume = TRUE);
84 SbBool intersect(const SbBox3f & box, SbVec3f & intersection,
85 const SbBool usefullviewvolume = TRUE);
86 const SbViewVolume & getViewVolume(void);
87 const SbLine & getLine(void);
88 SbBool isBetweenPlanes(const SbVec3f & intersection) const;
89 SoPickedPoint * addIntersection(const SbVec3f & objectspacepoint, SbBool frontpick = TRUE);
90
91 void reset(void);
92
93protected:
94 virtual void beginTraversal(SoNode * node);
95
96private:
97 SbPimplPtr<SoRayPickActionP> pimpl;
98
99 // NOT IMPLEMENTED:
100 SoRayPickAction(const SoRayPickAction & rhs);
101 SoRayPickAction & operator = (const SoRayPickAction & rhs);
102}; // SoRayPickAction
103
104#endif // !COIN_SORAYPICKACTION_H
SbBox3f
The SbBox3f class is an abstraction for an axis aligned 3 dimensional box.
Definition SbBox3f.h:46
SbLine
The SbLine class represents a line in 3D space.
Definition SbLine.h:41
SbMatrix
The SbMatrix class is a 4x4 dimensional representation of a matrix.
Definition SbMatrix.h:47
SbPimplPtr
Definition SbPimplPtr.h:55
SbVec2f
The SbVec2f class is a 2 dimensional vector with floating point coordinates.
Definition SbVec2f.h:49
SbVec2s
The SbVec2s class is a 2 dimensional vector with short integer coordinates.
Definition SbVec2s.h:51
SbVec3f
The SbVec3f class is a 3 dimensional vector with floating point coordinates.
Definition SbVec3f.h:51
SbViewVolume
The SbViewVolume class is a viewing volume in 3D space.
Definition SbViewVolume.h:50
SbViewportRegion
The SbViewportRegion class is a viewport within a full window.
Definition SbViewportRegion.h:40
SoNode
The SoNode class is the base class for nodes used in scene graphs.
Definition SoNode.h:56
SoPickAction::beginTraversal
virtual void beginTraversal(SoNode *node)
Definition SoPickAction.cpp:136
SoPickAction::SoPickAction
SoPickAction(const SbViewportRegion &viewportregion)
Definition SoPickAction.cpp:101
SoPickAction::initClass
static void initClass(void)
Definition SoPickAction.cpp:86
SoPickedPointList
The SoPickedPointList class is a container for pointers to SoPickedPoint objects.
Definition SoPickedPointList.h:40
SoPickedPoint
The SoPickedPoint class is used for specifying picked points.
Definition SoPickedPoint.h:48
SoRayPickAction::intersect
SbBool intersect(const SbVec3f &v0, const SbVec3f &v1, const SbVec3f &v2, SbVec3f &intersection, SbVec3f &barycentric, SbBool &front) const
Definition SoRayPickAction.cpp:603
SoRayPickAction::isBetweenPlanes
SbBool isBetweenPlanes(const SbVec3f &intersection) const
Definition SoRayPickAction.cpp:996
SoRayPickAction::getLine
const SbLine & getLine(void)
Definition SoRayPickAction.cpp:987
SoRayPickAction::SoRayPickAction
SoRayPickAction(const SbViewportRegion &viewportregion)
Definition SoRayPickAction.cpp:263
SoRayPickAction::getPickedPointList
const SoPickedPointList & getPickedPointList(void) const
Definition SoRayPickAction.cpp:434
SoRayPickAction::getPickedPoint
SoPickedPoint * getPickedPoint(const int index=0) const
Definition SoRayPickAction.cpp:476
SoRayPickAction::isPickAll
SbBool isPickAll(void) const
Definition SoRayPickAction.cpp:425
SoRayPickAction::setRadius
void setRadius(const float radiusinpixels)
Definition SoRayPickAction.cpp:327
SoRayPickAction::setNormalizedPoint
void setNormalizedPoint(const SbVec2f &normpoint)
Definition SoRayPickAction.cpp:308
SoRayPickAction::setPoint
void setPoint(const SbVec2s &viewportPoint)
Definition SoRayPickAction.cpp:291
SoRayPickAction::setObjectSpace
void setObjectSpace(void)
Definition SoRayPickAction.cpp:580
SoRayPickAction::getViewVolume
const SbViewVolume & getViewVolume(void)
Definition SoRayPickAction.cpp:934
SoRayPickAction::setPickAll
void setPickAll(const SbBool flag)
Definition SoRayPickAction.cpp:412
SoRayPickAction::computeWorldSpaceRay
void computeWorldSpaceRay(void)
Definition SoRayPickAction.cpp:489
SoRayPickAction::addIntersection
SoPickedPoint * addIntersection(const SbVec3f &objectspacepoint, SbBool frontpick=TRUE)
Definition SoRayPickAction.cpp:1010
SoRayPickAction::setRay
void setRay(const SbVec3f &start, const SbVec3f &direction, float neardistance=-1.0, float fardistance=-1.0)
Definition SoRayPickAction.cpp:350
SoRayPickAction::getRadius
float getRadius(void) const
Definition SoRayPickAction.cpp:337
SoRayPickAction::hasWorldSpaceRay
SbBool hasWorldSpaceRay(void) const
Definition SoRayPickAction.cpp:571
SoRayPickAction::reset
void reset(void)
Definition SoRayPickAction.cpp:1045