OpenCOVER
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
coPlane.h
Go to the documentation of this file.
1 /* This file is part of COVISE.
2 
3  You can use it under the terms of the GNU Lesser General Public License
4  version 2.1 or later, see lgpl-2.1.txt.
5 
6  * License: LGPL 2+ */
7 
8 #ifndef CO_PLANE
9 #define CO_PLANE
10 
11 #include <osg/Vec3>
12 #include <util/coExport.h>
13 #include <osg/BoundingBox>
14 
15 namespace opencover
16 {
17 class PLUGIN_UTILEXPORT coPlane
18 {
19 
20 protected:
21  osg::Vec3 _normal;
22  osg::Vec3 _point;
23  float _d;
24 
25 public:
26  coPlane(osg::Vec3 normal, osg::Vec3 point);
27  virtual ~coPlane();
28 
29  // update plane normal an position
30  virtual void update(osg::Vec3 normal, osg::Vec3 point);
31 
32  // return current position
33  osg::Vec3 &getPosition()
34  {
35  return _point;
36  };
37 
38  // return current normal
39  osg::Vec3 &getNormal()
40  {
41  return _normal;
42  };
43 
44  // return distance point to plane
45  float getPointDistance(osg::Vec3 &point);
46 
47  osg::Vec3 getProjectedPoint(osg::Vec3 &point);
48 
49  // get the intersection point between an infinite line (Gerade)
50  // defined by lp1 and lp2 and the plane
51  // returns true, if an intersection point was found
52  // false if the line and plane are parallel
53  bool getLineIntersectionPoint(osg::Vec3 &lp1, osg::Vec3 &lp2, osg::Vec3 &isectPoint);
54 
55  // get the intersection point between a finite line (Linie)
56  // and the plane
57  // returns true if an intersection point is between lp1 and lp2
58  // returns false if the plane and line are parallel or the
59  // intersection point is not between lp1 and lp2
60  bool getLineSegmentIntersectionPoint(osg::Vec3 &lp1, osg::Vec3 &lp2, osg::Vec3 &isectPoint);
61 
62  // get the intersection between the lines of a bounding box and the plane
63  int getBoxIntersectionPoints(osg::BoundingBox &box, osg::Vec3 *isectPoints);
64 };
65 }
66 #endif
float _d
Definition: coPlane.h:23
osg::Vec3 & getPosition()
Definition: coPlane.h:33
Definition: coPlane.h:17
osg::Vec3 _point
Definition: coPlane.h:22
osg::Vec3 & getNormal()
Definition: coPlane.h:39
osg::Vec3 _normal
Definition: coPlane.h:21