proj home

Files   Classes   Functions   Hierarchy  

simplexD2linked Class Reference

#include <simplexD2linked.h>

Collaboration diagram for simplexD2linked:

List of all members.

Public Member Functions

uintc nifrom (uintc gpt) const
 Use global points as references to get the opposite neighbor.
uintc piInverse (uintc gpt) const
 Get the local point index.
boolc piInverseHas (uintc gpt) const
 Given the point does it belong to this simplex?
uintc piInverse (bool &res, uintc gpt) const
 Both find the point inverse and query if it exists.
uintc niInverse (uintc neib) const
 Get the local neighbour index.
boolc niInverseHas (uintc neib) const
 Has the simplex got a pointer to neib?
uintc niInverse (bool &res, uintc neib) const
 Both find the inverse and query if it exists.
 simplexD2linked ()
 Default Constructor: all fields set to 0.
 simplexD2linked (uintc a, uintc b, uintc c, uintc na=0, uintc nb=0, uintc nc=0)
 Construct a triangle.
void construct (uintc a, uintc b, uintc c, uintc na, uintc nb, uintc nc)
 Construct this triangle.
void getanticlockwiseface (uint &a, uint &b, uintc face) const
 Returns anticlockwise point indexes a,b are indexes from <0,1,2> eg face 1 identifies the face opposite the point 1 which is line form 2 to 0.
void getclockwiseface (uint &a, uint &b, uintc face) const
 Returns clockwise point indexes a,b are indexes from <0,1,2>.
boolc isonboundary () const
 Is the triangle part of the surface?
void setnull ()
 Set all fields to 0.
boolc isnull () const
 Is this a triangle? Are all the fields set to zero?
void changelink (uintc from, uintc to)
 Change the link to point to another simplex.
boolc operator== (simplexD2linked const &w) const
 Do two triangles have the same points? Assumes simplex has unique points, so (1,1,2) is not compared with (2,2,1).
 operator string () const
 Write the object out.
void serializeInverse (stringc &s)
 Read the object in.
ostreamprint (ostream &os) const
 Write the object out.
istream & serializeInverse (istream &is)
 Read the object in.

Public Attributes

uint pi [3]
 Indexes to points or verticies.
uint ni [3]
 Indexes to neighboring simplexes.


Detailed Description

Definition at line 29 of file simplexD2linked.h.


Constructor & Destructor Documentation

simplexD2linked::simplexD2linked (  ) 

Default Constructor: all fields set to 0.

Definition at line 34 of file simplexD2linked.cpp.

References ni, and pi.

00035 {
00036   for (uint i=0; i<3; ++i)
00037   {
00038     pi[i] = 0;
00039     ni[i] = 0;
00040   }
00041 }

simplexD2linked::simplexD2linked ( uintc  a,
uintc  b,
uintc  c,
uintc  na = 0,
uintc  nb = 0,
uintc  nc = 0 
)

Construct a triangle.

Definition at line 44 of file simplexD2linked.cpp.

00052 { 
00053   construct(a,b,c,na,nb,nc); 
00054 }


Member Function Documentation

void simplexD2linked::changelink ( uintc  from,
uintc  to 
) [inline]

Change the link to point to another simplex.

Definition at line 153 of file simplexD2linked.h.

References ni, and niInverse().

Referenced by d3tess::simplexswap().

00154     { ni[ niInverse(from) ] = to; }

void simplexD2linked::construct ( uintc  a,
uintc  b,
uintc  c,
uintc  na,
uintc  nb,
uintc  nc 
)

Construct this triangle.

Definition at line 158 of file simplexD2linked.cpp.

00166 {
00167   pi[0] = a;
00168   pi[1] = b;
00169   pi[2] = c;
00170   ni[0] = na;
00171   ni[1] = nb;
00172   ni[2] = nc;
00173 };

void simplexD2linked::getanticlockwiseface ( uint a,
uint b,
uintc  face 
) const

Returns anticlockwise point indexes a,b are indexes from <0,1,2> eg face 1 identifies the face opposite the point 1 which is line form 2 to 0.

Definition at line 177 of file simplexD2linked.cpp.

