Changeset 11450

Show
Ignore:
Timestamp:
05/20/10 19:02:45 (2 years ago)
Author:
robert
Message:

From Hartwig Wiesmann, "I have added some doxygen documentation to the plane class.
"

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/include/osg/Plane

    r8477 r11450  
    2727namespace osg { 
    2828 
    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). */ 
    3033class OSG_EXPORT Plane 
    3134{ 
     
    4952 
    5053 
     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. */ 
    5158        inline Plane() { _fv[0]=0.0; _fv[1]=0.0; _fv[2]=0.0; _fv[3]=0.0; _lowerBBCorner = 0; _upperBBCorner = 0; } 
    5259        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. */ 
    5363        inline Plane(value_type a,value_type b,value_type c,value_type d) { set(a,b,c,d); } 
    5464 
     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. */ 
    5568        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. */ 
    5672        inline Plane(const Vec4d& vec) { set(vec); } 
    5773 
     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. */ 
    5879        inline Plane(const Vec3_type& norm,value_type d) { set(norm,d); } 
    5980 
     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). */ 
    6089        inline Plane(const Vec3_type& v1, const Vec3_type& v2, const Vec3_type& v3) { set(v1,v2,v3); } 
    6190 
     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. */ 
    6296        inline Plane(const Vec3_type& norm, const Vec3_type& point) { set(norm,point); } 
    6397 
     
    102136        } 
    103137 
    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. */ 
    105140        inline void makeUnitLength() 
    106141        { 
     
    124159        } 
    125160 
     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. */ 
    126165        inline bool valid() const { return !isNaN(); } 
    127166        inline bool isNaN() const { return osg::isNaN(_fv[0]) || osg::isNaN(_fv[1]) || osg::isNaN(_fv[2]) || osg::isNaN(_fv[3]); } 
     
    131170        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]; } 
    132171 
     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. */ 
    133174        inline bool operator <  (const Plane& plane) const 
    134175        { 
     
    154195        inline Vec3_type getNormal() const { return Vec3_type(_fv[0],_fv[1],_fv[2]); } 
    155196       
    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 */ 
    157200        inline float distance(const osg::Vec3f& v) const 
    158201        { 
     
    162205                   _fv[3]; 
    163206        } 
    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 */ 
    165210        inline double distance(const osg::Vec3d& v) const 
    166211        {