proj home

Files   Classes   Functions   Hierarchy  

trianglepartition< T, D > Class Template Reference

Test if a point is within a triangle. More...

#include <trianglepartition.h>

Inheritance diagram for trianglepartition< T, D >:
Collaboration diagram for trianglepartition< T, D >:

List of all members.

Public Member Functions

 trianglepartition (T const &p0_, T const &p1_, T const &p2_)
 Anti clockwise point ordering.
 trianglepartition ()
 Unconstructed triangle.
void construct (T const &p0_, T const &p1_, T const &p2_)
 Construct this triangle from anti clockwise point ordering.
boolc isInside (T const &a) const
 Is the point inside the triangle?

Public Attributes

T pi [3]
 The three points of the triangle.
halfspaceD2< T, D > hi [3]
 The halfspaces are opposite the vertex with the same index, and point inwards.


Detailed Description

template<typename T, typename D>
class trianglepartition< T, D >

Test if a point is within a triangle.

Definition at line 12 of file trianglepartition.h.


Constructor & Destructor Documentation

template<typename T , typename D >
trianglepartition< T, D >::trianglepartition ( T const &  p0_,
T const &  p1_,
T const &  p2_ 
) [inline]

Anti clockwise point ordering.

Definition at line 54 of file trianglepartition.h.

00059 {
00060   construct(p0_,p1_,p2_);
00061 }

template<typename T, typename D>
trianglepartition< T, D >::trianglepartition (  )  [inline]

Unconstructed triangle.

Definition at line 32 of file trianglepartition.h.

00032 {}


Member Function Documentation

template<typename T , typename D >
void trianglepartition< T, D >::construct ( T const &  p0_,
T const &  p1_,
T const &  p2_ 
) [inline]

Construct this triangle from anti clockwise point ordering.

Definition at line 65 of file trianglepartition.h.

00070 {
00071   pi[0] = p0_;
00072   pi[1] = p1_;
00073   pi[2] = p2_;
00074 
00075   hi[0] = halfspaceD2<T,D>(pi[0],pi[1]); 
00076   hi[1] = halfspaceD2<T,D>(pi[1],pi[2]); 
00077   hi[2] = halfspaceD2<T,D>(pi[2],pi[0]);
00078 } 

template<typename T , typename D >
boolc trianglepartition< T, D >::isInside ( T const &  a  )  const [inline, virtual]

Is the point inside the triangle?

Implements partitionspace< T >.

Definition at line 81 of file trianglepartition.h.

References trianglepartition< T, D >::hi.

00082 {
00083   for (uint i=0; i<3; ++i)
00084     if (!hi[i].isInside(x))
00085       return false;
00086 
00087   return true;
00088 }


Member Data Documentation

template<typename T, typename D>
halfspaceD2<T,D> trianglepartition< T, D >::hi[3]

The halfspaces are opposite the vertex with the same index, and point inwards.

Definition at line 21 of file trianglepartition.h.

Referenced by trianglepartition< T, D >::isInside().

template<typename T, typename D>
T trianglepartition< T, D >::pi[3]

The three points of the triangle.

Definition at line 17 of file trianglepartition.h.


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

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