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

mlib::Plane< PLANE, P, V, L > Class Template Reference
[MLIB]

Declaration of a class plane, keeping a definition of an oriented plane in 3D.

The plane is defined by its (unit) normal vector and parameter 'd', which is the signed distance of the plane from the origin of the coordinate system. More...

#include <plane.H>

Inheritance diagram for mlib::Plane< PLANE, P, V, L >:

Inheritance graph
[legend]
Collaboration diagram for mlib::Plane< PLANE, P, V, L >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

double dist (const P &p) const
 Computes the distance from the given point to the nearest point on the plane.
intersect (const L &l) const
 Computes the intersection point of the given line and the plane.
Constructors
 Plane ()
 Default constructor. Creates a plane with a zero offset from the origin and default constructed vector.
 Plane (const V &n, double d)
 Constructor that creates a plane with the normal and offset set to the values passed as arguments.
 Plane (const P &p, const V &n)
 Constructor that creates a plane that passes through the point p and that has normal n.
 Plane (const P &p1, const P &p2, const P &p3)
 Constructor that creates a plane that contains the three points p1, p2 and p3.
 Plane (const P &, const V &, const V &)
 Constructor that creates a plane that contains the given piont and two given vectors.
 Plane (const P plg[], int n)
 Create plane from a polygon of vertices (n >=3).
 Plane (const P plg[], int n, const V &normal)
 The plane normal is given, just calculate the 'd' parameter from all polygon vertices.
Accessor Functions
V & normal ()
const V & normal () const
double & d ()
double d () const
Plane Property Queries
origin () const
bool is_valid () const
 Is the plane valid (i.e. does it have a unit length normal)?
Plane Comparison Functions
bool is_parallel (const PLANE &p) const
 Are the two planes parallel?
bool is_equal (const PLANE &p) const
 Are the two planes equivalent?
Overloaded Arithmetic Operators
PLANE operator- () const
 Negates the plane's normal vector and offset.
Projection Functions
project (const P &) const
 Projects the given point on to the plane.
project (const V &) const
 Projects the given vector on to the plane.
project (const L &) const
 Projects the given line on to the plane.

Protected Attributes

_normal
double _d

Related Functions

(Note that these are not member functions.)

plane_intersect (const P &pt, const V &D, const P &O, const V &N)
 Computes the intersection of the ray defined by point pt and vector D and the plane defined by point O and normal vector N.
double axis_ang (const P &p1, const P &p2, const P &axispt, const V &axis)

Detailed Description

template<class PLANE, class P, class V, class L>
class mlib::Plane< PLANE, P, V, L >

Declaration of a class plane, keeping a definition of an oriented plane in 3D.

The plane is defined by its (unit) normal vector and parameter 'd', which is the signed distance of the plane from the origin of the coordinate system.

For all points on the plane holds:

normal * point + d = 0

The plane parameters are accessed via public accessor methods 'normal' and 'd'.

If the plane is invalid (cannot be constructed), the plane normal is set to a null vector.

Definition at line 36 of file plane.H.


Constructor & Destructor Documentation

template<class PLANE, class P, class V, class L>
mlib::Plane< PLANE, P, V, L >::Plane  )  [inline]
 

Default constructor. Creates a plane with a zero offset from the origin and default constructed vector.

This most likely creates an invalid plane with a zero length vector.

Definition at line 53 of file plane.H.

template<class PLANE, class P, class V, class L>
mlib::Plane< PLANE, P, V, L >::Plane const V &  n,
double  d
[inline]
 

Constructor that creates a plane with the normal and offset set to the values passed as arguments.

Definition at line 58 of file plane.H.

template<class PLANE, class P, class V, class L>
mlib::Plane< PLANE, P, V, L >::Plane const P &  p,
const V &  n
[inline]
 

Constructor that creates a plane that passes through the point p and that has normal n.

Definition at line 62 of file plane.H.