00182 {
00183   switch (face)
00184   {
00185     case 0:
00186       a=1; b=2; 
00187       break;
00188 
00189     case 1:
00190       a=2; b=0;
00191       break;
00192 
00193     case 2:
00194       a=0; b=1;
00195       break;
00196 
00197     default:
00198       assert(false);
00199   }
00200 }

void simplexD2linked::getclockwiseface ( uint a,
uint b,
uintc  face 
) const

Returns clockwise point indexes a,b are indexes from <0,1,2>.

Definition at line 203 of file simplexD2linked.cpp.

00208 {
00209   switch (face)
00210   {
00211     case 0:
00212       a=2; b=1; 
00213       break;
00214 
00215     case 1:
00216       a=0; b=2; 
00217       break;
00218 
00219     case 2:
00220       a=1; b=0; 
00221       break;
00222 
00223     default:
00224       assert(false);
00225   }
00226 }

boolc simplexD2linked::isnull (  )  const

Is this a triangle? Are all the fields set to zero?

Definition at line 228 of file simplexD2linked.cpp.

References ni, and pi.

Referenced by writemulticolorobj::draw(), writegridobj::draw(), writewindingobj::draw(), writesurfaceobj::draw(), d3meshiterrecursive< B >::eval(), and d3tess::simplexdelete().

00229 {
00230   for (uint i=0; i<3; ++i)
00231   {
00232     if (pi[i]!=0)
00233       return false;
00234 
00235     if (ni[i]!=0)
00236       return false;
00237   }
00238 
00239   return true;
00240 }

boolc simplexD2linked::isonboundary (  )  const

Is the triangle part of the surface?

Definition at line 78 of file simplexD2linked.cpp.

References ni.

00079 {
00080   if (ni[0]==0) return true;
00081   if (ni[1]==0) return true;
00082   if (ni[2]==0) return true;
00083   
00084   return false;
00085 }

uintc simplexD2linked::nifrom ( uintc  gpt  )  const [inline]

Use global points as references to get the opposite neighbor.

Definition at line 41 of file simplexD2linked.h.

References ni, and piInverse().

00042     { return ni[piInverse(gpt)]; }

uintc simplexD2linked::niInverse ( bool res,
uintc  neib 
) const [inline]

Both find the inverse and query if it exists.

Definition at line 98 of file simplexD2linked.h.

References ni.

00099   {
00100     res=true;
00101     if (ni[0]==neib) return 0;
00102     if (ni[1]==neib) return 1;
00103     if (ni[2]==neib) return 2;
00104 
00105     res=false;
00106     return 3; // Return crap.
00107   }  

uintc simplexD2linked::niInverse ( uintc  neib  )  const [inline]

Get the local neighbour index.

Definition at line 79 of file simplexD2linked.h.

References ni.

Referenced by changelink(), d3mincircle::eval(), d3mincentroid2::eval(), d3mincentroid::eval(), d3minboundary::eval(), d3tess::flip(), d3tess::isconvex(), d3tess::movedown(), d3tess::simplexswap(), and d3tess::split1D().

00080   {  
00081     if (ni[0]==neib) return 0;
00082     if (ni[1]==neib) return 1;
00083     if (ni[2]==neib) return 2;
00084 
00085     assert(false);
00086     return 3; // Return crap.
00087   }  

boolc simplexD2linked::niInverseHas ( uintc  neib  )  const [inline]

Has the simplex got a pointer to neib?

Definition at line 89 of file simplexD2linked.h.

References ni.

Referenced by d3tess::simplexswap().

00090   {  
00091     if (ni[0]==neib) return true;
00092     if (ni[1]==neib) return true;
00093     if (ni[2]==neib) return true;
00094 
00095     return false; 
00096   }  

simplexD2linked::operator string (  )  const

Write the object out.

Definition at line 14 of file simplexD2linked.cpp.

References ni, and pi.

