Changeset 11450 for OpenSceneGraph/trunk/include/osg/Plane
- Timestamp:
- 05/20/10 19:02:45 (21 months ago)
- Files:
-
- 1 modified
-
OpenSceneGraph/trunk/include/osg/Plane (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/include/osg/Plane
r8477 r11450 27 27 namespace osg { 28 28 29 /** A plane class. It can be used to represent an infinite plane.*/ 29 /** @brief A plane class. It can be used to represent an infinite plane. 30 * 31 * The infinite plane is described by an implicit plane equation a*x+b*y+c*z+d = 0. Though it is not mandatory that 32 * a^2+b^2+c^2 = 1 is fulfilled in general some methods require it (@see osg::Plane::distance). */ 30 33 class OSG_EXPORT Plane 31 34 { … … 49 52 50 53 54 /// Default constructor 55 /** The default constructor initializes all values to zero. 56 * @warning Although the method osg::Plane::valid() will return true after the default constructors call the plane 57 * is mathematically invalid! Default data do not describe a valid plane. */ 51 58 inline Plane() { _fv[0]=0.0; _fv[1]=0.0; _fv[2]=0.0; _fv[3]=0.0; _lowerBBCorner = 0; _upperBBCorner = 0; } 52 59 inline Plane(const Plane& pl) { set(pl); } 60 /// Constructor 61 /** The plane is described as a*x+b*y+c*z+d = 0. 62 * @remark You may call osg::Plane::MakeUnitLength afterwards if the passed values are not normalized. */ 53 63 inline Plane(value_type a,value_type b,value_type c,value_type d) { set(a,b,c,d); } 54 64 65 /// Constructor 66 /** The plane can also be described as vec*[x,y,z,1]. 67 * @remark You may call osg::Plane::MakeUnitLength afterwards if the passed values are not normalized. */ 55 68 inline Plane(const Vec4f& vec) { set(vec); } 69 /// Constructor 70 /** The plane can also be described as vec*[x,y,z,1]. 71 * @remark You may call osg::Plane::MakeUnitLength afterwards if the passed values are not normalized. */ 56 72 inline Plane(const Vec4d& vec) { set(vec); } 57 73 74 /// Constructor 75 /** This constructor initializes the internal values directly without any checking or manipulation. 76 * @param norm The normal of the plane. 77 * @param d The negative distance from the point of origin to the plane. 78 * @remark You may call osg::Plane::MakeUnitLength afterwards if the passed normal was not normalized. */ 58 79 inline Plane(const Vec3_type& norm,value_type d) { set(norm,d); } 59 80 81 /// Constructor 82 /** This constructor calculates from the three points describing an infinite plane the internal values. 83 * @param v1 Point in the plane. 84 * @param v2 Point in the plane. 85 * @param v3 Point in the plane. 86 * @remark After this constructor call the plane's normal is normalized in case the three points described a mathematically 87 * valid plane. 88 * @remark The normal is determined by building the cross product of (v2-v1) ^ (v3-v2). */ 60 89 inline Plane(const Vec3_type& v1, const Vec3_type& v2, const Vec3_type& v3) { set(v1,v2,v3); } 61 90 91 /// Constructor 92 /** This constructor initializes the internal values directly without any checking or manipulation. 93 * @param norm The normal of the plane. 94 * @param point A point of the plane. 95 * @remark You may call osg::Plane::MakeUnitLength afterwards if the passed normal was not normalized. */ 62 96 inline Plane(const Vec3_type& norm, const Vec3_type& point) { set(norm,point); } 63 97 … … 102 136 } 103 137 104 138 /** This method multiplies the coefficients of the plane equation with a constant factor so that the 139 * equation a^2+b^2+c^2 = 1 holds. */ 105 140 inline void makeUnitLength() 106 141 { … … 124 159 } 125 160 161 /// Checks if all internal values describing the plane have valid numbers 162 /** @warning This method does not check if the plane is mathematically correctly described! 163 * @remark The only case where all elements have valid numbers and the plane description is invalid occurs if the plane's normal 164 * is zero. */ 126 165 inline bool valid() const { return !isNaN(); } 127 166 inline bool isNaN() const { return osg::isNaN(_fv[0]) || osg::isNaN(_fv[1]) || osg::isNaN(_fv[2]) || osg::isNaN(_fv[3]); } … … 131 170 inline bool operator != (const Plane& plane) const { return _fv[0]!=plane._fv[0] || _fv[1]!=plane._fv[1] || _fv[2]!=plane._fv[2] || _fv[3]!=plane._fv[3]; } 132 171 172 /** A plane is said to be smaller than another plane if the first non-identical element of the internal array is smaller than the 173 * corresponding element of the other plane. */ 133 174 inline bool operator < (const Plane& plane) const 134 175 { … … 154 195 inline Vec3_type getNormal() const { return Vec3_type(_fv[0],_fv[1],_fv[2]); } 155 196 156 /** calculate the distance between a point and the plane.*/ 197 /** Calculate the distance between a point and the plane. 198 * @remark This method only leads to real distance values if the plane's norm is 1. 199 * @sa osg::Plane::makeUnitLength */ 157 200 inline float distance(const osg::Vec3f& v) const 158 201 { … … 162 205 _fv[3]; 163 206 } 164 207 /** Calculate the distance between a point and the plane. 208 * @remark This method only leads to real distance values if the plane's norm is 1. 209 * @sa osg::Plane::makeUnitLength */ 165 210 inline double distance(const osg::Vec3d& v) const 166 211 {
