proj home

Files   Classes   Functions   Hierarchy  

halfspaceD3indexedfull< PT, PD, INDX > Class Template Reference

Define a 3D half space with three ordered points. More...

#include <halfspaceD3indexedfull.h>

Inheritance diagram for halfspaceD3indexedfull< PT, PD, INDX >:
Collaboration diagram for halfspaceD3indexedfull< PT, PD, INDX >:

List of all members.

Public Member Functions

 halfspaceD3indexedfull (PT const *pts_, INDX i0_, INDX i1_, INDX i2_)
 Construct the plane with anticlockwise point ordering.
void normalcalculate ()
 Calculate the normal the ordered points.
boolc isInside (PT const &x) const
 Is the point inside the half space?
boolc isInsideOrOnBoundary (PT const &x) const
 Is the point on or inside the half space?
PD const distancefromhalfspace (PT const &w) const
 A measure of the distance from the plane to the point w without a square root.

Public Attributes

PT const * pts
PT normal
 Normal.
INDX i0
 Index to p0.
INDX i1
 Index to p1.
INDX i2
 Index to p2.


Detailed Description

template<typename PT, typename PD, typename INDX>
class halfspaceD3indexedfull< PT, PD, INDX >

Define a 3D half space with three ordered points.

The inside of the half space is on the anti clockwise side of the plane with the three points.

Definition at line 19 of file halfspaceD3indexedfull.h.


Constructor & Destructor Documentation

template<typename PT, typename PD, typename INDX>
halfspaceD3indexedfull< PT, PD, INDX >::halfspaceD3indexedfull ( PT const *  pts_,
INDX  i0_,
INDX  i1_,
INDX  i2_ 
) [inline]

Construct the plane with anticlockwise point ordering.

The normal is outwards on the anticlockwise side of the plane.

Definition at line 39 of file halfspaceD3indexedfull.h.

References halfspaceD3indexedfull< PT, PD, INDX >::normalcalculate().

00045     : pts(pts_),
00046       i0(i0_), i1(i1_), i2(i2_)
00047     { normalcalculate(); }


Member Function Documentation

template<typename PT, typename PD, typename INDX>
PD const halfspaceD3indexedfull< PT, PD, INDX >::distancefromhalfspace ( PT const &  w  )  const [inline]

A measure of the distance from the plane to the point w without a square root.

ie N^2*d^2 where d is the vanilla distance function.

Definition at line 62 of file halfspaceD3indexedfull.h.

References halfspaceD3indexedfull< PT, PD, INDX >::i0, halfspaceD3indexedfull< PT, PD, INDX >::normal, and halfspaceD3indexedfull< PT, PD, INDX >::pts.

00063     { 
00064       PT p;
00065       p.x=normal.x*normal.x*(pts[i0].x-w.x);
00066       p.y=normal.y*normal.y*(pts[i0].y-w.y);
00067       p.z=normal.z*normal.z*(pts[i0].z-w.z);
00068       return p.x*p.x+p.y*p.y+p.z*p.z;
00069     }

template<typename PT, typename PD, typename INDX>
boolc halfspaceD3indexedfull< PT, PD, INDX >::isInside ( PT const &  x  )  const [inline, virtual]

Is the point inside the half space?

Implements partitionspace< PT >.

Definition at line 53 of file halfspaceD3indexedfull.h.

References halfspaceD3indexedfull< PT, PD, INDX >::i0, halfspaceD3indexedfull< PT, PD, INDX >::normal, and halfspaceD3indexedfull< PT, PD, INDX >::pts.

00054     { return 0 < normal.x*(x.x-pts[i0].x)+normal.y*(x.y-pts[i0].y)+normal.z*(x.z-pts[i0].z); }

template<typename PT, typename PD, typename INDX>
boolc halfspaceD3indexedfull< PT, PD, INDX >::isInsideOrOnBoundary ( PT const &  x  )  const [inline]

Is the point on or inside the half space?

Definition at line 56 of file halfspaceD3indexedfull.h.

References halfspaceD3indexedfull< PT, PD, INDX >::i0, halfspaceD3indexedfull< PT, PD, INDX >::normal, and halfspaceD3indexedfull< PT, PD, INDX >::pts.

00057     { return 0 < zero<PD>::val+normal.x*(x.x-pts[i0].x)+normal.y*(x.y-pts[i0].y)+normal.z*(x.z-pts[i0].z); }

template<typename PT , typename PD , typename INDX >
void halfspaceD3indexedfull< PT, PD, INDX >::normalcalculate (  )  [inline]

Calculate the normal the ordered points.

Definition at line 78 of file halfspaceD3indexedfull.h.

References halfspaceD3indexedfull< PT, PD, INDX >::i0, halfspaceD3indexedfull< PT, PD, INDX >::i1, halfspaceD3indexedfull< PT, PD, INDX >::i2, halfspaceD3indexedfull< PT, PD, INDX >::normal, and halfspaceD3indexedfull< PT, PD, INDX >::pts.

Referenced by halfspaceD3indexedfull< PT, PD, INDX >::halfspaceD3indexedfull().

00079 {
00080   PT u(pts[i2] - pts[i1]);
00081   PT v(pts[i0] - pts[i1]);
00082 
00083   normal.x=u.y*v.z-v.y*u.z;
00084   normal.y=u.z*v.x-u.x*v.z;
00085   normal.z=u.x*v.y-u.y*v.x;
00086 }


Member Data Documentation

template<typename PT, typename PD, typename INDX>
INDX halfspaceD3indexedfull< PT, PD, INDX >::i0

template<typename PT, typename PD, typename INDX>
INDX halfspaceD3indexedfull< PT, PD, INDX >::i1

Index to p1.

Definition at line 31 of file halfspaceD3indexedfull.h.

Referenced by halfspaceD3indexedfull< PT, PD, INDX >::normalcalculate().

template<typename PT, typename PD, typename INDX>
INDX halfspaceD3indexedfull< PT, PD, INDX >::i2

Index to p2.

Definition at line 33 of file halfspaceD3indexedfull.h.

Referenced by halfspaceD3indexedfull< PT, PD, INDX >::normalcalculate().

template<typename PT, typename PD, typename INDX>
PT halfspaceD3indexedfull< PT, PD, INDX >::normal

template<typename PT, typename PD, typename INDX>
PT const* halfspaceD3indexedfull< PT, PD, INDX >::pts


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

Generated on Fri Mar 4 00:50:02 2011 for Chelton Evans Source by  doxygen 1.5.8