Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

osg::Plane Class Reference

Oriented plane in 3D space defined by normal and distance. More...

#include <OSGPlane.h>

Collaboration diagram for osg::Plane:

Collaboration graph
[legend]
List of all members.

Public Methods

Constructor
 Plane (void)
 Default Constructor.

 Plane (const Plane &obj)
 Copy Constructor.

 Plane (const Pnt3f &p0, const Pnt3f &p1, const Pnt3f &p2)
 Construct a plane given 3 points.

 Plane (const Vec3f &n, Real32 d)
 Construct a plane given normal and distance from origin along normal.

 Plane (const Vec3f &n, const Pnt3f &p)
 Construct a plane given normal and a point to pass through Orientation is given by the normal vector n.

Offset
void offset (Real32 d)
 Offset a plane by a given distance.

Intersection
bool intersect (const Plane &pl, Line &intersection) const
 Intersect plane and plane, returning true if there is an intersection false if planes are parallel taken from Steve Baker's SG library, used with permission.

bool intersect (const Line &l, Pnt3f &intersection) const
 Intersect line and plane, returning true if there is an intersection in the positive part of the line false if line is parallel to plane.

bool intersect (const Line &l, Real32 &t) const
 Intersect line and plane, returning true if there is an intersection false if line is parallel to plane.

bool intersectInfinite (const Line &l, Real32 &t) const
 Intersect line and plane, returning true if there is an intersection false if line is parallel to plane.

bool intersectInfinite (const Line &l, Pnt3f &intersection) const
 Intersect line and plane, returning true if there is an intersection false if line is parallel to plane.

void transform (const Matrix &matrix)
 Transforms the plane by the given matrix.

bool isInHalfSpace (const Pnt3f &point) const
bool isOnPlane (const Pnt3f &point) const
 Returns true if the given point is on the plane.

Real32 distance (const Pnt3f &point) const
Set Values
void set (const Vec3f &normal, Real32 distance)
void set (Real32 x, Real32 y, Real32 z, Real32 distance)
void set (const Vec4f &plane)
Access
const Vec3fgetNormal (void) const
Real32 getDistanceFromOrigin (void) const

Private Attributes

Vec3f _normalVec
Real32 _distance

Friends

Comparison
OSG_BASE_DLLMAPPING friend
bool 
operator== (const Plane &p1, const Plane &p2)
 Equality comparison operators.

OSG_BASE_DLLMAPPING friend
bool 
operator!= (const Plane &p1, const Plane &p2)

Detailed Description

Oriented plane in 3D space defined by normal and distance.

The plane is defined by a plane normal and a distance from the origin along that normal Planes may be used to represent either planes or half-spaces. In the latter case (as for the isInHalfSpace() method), the half-space is defined to be all points on the plane or on the side of the plane in the direction of the plane normal.

The 4 coefficients of the plane equation of an Plane can be obtained easily as the 3 coordinates of the plane normal and the distance, in that order. The normal is normalized.

node: Plane is all p such that normalVec . p - distance = 0

Author:
jbehr, dorfmuel, Mon Dec 22 11:32:31 1997


Constructor & Destructor Documentation

Plane::Plane void   
 

Default Constructor.

Plane::Plane const Plane &    obj
 

Copy Constructor.

Plane::Plane const Pnt3f   p0,
const Pnt3f   p1,
const Pnt3f   p2
 

Construct a plane given 3 points.

Orientation is computed by taking (p1 - p0) x (p2 - p0) and pointing the normal in that direction.

Plane::Plane const Vec3f   normal,
Real32    distance
 

Construct a plane given normal and distance from origin along normal.

Orientation is given by the normal vector n.

Plane::Plane const Vec3f   normal,
const Pnt3f   point
 

Construct a plane given normal and a point to pass through Orientation is given by the normal vector n.


Member Function Documentation

void Plane::offset Real32    d
 

Offset a plane by a given distance.

bool Plane::intersect const Plane &    pl,
Line   is
const
 

Intersect plane and plane, returning true if there is an intersection false if planes are parallel taken from Steve Baker's SG library, used with permission.

Algorithm explanation can be found at http://geometryalgorithms.com/Archive/algorithm_0104/algorithm_0104.htm

bool Plane::intersect const Line   line,
Pnt3f   point
const
 

Intersect line and plane, returning true if there is an intersection in the positive part of the line false if line is parallel to plane.

bool Plane::intersect const Line   line,
Real32   t
const
 

Intersect line and plane, returning true if there is an intersection false if line is parallel to plane.

t is the distance along the line.

bool Plane::intersectInfinite const Line   line,
Real32   t
const
 

Intersect line and plane, returning true if there is an intersection false if line is parallel to plane.

t is the distance along the line, which may be negative, i.e. the check is against a double infinite line.

bool Plane::intersectInfinite const Line   line,
Pnt3f   point
const
 

Intersect line and plane, returning true if there is an intersection false if line is parallel to plane.

void Plane::transform const Matrix   matrix
 

Transforms the plane by the given matrix.

bool Plane::isInHalfSpace const Pnt3f   point const
 

Returns true if the given point is within the half-space defined by the plane

bool Plane::isOnPlane const Pnt3f   point const
 

Returns true if the given point is on the plane.

Real32 osg::Plane::distance const Pnt3f   pnt const [inline]
 

Get the distance of the point from the plane.

void osg::Plane::set const Vec3f   normal,
Real32    distance
[inline]
 

Set the plane given the normal and distance. The normal needs to be normalized!

void osg::Plane::set Real32    x,
Real32    y,
Real32    z,
Real32    distance
[inline]
 

Set the plane given the (x,y,z) normal and distance The normal needs to be normalized!

void osg::Plane::set const Vec4f   plane [inline]
 

Set the plane given the (x,y,z) normal and distance in a Vec4f The normal needs to be normalized!

const Vec3f & osg::Plane::getNormal void    const [inline]
 

Get the normal vector.

Real32 osg::Plane::getDistanceFromOrigin void    const [inline]
 

Get the distance from the origin.


Friends And Related Function Documentation

OSG_BASE_DLLMAPPING friend bool operator== const Plane &    p1,
const Plane &    p2
[friend]
 

Equality comparison operators.

OSG_BASE_DLLMAPPING friend bool operator!= const Plane &    p1,
const Plane &    p2
[friend]
 

!= operator, based on ==.


Member Data Documentation

Vec3f osg::Plane::_normalVec [private]
 

Real32 osg::Plane::_distance [private]
 


The documentation for this class was generated from the following files:
Generated on Wed Jul 3 16:23:53 2002 for OpenSG by doxygen1.2.16