OpenSceneGraph 3.6.5
LineSegmentIntersector
Go to the documentation of this file.
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2 *
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version. The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * OpenSceneGraph Public License for more details.
12*/
13
14#ifndef OSGUTIL_LINESEGMENTINTERSECTOR
15#define OSGUTIL_LINESEGMENTINTERSECTOR 1
16
18
19namespace osgUtil
20{
21
25{
26 public:
27
29 LineSegmentIntersector(const osg::Vec3d& start, const osg::Vec3d& end);
30
34
39 LineSegmentIntersector(CoordinateFrame cf, double x, double y);
40
73
74 typedef std::multiset<Intersection> Intersections;
75
76 inline void insertIntersection(const Intersection& intersection) { getIntersections().insert(intersection); }
77
78 inline Intersections& getIntersections() { return _parent ? _parent->_intersections : _intersections; }
79
80 inline Intersection getFirstIntersection() { Intersections& intersections = getIntersections(); return intersections.empty() ? Intersection() : *(intersections.begin()); }
81
82 inline void setStart(const osg::Vec3d& start) { _start = start; }
83 inline const osg::Vec3d& getStart() const { return _start; }
84
85 inline void setEnd(const osg::Vec3d& end) { _end = end; }
86 inline const osg::Vec3d& getEnd() const { return _end; }
87
88 public:
89
91
92 virtual bool enter(const osg::Node& node);
93
94 virtual void leave();
95
97
99 const osg::Vec3d& s, const osg::Vec3d& e);
100
101 virtual void reset();
102
103 virtual bool containsIntersections() { return !getIntersections().empty(); }
104
109
110protected:
111
114
116
119
121
122};
123
124}
125
126#endif
127
Vec3f Vec3
Definition Vec3:21
BoundingBoxd BoundingBox
Definition BoundingBox:257
BoundingSphered BoundingSphere
Definition BoundingSphere:308
Matrixd Matrix
Definition Matrix:27
std::vector< Node * > NodePath
A vector of Nodes pointers which is used to describe the path from a root node to a descendant.
Definition Node:47
The osgUtil library provides general purpose utility classes such as update, cull and draw traverses,...
Definition NodeVisitor:25
Pure virtual base class for drawable geometry.
Definition Drawable:89
static Vec3f transform3x3(const Vec3f &v, const Matrixd &m)
apply a 3x3 transform of v*M[0..2,0..2].
Definition Matrixd:665
static Matrixd inverse(const Matrixd &matrix)
Definition Matrixd:536
Base class for all internal nodes in the scene graph.
Definition Node:72
Smart pointer for handling referenced counted objects.
Definition ref_ptr:32
Texture pure virtual base class that encapsulates OpenGL texture functionality common to the various ...
Definition Texture:422
General purpose double triple for use as vertices, vectors and normals.
Definition Vec3d:30
IntersectionLimit
Definition IntersectionVisitor:46
@ NO_LIMIT
Definition IntersectionVisitor:47
CoordinateFrame
Definition IntersectionVisitor:38
Intersector(CoordinateFrame cf=MODEL, IntersectionLimit il=NO_LIMIT)
Definition IntersectionVisitor:53
IntersectionVisitor is used to testing for intersections with the scene, traversing the scene using g...
Definition IntersectionVisitor:152
Intersections _intersections
Definition LineSegmentIntersector:120
LineSegmentIntersector * _parent
Definition LineSegmentIntersector:115
std::multiset< Intersection > Intersections
Definition LineSegmentIntersector:74
const osg::Vec3d & getStart() const
Definition LineSegmentIntersector:83
void setStart(const osg::Vec3d &start)
Definition LineSegmentIntersector:82
virtual void intersect(osgUtil::IntersectionVisitor &iv, osg::Drawable *drawable)
LineSegmentIntersector(CoordinateFrame cf, const osg::Vec3d &start, const osg::Vec3d &end, LineSegmentIntersector *parent=NULL, osgUtil::Intersector::IntersectionLimit intersectionLimit=osgUtil::Intersector::NO_LIMIT)
Construct a LineSegmentIntersector that runs between the specified start and end points in the specif...
Intersection getFirstIntersection()
Definition LineSegmentIntersector:80
void insertIntersection(const Intersection &intersection)
Definition LineSegmentIntersector:76
bool intersects(const osg::BoundingSphere &bs)
virtual bool containsIntersections()
Definition LineSegmentIntersector:103
LineSegmentIntersector(CoordinateFrame cf, double x, double y)
Convenience constructor for supporting picking in WINDOW, or PROJECTION coordinates In WINDOW coordin...
virtual Intersector * clone(osgUtil::IntersectionVisitor &iv)
void setEnd(const osg::Vec3d &end)
Definition LineSegmentIntersector:85
osg::Vec3d _start
Definition LineSegmentIntersector:117
Intersections & getIntersections()
Definition LineSegmentIntersector:78
LineSegmentIntersector(const osg::Vec3d &start, const osg::Vec3d &end)
Construct a LineSegmentIntersector that runs between the specified start and end points in MODEL coor...
static osg::Matrix getTransformation(osgUtil::IntersectionVisitor &iv, CoordinateFrame cf)
Compute the matrix that transforms the local coordinate system of parent Intersector (usually the cur...
const osg::Vec3d & getEnd() const
Definition LineSegmentIntersector:86
virtual void intersect(osgUtil::IntersectionVisitor &iv, osg::Drawable *drawable, const osg::Vec3d &s, const osg::Vec3d &e)
virtual bool enter(const osg::Node &node)
bool intersectAndClip(osg::Vec3d &s, osg::Vec3d &e, const osg::BoundingBox &bb)
osg::Vec3d _end
Definition LineSegmentIntersector:118
Definition LineSegmentIntersector:42
osg::Texture * getTextureLookUp(osg::Vec3 &tc) const
Convenience function for mapping the intersection point to any textures assigned to the objects inter...
osg::Vec3 getWorldIntersectNormal() const
Definition LineSegmentIntersector:66
osg::ref_ptr< osg::RefMatrix > matrix
Definition LineSegmentIntersector:55
const osg::Vec3 & getLocalIntersectNormal() const
Definition LineSegmentIntersector:65
osg::Vec3d localIntersectionPoint
Definition LineSegmentIntersector:56
IndexList indexList
Definition LineSegmentIntersector:58
osg::Vec3d getWorldIntersectPoint() const
Definition LineSegmentIntersector:63
osg::ref_ptr< osg::Drawable > drawable
Definition LineSegmentIntersector:54
RatioList ratioList
Definition LineSegmentIntersector:59
unsigned int primitiveIndex
Definition LineSegmentIntersector:60
double ratio
Definition LineSegmentIntersector:52
osg::Vec3 localIntersectionNormal
Definition LineSegmentIntersector:57
const osg::Vec3d & getLocalIntersectPoint() const
Definition LineSegmentIntersector:62
Intersection()
Definition LineSegmentIntersector:43
std::vector< double > RatioList
Definition LineSegmentIntersector:50
std::vector< unsigned int > IndexList
Definition LineSegmentIntersector:49
osg::NodePath nodePath
Definition LineSegmentIntersector:53
#define NULL
Definition Export:55
#define OSGUTIL_EXPORT
Definition Export:40

osg logo
Generated at Sun Jul 20 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0.