proj home

Files   Classes   Functions   Hierarchy  

tetrahedronpartition< T, D > Class Template Reference

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

#include <tetrahedronpartition.h>

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

List of all members.

Public Member Functions

 tetrahedronpartition (T const &p0_, T const &p1_, T const &p2_, T const &p3_)
 The first three points form a anticlockwise triangle facing inwards.
 tetrahedronpartition ()
 Unconstructed partition.
void construct (T const &p0_, T const &p1_, T const &p2_, T const &p3_)
 The first three points form a anticlockwise triangle facing inwards.
boolc isInside (T const &x) const
 Is the point inside the tetrahedron?

Public Attributes

T pi [4]
 The four points of the tetrahedron.
halfspaceD3< T, D > hi [4]
 The halfspaces are opposite the vertex with the same index, and point inwards.


Detailed Description

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

Test if a point is within a tetrahedron.

Definition at line 12 of file tetrahedronpartition.h.


Constructor & Destructor Documentation

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

The first three points form a anticlockwise triangle facing inwards.

ie its half space sees the fourth point.

Definition at line 56 of file tetrahedronpartition.h.

00062 {
00063   construct(p0_,p1_,p2_,p3_);
00064 }

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

Unconstructed partition.

Definition at line 33 of file tetrahedronpartition.h.

00033 {}


Member Function Documentation

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

The first three points form a anticlockwise triangle facing inwards.

ie its half space sees the fourth point.

Definition at line 69 of file tetrahedronpartition.h.

00075 {
00076   pi[0] = p0_;
00077   pi[1] = p1_;
00078   pi[2] = p2_;
00079   pi[3] = p3_;
00080 
00081   hi[3] = halfspaceD3<T,D>(p0_,p1_,p2_);
00082   assert( hi[3].isInside(pi[3])==true );
00083   hi[1] = halfspaceD3<T,D>(p0_,p2_,p3_);
00084   assert( hi[1].isInside(pi[1])==true );
00085   hi[2] = halfspaceD3<T,D>(p3_,p1_,p0_);
00086   assert( hi[2].isInside(pi[2])==true );
00087   hi[0] = halfspaceD3<T,D>(p2_,p1_,p3_);
00088   assert( hi[0].isInside(pi[0])==true );
00089 }

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

Is the point inside the tetrahedron?

Implements partitionspace< T >.

Definition at line 92 of file tetrahedronpartition.h.

References tetrahedronpartition< T, D >::hi.

Referenced by d4tess::move_terminated(), and partitionstest::test06().

00093 {
00094   for (uint i=0; i<4; ++i)
00095     if (!hi[i].isInside(x))
00096       return false;
00097 
00098   return true;
00099 }


Member Data Documentation

template<typename T, typename D>
halfspaceD3<T,D> tetrahedronpartition< T, D >::hi[4]

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

Definition at line 21 of file tetrahedronpartition.h.

Referenced by d4tess::isconvex(), tetrahedronpartition< T, D >::isInside(), and d4tess::move_terminated().

template<typename T, typename D>
T tetrahedronpartition< T, D >::pi[4]

The four points of the tetrahedron.

Definition at line 17 of file tetrahedronpartition.h.


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

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