proj home

Files   Classes   Functions   Hierarchy  

polytopeD2tess< VPOLY, VPTS > Class Template Reference

#include <polytopeD2tess.h>

Collaboration diagram for polytopeD2tess< VPOLY, VPTS >:

List of all members.

Public Member Functions

 polytopeD2tess (VPOLY &vi_, VPTS &pts_)
 Initialize the polytope vector and global points.
boolc verify (uintc k) const
 Test the k'th polytope.
boolc verify () const
 Test all the polytopes.
void addpoint (uintc k, uintc ptindex, uintc ptglobal)
 Add to the k'th polytope a new point.
void printvi () const
 Print the tessellation.

Public Attributes

VPOLY & vi
 Vector of polytopes indexes to the points.
VPTS & pts
 Vector of points.


Detailed Description

template<typename VPOLY, typename VPTS>
class polytopeD2tess< VPOLY, VPTS >

Definition at line 7 of file polytopeD2tess.h.


Constructor & Destructor Documentation

template<typename VPOLY, typename VPTS>
polytopeD2tess< VPOLY, VPTS >::polytopeD2tess ( VPOLY &  vi_,
VPTS &  pts_ 
) [inline]

Initialize the polytope vector and global points.

Definition at line 18 of file polytopeD2tess.h.

00022     : vi(vi_), pts(pts_) {}


Member Function Documentation

template<typename VPOLY , typename VPTS >
void polytopeD2tess< VPOLY, VPTS >::addpoint ( uintc  k,
uintc  ptindex,
uintc  ptglobal 
) [inline]

Add to the k'th polytope a new point.

The neighbors link is also updated.

Definition at line 95 of file polytopeD2tess.h.

References polytopeD2linked::addpoint(), and pts.

Referenced by polytopesD2linkedtest::test02().

00100 {
00101   assert(k<vi.size());
00102   assert(ptindex<pts.size());
00103   assert(ptglobal<pts.size());
00104 
00105   polytopeD2linked & A(vi[k]);
00106   
00107 //cout << SHOW(k) << endl;
00108 //cout << SHOW(ptindex) << endl;
00109   uintc j = A.piInverse(ptindex);
00110   uintc neib = A.ni[j];
00111   uint i = (j+1) % A.pi.size(); 
00112 //cout << SHOW(i) << endl;
00113 //cout << SHOW(neib) << endl;
00114   // Has the polygon got a neighbor?
00115   if (neib!=0)
00116   {
00117     uintc ptindex2 = A.pi[i];
00118 //cout << SHOW(ptindex2) << endl;
00119     polytopeD2linked & B(vi[neib]);
00120     B.addpoint(ptindex2,ptglobal);
00121   }
00122 
00123   A.addpoint(ptindex,ptglobal);
00124 }

template<typename VPOLY , typename VPTS >
void polytopeD2tess< VPOLY, VPTS >::printvi (  )  const [inline]

Print the tessellation.

Definition at line 42 of file polytopeD2tess.h.

References polytopeD2tess< VPOLY, VPTS >::vi.

Referenced by polytopesD2linkedtest::test02().

00043 {
00044   for (uint i=1; i<vi.size(); ++i)
00045     cout << (string)vi[i] << endl;
00046 }

template<typename VPOLY , typename VPTS >
boolc polytopeD2tess< VPOLY, VPTS >::verify (  )  const [inline]

Test all the polytopes.

Definition at line 49 of file polytopeD2tess.h.

References polytopeD2tess< VPOLY, VPTS >::vi.

00050 {
00051   uintc imax = vi.size();
00052   for (uint i=0; i<imax; ++i)
00053   {
00054     if (verify(i)==false)
00055       return false;
00056   }
00057 
00058   return true;
00059 }

template<typename VPOLY , typename VPTS >
boolc polytopeD2tess< VPOLY, VPTS >::verify ( uintc  k  )  const [inline]

Test the k'th polytope.

Definition at line 62 of file polytopeD2tess.h.

References polytopeD2linked::isnull(), polytopeD2linked::ni, polytopeD2linked::pi, and polytopeD2tess< VPOLY, VPTS >::vi.

Referenced by polytopesD2linkedtest::test01(), and polytopesD2linkedtest::test02().

00063 {
00064   polytopeD2linked const & x(vi[k]);
00065   if (x.isnull())
00066     return true;
00067 
00068   uintc sz = x.ni.size();
00069   assert(x.pi.size()==sz);
00070   if (x.pi.size()!=sz)
00071     return false;
00072 
00073   uint nicurrent;
00074   for (uint i=0; i<sz; ++i)
00075   {
00076     nicurrent=x.ni[i];
00077     if (nicurrent==0)
00078       continue;
00079 
00080     assert(nicurrent<vi.size());
00081     if ((nicurrent<vi.size())==false)
00082       return false;
00083 
00084     assert(vi[nicurrent].niInverseHas(k)==true);
00085     if (vi[nicurrent].niInverseHas(k)==false)
00086       return false;
00087   }
00088 
00089   return true;
00090 }


Member Data Documentation

template<typename VPOLY, typename VPTS>
VPTS& polytopeD2tess< VPOLY, VPTS >::pts

Vector of points.

Definition at line 14 of file polytopeD2tess.h.

template<typename VPOLY, typename VPTS>
VPOLY& polytopeD2tess< VPOLY, VPTS >::vi

Vector of polytopes indexes to the points.

Definition at line 12 of file polytopeD2tess.h.

Referenced by polytopeD2tess< VPOLY, VPTS >::printvi(), and polytopeD2tess< VPOLY, VPTS >::verify().


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

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