OSG  3.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Protected Attributes | List of all members
osg::Plane Class Reference

A plane class. It can be used to represent an infinite plane. More...

#include <Plane.h>

Inheritance diagram for osg::Plane:
Inheritance graph
[legend]

Public Types

enum  { num_components = 3 }
 
typedef double value_type
 
typedef Vec3d Vec3_type
 
typedef Vec4d Vec4_type
 

Public Member Functions

 Plane ()
 Default constructor. More...
 
 Plane (const Plane &pl)
 
 Plane (value_type a, value_type b, value_type c, value_type d)
 Constructor. More...
 
 Plane (const Vec4f &vec)
 Constructor. More...
 
 Plane (const Vec4d &vec)
 Constructor. More...
 
 Plane (const Vec3_type &norm, value_type d)
 Constructor. More...
 
 Plane (const Vec3_type &v1, const Vec3_type &v2, const Vec3_type &v3)
 Constructor. More...
 
 Plane (const Vec3_type &norm, const Vec3_type &point)
 Constructor. More...
 
Planeoperator= (const Plane &pl)
 
void set (const Plane &pl)
 
void set (value_type a, value_type b, value_type c, value_type d)
 
void set (const Vec4f &vec)
 
void set (const Vec4d &vec)
 
void set (const Vec3_type &norm, double d)
 
void set (const Vec3_type &v1, const Vec3_type &v2, const Vec3_type &v3)
 
void set (const Vec3_type &norm, const Vec3_type &point)
 
void flip ()
 
void makeUnitLength ()
 
void calculateUpperLowerBBCorners ()
 
bool valid () const
 Checks if all internal values describing the plane have valid numbers. More...
 
bool isNaN () const
 
bool operator== (const Plane &plane) const
 
bool operator!= (const Plane &plane) const
 
bool operator< (const Plane &plane) const
 
value_typeptr ()
 
const value_typeptr () const
 
Vec4_type asVec4 () const
 
value_typeoperator[] (unsigned int i)
 
value_type operator[] (unsigned int i) const
 
Vec3_type getNormal () const
 
float distance (const osg::Vec3f &v) const
 
double distance (const osg::Vec3d &v) const
 
float dotProductNormal (const osg::Vec3f &v) const
 
double dotProductNormal (const osg::Vec3d &v) const
 
int intersect (const std::vector< Vec3f > &vertices) const
 
int intersect (const std::vector< Vec3d > &vertices) const
 
int intersect (const BoundingSphere &bs) const
 
int intersect (const BoundingBox &bb) const
 
void transform (const osg::Matrix &matrix)
 
void transformProvidingInverse (const osg::Matrix &matrix)
 

Protected Attributes

value_type _fv [4]
 
unsigned int _upperBBCorner
 
unsigned int _lowerBBCorner
 

Detailed Description

A plane class. It can be used to represent an infinite plane.

The infinite plane is described by an implicit plane equation a*x+b*y+c*z+d = 0. Though it is not mandatory that a^2+b^2+c^2 = 1 is fulfilled in general some methods require it (

See also
osg::Plane::distance).

Definition at line 33 of file Plane.h.

Member Typedef Documentation

typedef double osg::Plane::value_type

Type of Plane class.

Definition at line 45 of file Plane.h.

Definition at line 46 of file Plane.h.

Definition at line 47 of file Plane.h.

Member Enumeration Documentation

anonymous enum

Number of vector components.

Enumerator
num_components 

Definition at line 51 of file Plane.h.

Constructor & Destructor Documentation

osg::Plane::Plane ( )
inline

Default constructor.

The default constructor initializes all values to zero.

Warning
Although the method osg::Plane::valid() will return true after the default constructors call the plane is mathematically invalid! Default data do not describe a valid plane.

Definition at line 58 of file Plane.h.

osg::Plane::Plane ( const Plane pl)
inline

Definition at line 59 of file Plane.h.

osg::Plane::Plane ( value_type  a,
value_type  b,
value_type  c,
value_type  d 
)
inline

Constructor.

The plane is described as a*x+b*y+c*z+d = 0.

Remarks
You may call osg::Plane::MakeUnitLength afterwards if the passed values are not normalized.

