OpenSceneGraph 3.6.5
PlaneIntersector
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_PLANEINTERSECTOR
15#define OSGUTIL_PLANEINTERSECTOR 1
16
18
20
21namespace osgUtil
22{
23
27{
28 public:
29
31 PlaneIntersector(const osg::Plane& plane, const osg::Polytope& boundingPolytope=osg::Polytope());
32
34 PlaneIntersector(CoordinateFrame cf, const osg::Plane& plane, const osg::Polytope& boundingPolytope=osg::Polytope());
35
37 {
39
40 bool operator < (const Intersection& rhs) const
41 {
42 if (polyline < rhs.polyline) return true;
43 if (rhs.polyline < polyline) return false;
44
45 if (nodePath < rhs.nodePath) return true;
46 if (rhs.nodePath < nodePath ) return false;
47
48 return (drawable < rhs.drawable);
49 }
50
51 typedef std::vector<osg::Vec3d> Polyline;
52 typedef std::vector<double> Attributes;
53
59
60 };
61
62 typedef std::vector<Intersection> Intersections;
63
64 inline void insertIntersection(const Intersection& intersection) { getIntersections().push_back(intersection); }
65
66 inline Intersections& getIntersections() { return _parent ? _parent->_intersections : _intersections; }
67
68
70
72
74
75 const osg::EllipsoidModel* getEllipsoidModel() const { return _em.get(); }
76
77 public:
78
80
81 virtual bool enter(const osg::Node& node);
82
83 virtual void leave();
84
86
87 virtual void reset();
88
89 virtual bool containsIntersections() { return !getIntersections().empty(); }
90
91 protected:
92
94
97
100
102
103};
104
105}
106
107#endif
108
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
EllipsoidModel encapsulates the ellipsoid used to model astronomical bodies, such as sun,...
Definition CoordinateSystemNode:31
Pure virtual base class for drawable geometry.
Definition Drawable:89
Base class for all internal nodes in the scene graph.
Definition Node:72
A plane class.
Definition Plane:34
A Polytope class for representing convex clipping volumes made up of a set of planes.
Definition Polytope:26
Smart pointer for handling referenced counted objects.
Definition ref_ptr:32
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
std::vector< Intersection > Intersections
Definition PlaneIntersector:62
PlaneIntersector(const osg::Plane &plane, const osg::Polytope &boundingPolytope=osg::Polytope())
Construct a PolytopeIntersector using speified polytope in MODEL coordinates.
bool getRecordHeightsAsAttributes() const
Definition PlaneIntersector:71
virtual bool containsIntersections()
Definition PlaneIntersector:89
const osg::EllipsoidModel * getEllipsoidModel() const
Definition PlaneIntersector:75
bool _recordHeightsAsAttributes
Definition PlaneIntersector:95
void insertIntersection(const Intersection &intersection)
Definition PlaneIntersector:64
osg::Plane _plane
Definition PlaneIntersector:98
virtual void intersect(osgUtil::IntersectionVisitor &iv, osg::Drawable *drawable)
PlaneIntersector(CoordinateFrame cf, const osg::Plane &plane, const osg::Polytope &boundingPolytope=osg::Polytope())
Construct a PolytopeIntersector using speified polytope in specified coordinate frame.
osg::ref_ptr< osg::EllipsoidModel > _em
Definition PlaneIntersector:96
virtual Intersector * clone(osgUtil::IntersectionVisitor &iv)
Intersections & getIntersections()
Definition PlaneIntersector:66
virtual bool enter(const osg::Node &node)
PlaneIntersector * _parent
Definition PlaneIntersector:93
Intersections _intersections
Definition PlaneIntersector:101
void setRecordHeightsAsAttributes(bool flag)
Definition PlaneIntersector:69
osg::Polytope _polytope
Definition PlaneIntersector:99
void setEllipsoidModel(osg::EllipsoidModel *em)
Definition PlaneIntersector:73
Definition PlaneIntersector:37
Intersection()
Definition PlaneIntersector:38
osg::NodePath nodePath
Definition PlaneIntersector:54
std::vector< osg::Vec3d > Polyline
Definition PlaneIntersector:51
Polyline polyline
Definition PlaneIntersector:57
std::vector< double > Attributes
Definition PlaneIntersector:52
Attributes attributes
Definition PlaneIntersector:58
osg::ref_ptr< osg::RefMatrix > matrix
Definition PlaneIntersector:55
osg::ref_ptr< osg::Drawable > drawable
Definition PlaneIntersector:56
#define OSGUTIL_EXPORT
Definition Export:40

osg logo
Generated at Wed Jul 23 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0.