00015 {
00016   string s;
00017   for (uint i=0; i<3; ++i)
00018   {
00019     { stringstream ss; ss << pi[i]; s+=ss.str(); }
00020     s += " ";
00021   }
00022 
00023   s += "  ";
00024 
00025   for (uint i=0; i<3; ++i)
00026   {
00027     { stringstream ss; ss << ni[i]; s+=ss.str(); }
00028     s += " ";
00029   }
00030 
00031   return s;
00032 }

boolc simplexD2linked::operator== ( simplexD2linked const &  w  )  const

Do two triangles have the same points? Assumes simplex has unique points, so (1,1,2) is not compared with (2,2,1).

Definition at line 251 of file simplexD2linked.cpp.

References pi.

00252 {
00253   if (pi[0]+pi[1]+pi[2] != w.pi[0]+w.pi[1]+w.pi[2])
00254     return false;
00255 
00256   for (uint i=0; i<3; ++i)
00257   {
00258     bool res(false);
00259     for (uint k=0; k<3; ++k)
00260     {
00261       if (w.pi[k]==pi[i])
00262       {
00263         res=true;
00264         k=3;
00265       }
00266     }
00267     if (res==false)
00268       return false;
00269   }
00270 
00271   return true;
00272 }

uintc simplexD2linked::piInverse ( bool res,
uintc  gpt 
) const [inline]

Both find the point inverse and query if it exists.

Definition at line 67 of file simplexD2linked.h.

References pi.

00068   {
00069     res=true;
00070     if (pi[0]==gpt) return 0;
00071     if (pi[1]==gpt) return 1;
00072     if (pi[2]==gpt) return 2;
00073 
00074     res=false;
00075     return 3; // Return crap.
00076   }

uintc simplexD2linked::piInverse ( uintc  gpt  )  const [inline]

Get the local point index.

Definition at line 45 of file simplexD2linked.h.

References pi.

Referenced by d3tess::flip(), and nifrom().

00046   {
00047     assert(gpt!=0);
00048 
00049     if (pi[0]==gpt) return 0;
00050     if (pi[1]==gpt) return 1;
00051     if (pi[2]==gpt) return 2;
00052 
00053     assert(false);
00054     return 3; // Return crap.
00055   }

boolc simplexD2linked::piInverseHas ( uintc  gpt  )  const [inline]

Given the point does it belong to this simplex?

Definition at line 57 of file simplexD2linked.h.

References pi.

Referenced by d3tess::splitwithline().

00058   {
00059     if (pi[0]==gpt) return true;
00060     if (pi[1]==gpt) return true;
00061     if (pi[2]==gpt) return true;
00062 
00063     return false;
00064   }

ostream & simplexD2linked::print ( ostream os  )  const

Write the object out.

Definition at line 143 of file simplexD2linked.cpp.

References ni, and pi.

Referenced by operator<<().

00144 {
00145   for (uint i=0; i<3; ++i)
00146     os << pi[i] << " ";
00147 
00148   os << "  ";
00149 
00150   for (uint i=0; i<3; ++i)
00151     os << ni[i] << " ";
00152 
00153   return os;
00154 }

istream & simplexD2linked::serializeInverse ( istream &  is  ) 

Read the object in.

Definition at line 130 of file simplexD2linked.cpp.

References ni, and pi.

00131 {
00132   for (uint i=0; i<3; ++i)
00133     is >> pi[i];
00134 
00135   for (uint i=0; i<3; ++i)
00136     is >> ni[i];
00137   
00138   return is;
00139 }

void simplexD2linked::serializeInverse ( stringc s  ) 

Read the object in.

Definition at line 120 of file simplexD2linked.cpp.

References ni, and pi.

Referenced by operator>>().

00121 {  
00122   stringstream ss(s); 
00123   for (uint i=0; i<3; ++i)
00124     ss >> pi[i];
00125 
00126   for (uint i=0; i<3; ++i)
00127     ss >> ni[i];
00128 }

void simplexD2linked::setnull (  ) 

Set all fields to 0.

Definition at line 242 of file simplexD2linked.cpp.

References ni, and pi.

Referenced by d3tess::simplexdelete().

00243 {
00244   for (uint i=0; i<3; ++i)
00245   {
00246     pi[i]=0;
00247     ni[i]=0;
00248   }
00249 }


Member Data Documentation


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

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