template<class PLANE, class P, class V, class L>
mlib::Plane< PLANE, P, V, L >::Plane const P &  p1,
const P &  p2,
const P &  p3
[inline]
 

Constructor that creates a plane that contains the three points p1, p2 and p3.

Definition at line 66 of file plane.H.

template<class PLANE, class P, class V, class L>
MLIB_INLINE mlib::Plane< PLANE, P, V, L >::Plane const P &  ,
const V &  ,
const V & 
 

Constructor that creates a plane that contains the given piont and two given vectors.

Definition at line 15 of file plane.C.

References mlib::cross().

template<class PLANE, class P, class V, class L>
MLIB_INLINE mlib::Plane< PLANE, P, V, L >::Plane const P  plg[],
int  n
 

Create plane from a polygon of vertices (n >=3).

All polygon vertices are used to calculate the plane coefficients to make the formula symetrical.

Definition at line 28 of file plane.C.

References mlib::Plane< PLANE, P, V, L >::_d, mlib::Plane< PLANE, P, V, L >::_normal, mlib::Plane< PLANE, P, V, L >::d(), and mlib::gEpsZeroMath.

template<class PLANE, class P, class V, class L>
MLIB_INLINE mlib::Plane< PLANE, P, V, L >::Plane const P  plg[],
int  n,
const V &  normal
 

The plane normal is given, just calculate the 'd' parameter from all polygon vertices.

Definition at line 92 of file plane.C.

References mlib::Plane< PLANE, P, V, L >::_d, and mlib::Plane< PLANE, P, V, L >::_normal.


Member Function Documentation

template<class PLANE, class P, class V, class L>
double mlib::Plane< PLANE, P, V, L >::d  )  const [inline]
 

Definition at line 89 of file plane.H.

template<class PLANE, class P, class V, class L>
double& mlib::Plane< PLANE, P, V, L >::d  )  [inline]
 

Definition at line 88 of file plane.H.

Referenced by operator>>(), and mlib::Plane< PLANE, P, V, L >::Plane().

template<class PLANE, class P, class V, class L>
double mlib::Plane< PLANE, P, V, L >::dist const P &  p  )  const [inline]
 

Computes the distance from the given point to the nearest point on the plane.

Definition at line 139 of file plane.H.

Referenced by mlib::Wpt_list::get_plane(), and mlib::Plane< PLANE, P, V, L >::project().

template<class PLANE, class P, class V, class L>
P mlib::Plane< PLANE, P, V, L >::intersect const L &  l  )  const [inline]
 

Computes the intersection point of the given line and the plane.

Definition at line 142 of file plane.H.

Referenced by Bface::plane_intersect(), and Cam_int::up().

template<class PLANE, class P, class V, class L>
bool mlib::Plane< PLANE, P, V, L >::is_equal const PLANE &  p  )  const [inline]
 

Are the two planes equivalent?

Definition at line 112 of file plane.H.

template<class PLANE, class P, class V, class L>
bool mlib::Plane< PLANE, P, V, L >::is_parallel const PLANE &  p  )  const [inline]
 

Are the two planes parallel?

Definition at line 108 of file plane.H.

template<class PLANE, class P, class V, class L>
bool mlib::Plane< PLANE, P, V, L >::is_valid  )  const [inline]
 

Is the plane valid (i.e. does it have a unit length normal)?

Definition at line 99 of file plane.H.

Referenced by mlib::Wpt_list::is_planar().

template<class PLANE, class P, class V, class L>
const V& mlib::Plane< PLANE, P, V, L >::normal  )  const [inline]
 

Definition at line 86 of file plane.H.

template<class PLANE, class P, class V, class L>
V& mlib::Plane< PLANE, P, V, L >::normal  )  [inline]
 

Definition at line 85 of file plane.H.

Referenced by mlib::Wpt_list::get_plane_normal(), and operator>>().