Definition at line 63 of file Plane.h.

osg::Plane::Plane ( const Vec4f vec)
inline

Constructor.

The plane can also be described as vec*[x,y,z,1].

Remarks
You may call osg::Plane::MakeUnitLength afterwards if the passed values are not normalized.

Definition at line 68 of file Plane.h.

osg::Plane::Plane ( const Vec4d vec)
inline

Constructor.

The plane can also be described as vec*[x,y,z,1].

Remarks
You may call osg::Plane::MakeUnitLength afterwards if the passed values are not normalized.

Definition at line 72 of file Plane.h.

osg::Plane::Plane ( const Vec3_type norm,
value_type  d 
)
inline

Constructor.

This constructor initializes the internal values directly without any checking or manipulation.

Parameters
normThe normal of the plane.
dThe negative distance from the point of origin to the plane.
Remarks
You may call osg::Plane::MakeUnitLength afterwards if the passed normal was not normalized.

Definition at line 79 of file Plane.h.

osg::Plane::Plane ( const Vec3_type v1,
const Vec3_type v2,
const Vec3_type v3 
)
inline

Constructor.

This constructor calculates from the three points describing an infinite plane the internal values.

Parameters
v1Point in the plane.
v2Point in the plane.
v3Point in the plane.
Remarks
After this constructor call the plane's normal is normalized in case the three points described a mathematically valid plane.
The normal is determined by building the cross product of (v2-v1) ^ (v3-v2).

Definition at line 89 of file Plane.h.

osg::Plane::Plane ( const Vec3_type norm,
const Vec3_type point 
)
inline

Constructor.

This constructor initializes the internal values directly without any checking or manipulation.

Parameters
normThe normal of the plane.
pointA point of the plane.
Remarks
You may call osg::Plane::MakeUnitLength afterwards if the passed normal was not normalized.

Definition at line 96 of file Plane.h.

Member Function Documentation

Vec4_type osg::Plane::asVec4 ( ) const
inline

Definition at line 189 of file Plane.h.

void osg::Plane::calculateUpperLowerBBCorners ( )
inline

calculate the upper and lower bounding box corners to be used in the intersect(BoundingBox&) method for speeding calculations.

Definition at line 151 of file Plane.h.

float osg::Plane::distance ( const osg::Vec3f v) const
inline

Calculate the distance between a point and the plane.

Remarks
This method only leads to real distance values if the plane's norm is 1.
See also
osg::Plane::makeUnitLength

Definition at line 200 of file Plane.h.

Here is the call graph for this function:

double osg::Plane::distance ( const osg::Vec3d v) const
inline

Calculate the distance between a point and the plane.

Remarks
This method only leads to real distance values if the plane's norm is 1.
See also
osg::Plane::makeUnitLength

Definition at line 210 of file Plane.h.

Here is the call graph for this function:

float osg::Plane::dotProductNormal ( const osg::Vec3f v) const
inline

calculate the dot product of the plane normal and a point.

Definition at line 219 of file Plane.h.

Here is the call graph for this function:

double osg::Plane::dotProductNormal ( const osg::Vec3d v) const
inline

calculate the dot product of the plane normal and a point.

Definition at line 227 of file Plane.h.

Here is the call graph for this function:

void osg::Plane::flip ( )
inline

flip/reverse the orientation of the plane.

Definition at line 129 of file Plane.h.

Vec3_type osg::Plane::getNormal ( ) const
inline

Definition at line 195 of file Plane.h.

int osg::Plane::intersect ( const std::vector< Vec3f > &  vertices) const
inline

intersection test between plane and vertex list return 1 if the bs is completely above plane, return 0 if the bs intersects the plane, return -1 if the bs is completely below the plane.

Definition at line 238 of file Plane.h.

int osg::Plane::intersect ( const std::vector< Vec3d > &  vertices) const
inline

intersection test between plane and vertex list return 1 if the bs is completely above plane, return 0 if the bs intersects the plane, return -1 if the bs is completely below the plane.

Definition at line 267 of file Plane.h.

int osg::Plane::intersect ( const BoundingSphere bs) const
inline

