proj home

Files   Classes   Functions   Hierarchy  

pnlink< Indx > Class Template Reference

Link to a point and a neighbor. More...

#include <pnlink.h>

Collaboration diagram for pnlink< Indx >:

List of all members.

Public Types

typedef Indx const Indxc

Public Member Functions

 pnlink (Indxc plink_, Indxc nlink_)
 Possibly partially constructed.
 pnlink (Indxc plink_, Indxc nlink_, pnlink< Indx > *next_)
 Fully constructed.
 pnlink (Indxc p0, Indxc p1, Indxc n0, Indxc n1)
 Construct two consecutive links.
 pnlink (Indxc p0, Indxc p1, Indxc p2, Indxc n0, Indxc n1, Indxc n2)
 Construct three consecutive links.
 pnlink (Indxc p0, Indxc p1, Indxc p2, Indxc p3, Indxc n0, Indxc n1, Indxc n2, Indxc n3)
 Construct four consecutive links.
 pnlink (Indxc p0, Indxc p1, Indxc p2, Indxc p3, Indxc p4, Indxc n0, Indxc n1, Indxc n2, Indxc n3, Indxc n4)
 Construct five consecutive links.
 pnlink (Indxc p0, Indxc p1, Indxc p2, Indxc p3, Indxc p4, Indxc p5, Indxc n0, Indxc n1, Indxc n2, Indxc n3, Indxc n4, Indxc n5)
 Construct six consecutive links.
 pnlink (Indxc p0, Indxc p1, Indxc p2, Indxc p3, Indxc p4, Indxc p5, Indxc p6, Indxc n0, Indxc n1, Indxc n2, Indxc n3, Indxc n4, Indxc n5, Indxc n6)
 Construct seven consecutive links.
 pnlink (Indxc p0, Indxc p1, Indxc p2, Indxc p3, Indxc p4, Indxc p5, Indxc p6, Indxc p7, Indxc n0, Indxc n1, Indxc n2, Indxc n3, Indxc n4, Indxc n5, Indxc n6, Indxc n7)
 Construct eight consecutive links.
 pnlink ()
 Unconstructed state.
pnlink< Indx > * piInverse (Indx gpt) const
 Iterate around the ring to find the link with the point.
pnlink< Indx > * niInverse (Indx neib)
 Iterate around the ring to find the link with the neighbor.
void insert (pnlink< Indx > &next_)
 Insert after this link.
void addafterself (Indxc p0, Indxc n0)
 Insert a new link after this link.
boolc add (Indxc ptindx, Indxc p0)
 Find the point ptindx and add new link copying its neighbor.
boolc isnull () const
 Is the link null?

Public Attributes

Indx plink
 Point link.
Indx nlink
 Neighbor link.
pnlink< Indx > * next
 Next element in circular list.


Detailed Description

template<typename Indx>
class pnlink< Indx >

Link to a point and a neighbor.

This can be used to represent a polygon as a circular list with each point having a link to the on the face of this and the next point.

By definition a null link has a point plink with 0 value meaning that the link is not pointing to any point.

<TODO> Provide memory management by overloading new and delete for this class.

Definition at line 22 of file pnlink.h.


Member Typedef Documentation

template<typename Indx>
typedef Indx const pnlink< Indx >::Indxc

Definition at line 26 of file pnlink.h.


Constructor & Destructor Documentation

template<typename Indx>
pnlink< Indx >::pnlink ( Indxc  plink_,
Indxc  nlink_ 
) [inline]

Possibly partially constructed.

Definition at line 38 of file pnlink.h.

00039     : plink(plink_), nlink(nlink_), next(this) {}

template<typename Indx>
pnlink< Indx >::pnlink ( Indxc  plink_,
Indxc  nlink_,
pnlink< Indx > *  next_ 
) [inline]

Fully constructed.

Definition at line 41 of file pnlink.h.

00042     : plink(plink_), nlink(nlink_), next(next_) {}

template<typename Indx >
pnlink< Indx >::pnlink ( Indxc  p0,
Indxc  p1,
Indxc  n0,
Indxc  n1 
) [inline]

Construct two consecutive links.

Definition at line 226 of file pnlink.h.

00229 {
00230   plink = p0;
00231   nlink = n0;
00232   next = this;
00233   addafterself(p1,n1);
00234 }

template<typename Indx >
pnlink< Indx >::pnlink ( Indxc  p0,
Indxc  p1,
Indxc  p2,
Indxc  n0,
Indxc  n1,
Indxc  n2 
) [inline]

Construct three consecutive links.

Definition at line 238 of file pnlink.h.

00241 {
00242   plink = p0;
00243   nlink = n0;
00244   next = this;
00245   addafterself(p2,n2);
00246   addafterself(p1,n1);
00247 }

template<typename Indx >
pnlink< Indx >::pnlink ( Indxc  p0,
Indxc  p1,
Indxc  p2,
Indxc  p3,
Indxc  n0,
Indxc  n1,
Indxc  n2,
Indxc  n3 
) [inline]

Construct four consecutive links.

Definition at line 251 of file pnlink.h.

00255 {
00256   plink = p0;
00257   nlink = n0;
00258   next = this;
00259   addafterself(p3,n3);
00260   addafterself(p2,n2);
00261   addafterself(p1,n1);
00262 }

template<typename Indx >
pnlink< Indx >::pnlink ( Indxc  p0,
Indxc  p1,
Indxc  p2,
Indxc  p3,
Indxc  p4,
Indxc  n0,
Indxc  n1,
Indxc  n2,
Indxc  n3,
Indxc  n4 
) [inline]

Construct five consecutive links.

Definition at line 266 of file pnlink.h.

00270 {
00271   plink = p0;
00272   nlink = n0;
00273   next = this;
00274   addafterself(p4,n4);
00275   addafterself(p3,n3);
00276   addafterself(p2,n2);
00277   addafterself(p1,n1);
00278 }

template<typename Indx >
pnlink< Indx >::pnlink ( Indxc  p0,
Indxc  p1,
Indxc  p2,
Indxc  p3,
Indxc  p4,
Indxc  p5,
Indxc  n0,
Indxc  n1,
Indxc  n2,
Indxc  n3,
Indxc  n4,
Indxc  n5 
) [inline]

Construct six consecutive links.

Definition at line 282 of file pnlink.h.

00286 {
00287   plink = p0;
00288   nlink = n0;
00289   next = this;
00290   addafterself(p5,n5);
00291   addafterself(p4,n4);
00292   addafterself(p3,n3);
00293   addafterself(p2,n2);
00294   addafterself(p1,n1);
00295 }

template<typename Indx >
pnlink< Indx >::pnlink ( Indxc  p0,
Indxc  p1,
Indxc  p2,
Indxc  p3,
Indxc  p4,
Indxc  p5,
Indxc  p6,
Indxc  n0,
Indxc  n1,
Indxc  n2,
Indxc  n3,
Indxc  n4,
Indxc  n5,
Indxc  n6 
) [inline]

Construct seven consecutive links.

Definition at line 299 of file pnlink.h.

00303 {
00304   plink = p0;
00305   nlink = n0;
00306   next = this;
00307   addafterself(p6,n6);
00308   addafterself(p5,n5);
00309   addafterself(p4,n4);
00310   addafterself(p3,n3);
00311   addafterself(p2,n2);
00312   addafterself(p1,n1);
00313 }

template<typename Indx >
pnlink< Indx >::pnlink ( Indxc  p0,
Indxc  p1,
Indxc  p2,
Indxc  p3,
Indxc  p4,
Indxc  p5,
Indxc  p6,
Indxc  p7,
Indxc  n0,
Indxc  n1,
Indxc  n2,
Indxc  n3,
Indxc  n4,
Indxc  n5,
Indxc  n6,
Indxc  n7 
) [inline]

Construct eight consecutive links.

Definition at line 317 of file pnlink.h.

00321 {
00322   plink = p0;
00323   nlink = n0;
00324   next = this;
00325   addafterself(p7,n7);
00326   addafterself(p6,n6);
00327   addafterself(p5,n5);
00328   addafterself(p4,n4);
00329   addafterself(p3,n3);
00330   addafterself(p2,n2);
00331   addafterself(p1,n1);
00332 }

template<typename Indx>
pnlink< Indx >::pnlink (  )  [inline]

Unconstructed state.

Definition at line 65 of file pnlink.h.

Referenced by pnlink< Indx >::addafterself().

00066     : plink(0), nlink(0), next(0) {}


Member Function Documentation

template<typename Indx >
boolc pnlink< Indx >::add ( Indxc  ptindx,
Indxc  p0 
) [inline]

Find the point ptindx and add new link copying its neighbor.

Definition at line 186 of file pnlink.h.

References pnlink< Indx >::addafterself(), pnlink< Indx >::nlink, and pnlink< Indx >::piInverse().

Referenced by regionD2linked< Indx >::add().

00187 {
00188   pnlink<Indx> * pl = piInverse(ptindx);
00189   if (pl==0)
00190     return false;
00191 
00192   Indx n0 = pl->nlink;
00193   pl->addafterself(p0,n0);
00194 
00195   return true;
00196 }

template<typename Indx>
void pnlink< Indx >::addafterself ( Indxc  p0,
Indxc  n0 
) [inline]

Insert a new link after this link.

Definition at line 77 of file pnlink.h.

References pnlink< Indx >::next, and pnlink< Indx >::pnlink().

Referenced by pnlink< Indx >::add().

00078     { next = new pnlink(p0,n0,this->next); }

template<typename Indx>
void pnlink< Indx >::insert ( pnlink< Indx > &  next_  )  [inline]

Insert after this link.

Definition at line 74 of file pnlink.h.

References pnlink< Indx >::next.

00075     { next_.next = next; next = & next_; }

template<typename Indx>
boolc pnlink< Indx >::isnull (  )  const [inline]

Is the link null?

Definition at line 84 of file pnlink.h.

References pnlink< Indx >::plink.

00085     { return plink==0; }

template<typename Indx >
pnlink< Indx > * pnlink< Indx >::niInverse ( Indx  neib  )  [inline]

Iterate around the ring to find the link with the neighbor.

Definition at line 212 of file pnlink.h.

References pnlinkiter< Indx >::reset().

00213 {
00214   pnlinkiter<Indx> iter(this);
00215   for ( iter.reset(); !iter; ++iter )
00216   {
00217     if (iter->nlink==neib)
00218       return iter();
00219   }
00220 
00221   return 0;
00222 }

template<typename Indx >
pnlink< Indx > * pnlink< Indx >::piInverse ( Indx  gpt  )  const [inline]

Iterate around the ring to find the link with the point.

Definition at line 199 of file pnlink.h.

References pnlinkiter< Indx >::reset().

Referenced by pnlink< Indx >::add().

00200 {
00201   pnlinkiter<Indx> iter(this);
00202   for ( iter.reset(); !iter; ++iter )
00203   {
00204     if (iter->plink==gpt)
00205       return iter();
00206   }
00207 
00208   return 0;
00209 }


Member Data Documentation

template<typename Indx>
pnlink<Indx>* pnlink< Indx >::next

template<typename Indx>
Indx pnlink< Indx >::nlink

Neighbor link.

Definition at line 32 of file pnlink.h.

Referenced by pnlink< Indx >::add(), and regionD2linked< Indx >::vec().

template<typename Indx>
Indx pnlink< Indx >::plink

Point link.

Definition at line 29 of file pnlink.h.

Referenced by pnlink< Indx >::isnull(), and regionD2linked< Indx >::vec().


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

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