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

NUM::Plane3< T > Class Template Reference

3dim plane class template for types flt and dbl. More...

#include <plane3.h>

Collaboration diagram for NUM::Plane3< T >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Plane3 ()
 Construct a plane with coefficients not set up:.

 Plane3 (const Vector3< T > &n, T d)
 ~Plane3 ()
 Destructor: A no-op.

Vector3< T > & normal ()
 Get (reference to) the plane normal vector; may be modified.

const Vector3< T > & normal () const
T & dist ()
 Get (reference to) the distance from origin; may be modified.

const T & dist () const
normalize ()
 Normalize the plane normal vector; returns previous length.

distance (const Vector3< T > &point)
int compute (const Vector3< T > &p0, const Vector3< T > &p1, const Vector3< T > &p2)
int PointFit (int args_not_specified)
 Fit a 3d plane to best fit a number of specified points.


Private Attributes

Vector3< T > _normal
 normal vector

_dist
 distance from origin


Detailed Description

template<typename T = dbl>
class NUM::Plane3< T >

3dim plane class template for types flt and dbl.

Author:
Wolfgang Wieser ] wwieser (a) gmx <*> de [
See also:
File vector.h for more information about speed.
Represents a plane in 3d using normal vector (normally normalized to length 1) and distance from origin (oriented against normal vector).

Plane equation:
normal[0]*x[0] + normal[1]*x[1] + normal[2]*x[2] + dist = 0

Distance from plane: DotProduct(normal,point) + dist.

This class is meant to be quite fast and hence does applies some optimizations like:

Definition at line 54 of file plane3.h.


Constructor & Destructor Documentation

template<typename T = dbl>
NUM::Plane3< T >::Plane3  )  [inline]
 

Construct a plane with coefficients not set up:.

Definition at line 62 of file plane3.h.

template<typename T = dbl>
NUM::Plane3< T >::Plane3 const Vector3< T > &  n,
d
[inline]
 

Construct a plane with specified normal and distance from origin (oriented against normal vector).

Definition at line 65 of file plane3.h.

References NUM::Plane3< T >::_dist, and NUM::Plane3< T >::_normal.

template<typename T = dbl>
NUM::Plane3< T >::~Plane3  )  [inline]
 

Destructor: A no-op.

Definition at line 67 of file plane3.h.


Member Function Documentation

template<typename T>
int NUM::Plane3< T >::compute const Vector3< T > &  p0,
const Vector3< T > &  p1,
const Vector3< T > &  p2
 

Compute a 3d plane which is specified by 3 points on the plane.

Returns:
0 -> OK
-2 -> all 3 points are on a straight line; failed to fit plane

Definition at line 39 of file plane3.cc.

References NUM::Plane3< T >::_dist, NUM::Plane3< T >::_normal, NUM::dot(), and NUM::len().

template<typename T = dbl>
const T& NUM::Plane3< T >::dist  )  const [inline]
 

Definition at line 75 of file plane3.h.

References NUM::Plane3< T >::_dist.

template<typename T = dbl>
T& NUM::Plane3< T >::dist  )  [inline]
 

Get (reference to) the distance from origin; may be modified.

Definition at line 74 of file plane3.h.

References NUM::Plane3< T >::_dist.

template<typename T = dbl>
T NUM::Plane3< T >::distance const Vector3< T > &  point  )  [inline]
 

Compute distance of point from plane: This assumes that the plane normal vector is normalized (length 1).

Definition at line 83 of file plane3.h.

References NUM::Plane3< T >::_dist, NUM::Plane3< T >::_normal, and NUM::dot().

template<typename T = dbl>
const Vector3<T>& NUM::Plane3< T >::normal  )  const [inline]
 

Definition at line 71 of file plane3.h.

References NUM::Plane3< T >::_normal.

template<typename T = dbl>
Vector3<T>& NUM::Plane3< T >::normal  )  [inline]
 

Get (reference to) the plane normal vector; may be modified.

Definition at line 70 of file plane3.h.

References NUM::Plane3< T >::_normal.

template<typename T = dbl>
T NUM::Plane3< T >::normalize  )  [inline]
 

Normalize the plane normal vector; returns previous length.

Todo:
also update dist?

Definition at line 78 of file plane3.h.

References NUM::Plane3< T >::_normal.

template<typename T = dbl>
int NUM::Plane3< T >::PointFit int  args_not_specified  ) 
 

Fit a 3d plane to best fit a number of specified points.

Not yet part of this implementation but code is ready:

If 3 points are specified, this will simply call compute().
For more than 3 points, fit plane using SVD to minimaze sum of squared point distances.

The plane is stored in *this and the array dist[] (if non-NULL) will be filled with the actual distance of the points from the plane (one entry for each point).

Returns:
0 -> OK
-2 -> cannot fit plane since all points are on a line.
-3 -> SVD bailed out (did not converge)


Member Data Documentation

template<typename T = dbl>
T NUM::Plane3< T >::_dist [private]
 

distance from origin

Definition at line 58 of file plane3.h.

Referenced by NUM::Plane3< T >::compute(), NUM::Plane3< T >::dist(), NUM::Plane3< T >::distance(), and NUM::Plane3< T >::Plane3().

template<typename T = dbl>
Vector3<T> NUM::Plane3< T >::_normal [private]
 

normal vector

Definition at line 57 of file plane3.h.

Referenced by NUM::Plane3< T >::compute(), NUM::Plane3< T >::distance(), NUM::Plane3< T >::normal(), NUM::Plane3< T >::normalize(), and NUM::Plane3< T >::Plane3().


The documentation for this class was generated from the following files:
Generated on Sat Feb 19 22:35:56 2005 for Ray by doxygen 1.3.5