intersection test between plane and bounding sphere. return 1 if the bs is completely above plane, return 0 if the bs intersects the plane, return -1 if the bs is completely below the plane.

Definition at line 296 of file Plane.h.

Here is the call graph for this function:

int osg::Plane::intersect ( const BoundingBox bb) const
inline

intersection test between plane and bounding sphere. return 1 if the bs is completely above plane, return 0 if the bs intersects the plane, return -1 if the bs is completely below the plane.

Definition at line 310 of file Plane.h.

Here is the call graph for this function:

bool osg::Plane::isNaN ( ) const
inline

Definition at line 166 of file Plane.h.

Here is the call graph for this function:

void osg::Plane::makeUnitLength ( )
inline

This method multiplies the coefficients of the plane equation with a constant factor so that the equation a^2+b^2+c^2 = 1 holds.

Definition at line 140 of file Plane.h.

bool osg::Plane::operator!= ( const Plane plane) const
inline

Definition at line 170 of file Plane.h.

bool osg::Plane::operator< ( const Plane plane) const
inline

A plane is said to be smaller than another plane if the first non-identical element of the internal array is smaller than the corresponding element of the other plane.

Definition at line 174 of file Plane.h.

Plane& osg::Plane::operator= ( const Plane pl)
inline

Definition at line 98 of file Plane.h.

bool osg::Plane::operator== ( const Plane plane) const
inline

Definition at line 168 of file Plane.h.

value_type& osg::Plane::operator[] ( unsigned int  i)
inline

Definition at line 191 of file Plane.h.

value_type osg::Plane::operator[] ( unsigned int  i) const
inline

Definition at line 192 of file Plane.h.

value_type* osg::Plane::ptr ( )
inline

Definition at line 186 of file Plane.h.

const value_type* osg::Plane::ptr ( ) const
inline

Definition at line 187 of file Plane.h.

void osg::Plane::set ( const Plane pl)
inline

Definition at line 105 of file Plane.h.

Here is the caller graph for this function:

void osg::Plane::set ( value_type  a,
value_type  b,
value_type  c,
value_type  d 
)
inline

Definition at line 106 of file Plane.h.

void osg::Plane::set ( const Vec4f vec)
inline

Definition at line 108 of file Plane.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void osg::Plane::set ( const Vec4d vec)
inline

Definition at line 109 of file Plane.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void osg::Plane::set ( const Vec3_type norm,
double  d 
)
inline

Definition at line 111 of file Plane.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void osg::Plane::set ( const Vec3_type v1,
const Vec3_type v2,
const Vec3_type v3 
)
inline

Definition at line 113 of file Plane.h.

Here is the call graph for this function:

void osg::Plane::set ( const Vec3_type norm,
const Vec3_type point 
)
inline

Definition at line 122 of file Plane.h.

void osg::Plane::transform ( const osg::Matrix matrix)
inline

Transform the plane by matrix. Note, this operation carries out the calculation of the inverse of the matrix since a plane must be multiplied by the inverse transposed to transform it. This make this operation expensive. If the inverse has been already calculated elsewhere then use transformProvidingInverse() instead. See http://www.worldserver.com/turk/computergraphics/NormalTransformations.pdf

Definition at line 330 of file Plane.h.

Here is the call graph for this function:

void osg::Plane::transformProvidingInverse ( const osg::Matrix matrix)
inline

Transform the plane by providing a pre inverted matrix. see transform for details.

Definition at line 339 of file Plane.h.

bool osg::Plane::valid ( ) const
inline

Checks if all internal values describing the plane have valid numbers.

Warning
This method does not check if the plane is mathematically correctly described!
Remarks
The only case where all elements have valid numbers and the plane description is invalid occurs if the plane's normal is zero.

Definition at line 165 of file Plane.h.

Here is the call graph for this function:

Member Data Documentation

value_type osg::Plane::_fv[4]
protected

Vec member variable.

Definition at line 351 of file Plane.h.

unsigned int osg::Plane::_lowerBBCorner
protected

Definition at line 355 of file Plane.h.

unsigned int osg::Plane::_upperBBCorner
protected

Definition at line 354 of file Plane.h.


The documentation for this class was generated from the following file: