proj home

Files   Classes   Functions   Hierarchy  

trianglespace< T, D > Class Template Reference

Not inside the triangle partition. More...

#include <trianglespace.h>

Collaboration diagram for trianglespace< T, D >:

List of all members.

Public Member Functions

 trianglespace (T const &p0, T const &p1, T const &p2)
 Anticlockwise ordering of points expected.
bool const isInside (T const &x) const
 Is the point outside the triangle boundary?
bool const isOnEdge (T const &a, T const &b, T const &w, D const zero) const
bool const isOnBoundary (T const &x, D const zero) const

Public Attributes

T pi [3]
 Anti clockwise ordering of points.
halfspaceD2< T, D > hi [3]
 Half spaces pointing outside of triangle.


Detailed Description

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

Not inside the triangle partition.

The boundary is not included, so inverting the isInside operator would return true if a point was inside the triangle or on the triangles boundary.

Definition at line 15 of file trianglespace.h.


Constructor & Destructor Documentation

template<typename T, typename D>
trianglespace< T, D >::trianglespace ( T const &  p0,
T const &  p1,
T const &  p2 
) [inline]

Anticlockwise ordering of points expected.

Definition at line 28 of file trianglespace.h.

References trianglespace< T, D >::hi, trianglespace< T, D >::pi, and halfspaceD2< PT, PD >::set().

00029   {
00030     pi[0] = p0;
00031     pi[1] = p1;
00032     pi[2] = p2;
00033 
00034     hi[0].set(pi[2],pi[1]);
00035     hi[1].set(pi[0],pi[2]);
00036     hi[2].set(pi[1],pi[0]);
00037   }


Member Function Documentation

template<typename T, typename D>
bool const trianglespace< T, D >::isInside ( T const &  x  )  const [inline]

Is the point outside the triangle boundary?

Definition at line 40 of file trianglespace.h.

References trianglespace< T, D >::hi.

Referenced by d3meshpartition::isInside(), trianglespace< T, D >::isOnBoundary(), and d3tess::move_terminated().

00041   {
00042     if (hi[0].isInside(x))
00043       return true;
00044 
00045     if (hi[1].isInside(x))
00046       return true;
00047 
00048     if (hi[2].isInside(x))
00049       return true;
00050 
00051     return false;
00052   }

template<typename T, typename D>
bool const trianglespace< T, D >::isOnBoundary ( T const &  x,
D const   zero 
) const [inline]

Definition at line 76 of file trianglespace.h.

References trianglespace< T, D >::isInside(), trianglespace< T, D >::isOnEdge(), and trianglespace< T, D >::pi.

Referenced by d3meshpartition::isOnBoundary().

00077   {
00078     if (isInside(x))
00079       return false;
00080 
00081     if (isOnEdge(pi[0],pi[1]-pi[0],x,zero))
00082       return true;
00083     
00084     if (isOnEdge(pi[0],pi[2]-pi[0],x,zero))
00085       return true;
00086 
00087     if (isOnEdge(pi[1],pi[2]-pi[1],x,zero))
00088       return true;
00089 
00090     return false;
00091   }

template<typename T, typename D>
bool const trianglespace< T, D >::isOnEdge ( T const &  a,
T const &  b,
T const &  w,
D const   zero 
) const [inline]

Definition at line 54 of file trianglespace.h.

Referenced by trianglespace< T, D >::isOnBoundary().

00055   {
00056     assert( (b.dot()!=0) );
00057     D t = (w-a).dot(b);
00058     t /= b.dot();
00059     if (t<0)
00060        return false;
00061     if (t>1)
00062       return false;
00063 
00064     T p(a+b*t-w);
00065     D d = p.dot();
00066  
00067     if (d+zero<0)
00068       return false;
00069 
00070     if (d<zero)
00071       return true;
00072 
00073     return false;
00074   }


Member Data Documentation

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

Half spaces pointing outside of triangle.

The half space is opposite the point with the same local index.

Definition at line 25 of file trianglespace.h.

Referenced by trianglespace< T, D >::isInside(), d3tess::move_terminated(), and trianglespace< T, D >::trianglespace().

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

Anti clockwise ordering of points.

Definition at line 20 of file trianglespace.h.

Referenced by trianglespace< T, D >::isOnBoundary(), and trianglespace< T, D >::trianglespace().


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