template<class PLANE, class P, class V, class L>
PLANE mlib::Plane< PLANE, P, V, L >::operator-  )  const [inline]
 

Negates the plane's normal vector and offset.

Definition at line 121 of file plane.H.

template<class PLANE, class P, class V, class L>
P mlib::Plane< PLANE, P, V, L >::origin  )  const [inline]
 

Definition at line 96 of file plane.H.

Referenced by mlib::Plane< Wplane, Wpt, Wvec, Wline >::intersect().

template<class PLANE, class P, class V, class L>
MLIB_INLINE L mlib::Plane< PLANE, P, V, L >::project const L &   )  const
 

Projects the given line on to the plane.

Definition at line 131 of file plane.C.

References mlib::Plane< PLANE, P, V, L >::project().

template<class PLANE, class P, class V, class L>
MLIB_INLINE V mlib::Plane< PLANE, P, V, L >::project const V &   )  const
 

Projects the given vector on to the plane.

Definition at line 121 of file plane.C.

References mlib::Plane< PLANE, P, V, L >::_normal.

template<class PLANE, class P, class V, class L>
MLIB_INLINE P mlib::Plane< PLANE, P, V, L >::project const P &   )  const
 

Projects the given point on to the plane.

Definition at line 111 of file plane.C.

References mlib::Plane< PLANE, P, V, L >::_normal, and mlib::Plane< PLANE, P, V, L >::dist().

Referenced by mlib::Plane< PLANE, P, V, L >::project().


Friends And Related Function Documentation

template<class PLANE, class P, class V, class L>
double axis_ang const P &  p1,
const P &  p2,
const P &  axispt,
const V &  axis
[related]
 

Definition at line 172 of file plane.H.

References mlib::Acos(), and mlib::cross().

template<class PLANE, class P, class V, class L>
P plane_intersect const P &  pt,
const V &  D,
const P &  O,
const V &  N
[related]
 

Computes the intersection of the ray defined by point pt and vector D and the plane defined by point O and normal vector N.

Definition at line 157 of file plane.H.

Referenced by mlib::Plane< Wplane, Wpt, Wvec, Wline >::intersect().


Member Data Documentation

template<class PLANE, class P, class V, class L>
double mlib::Plane< PLANE, P, V, L >::_d [protected]
 

Definition at line 42 of file plane.H.

Referenced by mlib::Plane< Wplane, Wpt, Wvec, Wline >::d(), mlib::Plane< Wplane, Wpt, Wvec, Wline >::dist(), mlib::Plane< Wplane, Wpt, Wvec, Wline >::is_equal(), mlib::Plane< Wplane, Wpt, Wvec, Wline >::operator-(), mlib::Plane< Wplane, Wpt, Wvec, Wline >::origin(), and mlib::Plane< PLANE, P, V, L >::Plane().

template<class PLANE, class P, class V, class L>
V mlib::Plane< PLANE, P, V, L >::_normal [protected]
 

Definition at line 41 of file plane.H.

Referenced by mlib::Plane< Wplane, Wpt, Wvec, Wline >::dist(), mlib::Plane< Wplane, Wpt, Wvec, Wline >::intersect(), mlib::Plane< Wplane, Wpt, Wvec, Wline >::is_equal(), mlib::Plane< Wplane, Wpt, Wvec, Wline >::is_parallel(), mlib::Plane< Wplane, Wpt, Wvec, Wline >::is_valid(), mlib::Plane< Wplane, Wpt, Wvec, Wline >::normal(), mlib::Plane< Wplane, Wpt, Wvec, Wline >::operator-(), mlib::Plane< Wplane, Wpt, Wvec, Wline >::origin(), mlib::Plane< PLANE, P, V, L >::Plane(), and mlib::Plane< PLANE, P, V, L >::project().


The documentation for this class was generated from the following files:
Generated on Mon Sep 18 11:48:10 2006 for jot by  doxygen 1.4.4