proj home

Files   Classes   Functions   Hierarchy  

d4tess Class Reference

#include <d4tess.h>

Inheritance diagram for d4tess:
Collaboration diagram for d4tess:

List of all members.

Public Member Functions

void viadd (uintc v0, uintc v1, uintc v2, uintc v3, uintc n0=0, uintc n1=0, uintc n2=0, uintc n3=0)
void minimizerSet (d4minoperator*m)
void getpoints (pt4 &P0, pt4 &P1, pt4 &P2, pt4 &P3) const
boolc tetmoveleft ()
boolc tetmoveright ()
boolc tetmovedown ()
boolc boundaryorient ()
void surfacedown ()
void surfaceleft ()
void surfaceright ()
boolc surfaceviewable (uintc k) const
simplexface const cpsimplexface () const
d4tri const & cpsimplex () const
boolc searchinsidemesh (uint &viewableface, uintc p)
boolc move_terminated (bool &insidesimplex, uint &viewableface, uintc p)
boolc rotateaboutaxis (uint &steps)
void addpoint (uintc k)
ostreamprint (ostream &os) const
boolc valid () const
boolc valid (uintc k) const
boolc debugcheck () const
 d4tess (uintc arrayMax)
 ~d4tess ()
void reset ()
void initialize ()
boolc isconnected (uintc a, uintc b) const
boolc isconvex (uintc a, uintc b) const
boolc tet2to3 (uintc a, uintc b)
boolc tet2to3_ (uintc k1, uintc k2)
boolc tet2to3 ()
boolc tet2to3Inverse ()

Public Attributes

vector< pt4pt
vector< d4trivi
uint cp
virtualtetrahedron vs
d4fan fan
d4minoperatorminimizer


Detailed Description

Definition at line 29 of file d4tess.h.


Constructor & Destructor Documentation

d4tess::d4tess ( uintc  arrayMax  ) 

Definition at line 53 of file d4tess.cpp.

References pt, reset(), and vi.

00054   : fan(*this), minimizer( new d4minoperator(*this) )
00055 { 
00056   pt.reserve(arrayMax);
00057   vi.reserve(arrayMax);
00058 
00059   reset();
00060 }

d4tess::~d4tess (  ) 

Definition at line 47 of file d4tess.cpp.

References minimizer.

00048 {
00049   delete minimizer;
00050   minimizer=0;
00051 }


Member Function Documentation

void d4tess::addpoint ( uintc  k  ) 

Definition at line 80 of file d4tess.cpp.

References d4fan::eval(), fan, and searchinsidemesh().

Referenced by d4meshpointreader::eval(), and keyboard().

00081 {
00082   uint face;
00083   bool found = searchinsidemesh(face,k);
00084 
00085   if (found)
00086     split(k);
00087   else
00088     fan.eval(k);
00089 
00090 }

boolc d4tess::boundaryorient (  ) 

Definition at line 621 of file d4tess.cpp.

References cp, virtualtetrahedron::left(), d4tri::ni, virtualtetrahedron::right(), virtualtetrahedron::v, vi, and vs.

Referenced by keyboard().

00622 {
00623   d4tri const & x(vi[cp]);
00624 
00625   // Transverse the virtual tetrahedrons surface.
00626 
00627   if (x.ni[ vs.v[3] ]==0)
00628     return true;
00629     
00630   vs.left();
00631   if (x.ni[ vs.v[3] ]==0)
00632     return true;
00633 
00634   vs.left();
00635   if (x.ni[ vs.v[3] ]==0)
00636     return true;
00637 
00638   vs.right();
00639   if (x.ni[ vs.v[3] ]==0)
00640     return true;
00641 
00642   return false;
00643 }

d4tri const& d4tess::cpsimplex (  )  const [inline]

Definition at line 92 of file d4tess.h.

References cp, and vi.

Referenced by setface().

00093    { assert((cp!=0) && (cp<vi.size())); return vi[cp]; }

simplexface const d4tess::cpsimplexface (  )  const

Definition at line 1019 of file d4tess.cpp.

References cp, virtualtetrahedron::v, virtualtetrahedron::validstate(), and vs.

Referenced by d4fan::eval().

01020 { 
01021   assert(vs.validstate()); 
01022   return simplexface(cp,vs.v[3]); 
01023 }

boolc d4tess::debugcheck (  )  const

Definition at line 437 of file d4tess.cpp.

References messageglobal(), valid(), and vi.

Referenced by d4minboundary::eval(), d4fan::eval(), init01(), init02(), tet2to3(), and tet2to3Inverse().

00438 {
00439 
00440 #ifndef NDEBUG
00441 
00442   bool res(true);
00443   uintc visz = vi.size();
00444 
00445   for (uint i=1; i<visz; ++i )
00446   {
00447     if ( vi[i].isnull() )
00448       continue;
00449     for (uint k=i+1; k<visz; ++k)
00450     {
00451       if (vi[i].hassamepoints( vi[k] ))
00452       {
00453         res=false;
00454 
00455         messageglobal() << "\n";
00456         messageglobal() << "error: tetrahedrons with the same points." << "\n";
00457         messageglobal() << "  check " << i << " " << k << "\n";
00458         messageglobal() << "vi[i]=" << vi[i] << "\n";
00459         messageglobal() << "vi[k]=" << vi[k] << "\n";
00460         messageglobal() << "\n";
00461         messageglobal() << *this;
00462       }
00463     }
00464   }
00465   assert(res==true);
00466 
00467   for (uint i=1; i<visz; ++i)
00468   {
00469     if(valid(i)==false)
00470     {
00471       res=false;
00472       messageglobal() << "error:  ";
00473       //messageglobal() << setw(2) << i;
00474       messageglobal() << " " << i;
00475       messageglobal() << "  " << vi[i] << "\n";
00476       messageglobal() << "Printing out tess." << "\n";
00477       messageglobal() << *this << "\n";
00478     }
00479   }
00480 
00481   assert(res==true);
00482 
00483   return res;
00484 
00485 #else
00486   return true;
00487 #endif
00488 
00489 }

void d4tess::getpoints ( pt4 P0,
pt4 P1,
pt4 P2,
pt4 P3 
) const

Definition at line 28 of file d4tess.cpp.

References d4tri::pi.

00034 {
00035   d4tri const & x(cpsimplex());
00036 
00037 //messageglobal() << "cp=" << cp << "\n";
00038 //messageglobal() << "x=" << x << "\n";
00039 
00040   P0 = pt[ x.pi[ vs.v[0] ] ];
00041   P1 = pt[ x.pi[ vs.v[1] ] ];
00042   P2 = pt[ x.pi[ vs.v[2] ] ];
00043   P3 = pt[ x.pi[ vs.v[3] ] ];
00044 }

void d4tess::initialize (  ) 

Definition at line 1036 of file d4tess.cpp.

References halfspaceD3< PT, PD >::isInside(), pt, and vi.

Referenced by d4meshpointreader::eval(), and init03().

01037 {
01038   assert(pt.size()>4);
01039   assert(vi.size()==1);
01040 
01041   pt4c & p0(pt[1]);
01042   pt4c & p1(pt[2]);
01043   pt4c & p2(pt[3]);
01044   pt4c & p3(pt[4]);
01045 
01046   halfspaceD3< pt4, double > h(p2,p1,p0);
01047   if (h.isInside(p3)==false)
01048     vi.push_back( d4tri(1,2,3,4, 0,0,0,0) );
01049   else
01050     vi.push_back( d4tri(4,3,2,1, 0,0,0,0) );
01051 }

boolc d4tess::isconnected ( uintc  a,
uintc  b 
) const

Definition at line 675 of file d4tess.cpp.

References d4tri::niInverse(), and vi.

00676 {
00677   uintc sz(vi.size());
00678   assert(a<sz);
00679   assert(b<sz);
00680 
00681   d4tri const & A(vi[a]);
00682   d4tri const & B(vi[b]);
00683 
00684   bool res;
00685 
00686   A.niInverse(res,b);
00687   if (res==false)
00688     return false;
00689 
00690   B.niInverse(res,a);
00691   if (res==false)
00692     return false;
00693 
00694   return true;
00695 }

boolc d4tess::isconvex ( uintc  a,
uintc  b 
) const

Definition at line 698 of file d4tess.cpp.

References tetrahedronpartition< T, D >::hi, d4tri::niInverse(), d4tri::pi, pt, and vi.

Referenced by d4mingreedy2::eval(), d4minboundary::eval(), tet2to3(), and tet2to3_().

00699 {
00700   assert(a<vi.size());
00701   assert(b<vi.size());
00702 
00703   assert(a!=0);
00704   assert(b!=0);
00705 
00706   d4tri const & A(vi[a]);
00707   d4tri const & B(vi[b]);
00708 
00709 //  if (isconnected(a,b)==false)
00710 //    return false;
00711 
00712 //  uint ai = A.niInverse(b);
00713 
00714   bool res;
00715   uint ai = A.niInverse(res,b);
00716   if (res==false)
00717     return false;
00718 
00719   uint bi = B.niInverse(res,a);
00720   if (res==false)
00721     return false;
00722 
00723 // KEEP THIS CODE   [KEEP]
00724 /*
00725 
00726   //  ASSUMING A CONVEX MESH
00727 
00728   //
00729   // This test may become more efficent as the
00730   //   mesh is better balanced.
00731   // At the moment it captures less than 10% of cases.
00732 
00733   for (uint i=0; i<4; ++i)
00734   {
00735     if (i==ai)
00736       continue;
00737 
00738     B.niInverse(res,A.ni[i]);
00739     if (res==true)
00740     {
00741 messageglobal() << "non-convex found with integer arithmetic" << "      return false;
00742     }
00743   }
00744 
00745 messageglobal() << "normal convex test with halfplanes" << "
00746 */
00747 
00748 
00749 
00750   tetrahedronpartition< pt4, double > tp
00751   ( 
00752     pt[A.pi[0] ],
00753     pt[A.pi[1] ],
00754     pt[A.pi[2] ],
00755     pt[A.pi[3] ]
00756   );
00757 
00758   pt4 p(pt[B.pi[bi]]);
00759 
00760   for (uint i=0; i<4; ++i)
00761   {
00762     if (i==ai)
00763       continue;
00764 
00765     if ( tp.hi[i].isInside(p)==true )
00766       return false;
00767   }
00768 
00769   return true;
00770 }
00771 

void d4tess::minimizerSet ( d4minoperator m  ) 

Definition at line 62 of file d4tess.cpp.

References minimizer.

Referenced by main().

00063 {
00064   delete minimizer;
00065   minimizer = m;
00066 }

boolc d4tess::move_terminated ( bool insidesimplex,
uint viewableface,
uintc  p 
)

Definition at line 167 of file d4tess.cpp.

References tetrahedronpartition< T, D >::hi, tetrahedronpartition< T, D >::isInside(), d4tri::ni, and d4tri::pi.

Referenced by searchinsidemesh().

00172 {
00173   d4tri & x(vi[cp]);
00174 
00175   assert(p<pt.size());
00176   pt4c & target(pt[p]);
00177 
00178   tetrahedronpartition< pt4, double > tp
00179   ( 
00180     pt[ x.pi[0] ],
00181     pt[ x.pi[1] ],
00182     pt[ x.pi[2] ],
00183     pt[ x.pi[3] ]
00184   );
00185 
00186   // Is the point inside the tetrahedron?
00187   if (tp.isInside(target))
00188   {
00189     insidetetrahedron=true;
00190 
00191     return true;
00192   }
00193 
00194   for ( uint i=0; i<4; ++i )
00195   {
00196     // Is the target viewable?
00197     if (tp.hi[i].isInside(target))
00198     {
00199       if(x.ni[i]==0)
00200       {
00201         viewableface=i;
00202         return true;
00203       }
00204 
00205       // Move
00206       cp = x.ni[i];
00207 
00208       return false;
00209       //i=4; // exit loop
00210     }
00211   }
00212 
00213   assert(false);
00214 
00215   return false;
00216 }

ostream & d4tess::print ( ostream os  )  const

Definition at line 363 of file d4tess.cpp.

References pt, SHOW, and vi.

Referenced by operator<<().

00364 {
00365   uintc ptsz = pt.size();
00366   os << SHOW(ptsz) << "\n";
00367 
00368   for (uint i=1; i<ptsz; ++i)
00369   {
00370     os << setw(2) << i;
00371     os << "  " << pt[i] << "\n";
00372   }
00373 
00374   uintc visz = vi.size();
00375   os << SHOW(visz) << "\n";
00376   for (uint i=1; i<visz; ++i)
00377   {
00378     os << setw(2) << i;
00379     os << "  " << vi[i] << "\n";
00380   }
00381      
00382   return os;
00383 }

void d4tess::reset (  ) 

Definition at line 1025 of file d4tess.cpp.

References cp, pt, and vi.

Referenced by d4tess().

01026 {
01027   pt.clear();
01028   vi.clear();
01029 
01030   pt.push_back( pt4(0.0,0.0,0.0,0.0) );
01031   vi.push_back( d4tri() );
01032 
01033   cp=1;
01034 }

boolc d4tess::rotateaboutaxis ( uint steps  ) 

Definition at line 652 of file d4tess.cpp.

References cp, and tetmovedown().

Referenced by keyboard(), and tet2to3Inverse().

00653 {
00654   steps=0;
00655 
00656   uint cp0 = cp;
00657 
00658   if (tetmovedown()==false)
00659     return false; 
00660 
00661   steps=1;
00662 
00663   for(;cp!=cp0; ++steps)
00664   {
00665     if (tetmovedown()==false)
00666       return false;
00667   }
00668 
00669   return true;
00670 }

boolc d4tess::searchinsidemesh ( uint viewableface,
uintc  p 
)

Definition at line 134 of file d4tess.cpp.

References virtualtetrahedron::left(), move_terminated(), virtualtetrahedron::right(), virtualtetrahedron::v, and vs.

Referenced by addpoint(), and keyboard().

00135 {
00136   bool notfound = false;
00137   bool isinside = false;
00138   for ( ; !notfound; )
00139     notfound = move_terminated(isinside,viewableface,p);
00140 
00141   if (isinside==false)
00142   {
00143     if (vs.v[3]!=viewableface)
00144       vs.left();
00145     else
00146       return isinside;
00147 
00148     if (vs.v[3]!=viewableface)
00149       vs.left();
00150     else
00151       return isinside;
00152 
00153     if (vs.v[3]!=viewableface)
00154       vs.right();
00155     else
00156       return isinside;
00157 
00158      
00159     if (vs.v[3]!=viewableface)
00160       assert(false);
00161   }
00162   
00163   return isinside;
00164 }

void d4tess::surfacedown (  ) 

Definition at line 600 of file d4tess.cpp.

References virtualtetrahedron::anticlockwise(), virtualtetrahedron::right(), tetmovedown(), and vs.

Referenced by d4fan::eval(), keyboard(), surfaceleft(), and surfaceright().

00601 {
00602   for ( ; tetmovedown(); );
00603 
00604   vs.right();
00605   vs.right();
00606   vs.anticlockwise();
00607 }

void d4tess::surfaceleft (  ) 

Definition at line 609 of file d4tess.cpp.

References virtualtetrahedron::clockwise(), surfacedown(), and vs.

Referenced by d4fan::eval(), and keyboard().

00610 {
00611   vs.clockwise();
00612   surfacedown();
00613 }

void d4tess::surfaceright (  ) 

Definition at line 615 of file d4tess.cpp.

References virtualtetrahedron::anticlockwise(), surfacedown(), and vs.

Referenced by keyboard().

00616 {
00617   vs.anticlockwise();
00618   surfacedown();
00619 }

boolc d4tess::surfaceviewable ( uintc  k  )  const

Definition at line 102 of file d4tess.cpp.

References cp, halfspaceD3< PT, PD >::isInside(), pt, virtualtetrahedron::v, vi, and vs.

Referenced by d4fan::eval().

00103 {
00104   //d3halfspace<double> h
00105   halfspaceD3< pt4, double > h
00106   (
00107     pt[ vi[cp].pi[ vs.v[0] ] ],
00108     pt[ vi[cp].pi[ vs.v[1] ] ],
00109     pt[ vi[cp].pi[ vs.v[2] ] ]
00110   );
00111 
00112 assert(false);  // changed halfspace code.
00113   return h.isInside(pt[w]); 
00114 //  return h.eval(pt[w]);
00115 }

boolc d4tess::tet2to3 (  ) 

Definition at line 774 of file d4tess.cpp.

References cp, d4tri::ni, tet2to3_(), virtualtetrahedron::v, vi, and vs.

00775 {
00776   d4tri & x(vi[cp]);
00777   uint b = x.ni[vs.v[3]];
00778 
00779   return tet2to3_(cp,b);
00780 }

boolc d4tess::tet2to3 ( uintc  a,
uintc  b 
)

Definition at line 866 of file d4tess.cpp.

References debugcheck(), d4tri::getclockwiseface(), isconvex(), d4tri::ni, d4tri::niInverse(), d4tri::pi, d4tri::piInverse(), and vi.

Referenced by d4mingreedy2::eval(), and keyboard().

00867 {
00868 //assert(false);
00869   assert(a<vi.size());
00870   assert(b<vi.size());
00871 
00872   //messageglobal() << "a=" << a << " b=" << b << " convex " << isconvex(a,b) << "\n";
00873 
00874   if (isconvex(a,b)==false)
00875     return false;
00876 
00877   uint aj[5];
00878 
00879   d4tri const A(vi[a]);
00880   aj[0] = A.niInverse(b);
00881 
00882   d4tri const B(vi[b]);
00883   aj[4] = B.niInverse(a);
00884 
00885   A.getclockwiseface(aj[1],aj[2],aj[3],aj[0]);
00886 
00887   uint pj[5];
00888   for (uint i=0; i<4; ++i)
00889     pj[i] = A.pi[aj[i]];
00890   pj[4] = B.pi[aj[4]];
00891 
00892 /*
00893 for (uint i=0; i<5; ++i)
00894   messageglobal() << "aj[" << i << "]=" << aj[i] << " ";
00895 messageglobal() << "\n";
00896 for (uint i=0; i<5; ++i)
00897   messageglobal() << "pj[" << i << "]=" << pj[i] << " ";
00898 messageglobal() << "\n";
00899 */
00900 
00901 
00902 
00903   // nj[0] is ignored.
00904   // the indexes correspond with the points : the neighbour is opposite the point
00905   // with the same index.  For neighbours >3 simply subtract 3 and that is the
00906   // index for the second tetrahedron.
00907   uint nj[7];
00908   
00909   for (uint i=1; i<=3; ++i)
00910     nj[i] = A.ni[aj[i]];
00911 
00912   for (uint i=4; i<=6; ++i)
00913     nj[i] = B.ni[ B.piInverse(pj[i-3]) ];
00914 
00915 //for (uint i=1; i<=6; ++i)
00916 //  messageglobal() << "nj[" << i << "]=" << nj[i] << " ";
00917 //messageglobal() << "\n";
00918 
00919   uint k1(a), k2(b), k3(vi.size());
00920 
00921   vi[a] = d4tri( pj[0],pj[4],pj[2],pj[3], nj[4],nj[1],k3,k2 );
00922   vi[b] = d4tri( pj[4],pj[0],pj[2],pj[1], nj[3],nj[6],k3,k1 );
00923   vi.push_back( d4tri( pj[4],pj[0],pj[1],pj[3], nj[2],nj[5],k1,k2 ) );
00924 
00925   if (nj[1]!=0)
00926     vi[nj[1]].niReset(a,k1);
00927   if (nj[2]!=0)
00928     vi[nj[2]].niReset(a,k3);
00929   if (nj[3]!=0)
00930     vi[nj[3]].niReset(a,k2);
00931   if (nj[4]!=0)
00932     vi[nj[4]].niReset(b,k1);
00933   if (nj[5]!=0)
00934     vi[nj[5]].niReset(b,k3);
00935   if (nj[6]!=0)
00936     vi[nj[6]].niReset(b,k2);
00937 
00938   debugcheck();
00939 
00940   return true;
00941 }

boolc d4tess::tet2to3_ ( uintc  k1,
uintc  k2 
)

Definition at line 785 of file d4tess.cpp.

References d4tri::construct(), cp, d4tri::getanticlockwiseface(), isconvex(), d4tri::ni, d4tri::niInverse(), d4tri::pi, d4tri::piInverse(), and vi.

Referenced by d4mingreedy::eval(), and tet2to3().

00786 {
00787   uintc z = vi.size();
00788   assert(k1<z);
00789   assert(k2<z);
00790 
00791   if ((k1==0)||(k2==0))
00792     return false;
00793 
00794 
00795 /*
00796 if (isconvex(k1,k2))
00797   messageglobal() << "convex " << k1 << " " << k2 << "\n";
00798 */
00799 
00800 
00801   if (isconvex(k1,k2)==false)
00802     return false;
00803 
00804   uint p[5];
00805   uint n[6];
00806   uint u[3];
00807 
00808   d4tri const & K1(vi[k1]);
00809   d4tri const & K2(vi[k2]);
00810 
00811   uintc k1i = K1.niInverse(k2);
00812   uintc k2i = K2.niInverse(k1);
00813   
00814   p[4] = K2.pi[k2i];
00815   p[0] = K1.pi[k1i];
00816 
00817 
00818   K2.getanticlockwiseface( u[0],u[1],u[2], k2i );
00819   for (uint i=0; i<3; ++i)
00820     p[i+1] = K2.pi[u[i]]; 
00821 
00822 //  n[3] = K2.ni[ u[2] ];
00823 //  n[4] = K2.ni[ u[0] ];
00824 //  n[5] = K2.ni[ u[1] ];
00825 
00826   n[3] = K2.ni[ K2.piInverse(p[3]) ];
00827   n[4] = K2.ni[ K2.piInverse(p[1]) ];
00828   n[5] = K2.ni[ K2.piInverse(p[2]) ];
00829 
00830   n[0] = K1.ni[ K1.piInverse(p[3]) ];
00831   n[1] = K1.ni[ K1.piInverse(p[1]) ];
00832   n[2] = K1.ni[ K1.piInverse(p[2]) ];
00833   
00834   d4tri a[3];
00835 
00836   a[0].construct( p[4],p[0],p[2],p[1],  n[0],n[3],z+2,z+1 ); 
00837   a[1].construct( p[0],p[4],p[2],p[3],  n[4],n[1],z+2,z ); 
00838   //a[2].construct( p[0],p[4],p[1],p[3],  n[5],n[2],z+1,z ); 
00839   a[2].construct( p[0],p[4],p[3],p[1],  n[5],n[2],z,z+1 ); 
00840 
00841   for (uint i=0; i<3; ++i)
00842     vi.push_back(a[i]);
00843 
00844   if( n[0]!=0)
00845     vi[n[0]].niReset(k1,z);
00846   if( n[3]!=0)
00847     vi[n[3]].niReset(k2,z);
00848   if( n[1]!=0)
00849     vi[n[1]].niReset(k1,z+1);
00850   if( n[4]!=0)
00851     vi[n[4]].niReset(k2,z+1);
00852   if( n[2]!=0)
00853     vi[n[2]].niReset(k1,z+2);
00854   if( n[5]!=0)
00855     vi[n[5]].niReset(k2,z+2);
00856 
00857   vi[k1].setnull();
00858   vi[k2].setnull();
00859 
00860   cp = z;
00861 
00862   return true;
00863 }

boolc d4tess::tet2to3Inverse (  ) 

Definition at line 943 of file d4tess.cpp.

References cp, debugcheck(), messageglobal(), rotateaboutaxis(), tetmovedown(), virtualtetrahedron::v, vi, and vs.

Referenced by keyboard().

00944 {
00945   uint steps;
00946   if (rotateaboutaxis(steps)==false)
00947     return false;
00948 
00949   if (steps!=3)
00950     return false;
00951 
00952   uint p[5];
00953   uint a[3];
00954   uint n[6];
00955 
00956   p[0] = vi[cp].pi[ vs.v[0] ];
00957   p[4] = vi[cp].pi[ vs.v[1] ];
00958 
00959   for (uint i=0; i<3; ++i)
00960   {
00961     a[i] = cp;
00962     p[i+1] = vi[cp].pi[ vs.v[2] ];
00963 
00964     n[i]   = vi[cp].ni[ vs.v[1] ];
00965     n[i+3] = vi[cp].ni[ vs.v[0] ];
00966 
00967     tetmovedown();
00968   }
00969 
00970   messageglobal() << "p[i]: ";
00971   for (uint i=0; i<5; ++i)
00972     messageglobal() << p[i] << " ";
00973   messageglobal() << "\n";
00974 
00975   messageglobal() << "n[i] ";
00976   for (uint i=0; i<6; ++i)
00977     messageglobal() << n[i] << " ";
00978   messageglobal() << "\n";
00979 
00980   messageglobal() << "a[i]" << "\n";
00981   for (uint i=0; i<3; ++i)
00982     messageglobal() << a[i] << ": " << vi[a[i]] << "\n";
00983   messageglobal() << "\n";
00984 
00985   uint k = vi.size();
00986   d4tri k1(p[1],p[3],p[2],p[0], n[1],n[0],n[2],k+1); 
00987   d4tri k2(p[1],p[2],p[3],p[4], n[4],n[5],n[3],k); 
00988 
00989   messageglobal() << "k1: " << k1 << "\n";
00990   messageglobal() << "k2: " << k2 << "\n";
00991 
00992   vi.push_back(k1);
00993   vi.push_back(k2);
00994 
00995   for (uint i=0; i<3; ++i)
00996     vi[a[0]] = vi[0];
00997 
00998   for (uint i=0; i<3; ++i)
00999   {
01000     if (n[i]!=0)
01001       vi[n[i]].niReset(a[i],k);
01002 
01003     if (n[i+3]!=0)
01004       vi[n[i+3]].niReset(a[i],k+1);
01005 
01006     vi[a[i]].setnull();
01007   }
01008 
01009   cp = k;
01010 
01011   debugcheck();
01012 
01013 
01014   // Rotating about an axis with three tetrahedrons
01015   // is always a convex shape.
01016   return true;
01017 }

boolc d4tess::tetmovedown (  ) 

Definition at line 496 of file d4tess.cpp.

References cp, d4tri::ni, d4tri::niInverse(), d4tri::pi, d4tri::piInverse(), virtualtetrahedron::set(), virtualtetrahedron::v, vi, and vs.

Referenced by keyboard(), rotateaboutaxis(), surfacedown(), and tet2to3Inverse().

00497 {
00498   d4tri const & x(vi[cp]);
00499 
00500   uint cp2 = x.ni[ vs.v[2] ];
00501   if (cp2==0)
00502     return false;
00503 
00504   d4tri const &  y(vi[cp2]);
00505 
00506   uint a = y.piInverse( x.pi[vs.v[0]] );
00507   uint b = y.piInverse( x.pi[vs.v[1]] );
00508   uint c = y.piInverse( x.pi[vs.v[3]] );
00509   uint d = y.niInverse(cp);
00510 
00511   vs.set(a,b,c,d);
00512 
00513   cp = cp2;
00514 
00515   return true;
00516 }

boolc d4tess::tetmoveleft (  ) 

Definition at line 567 of file d4tess.cpp.

References cp, messageglobal(), d4tri::ni, d4tri::niInverse(), d4tri::pi, d4tri::piInverse(), virtualtetrahedron::set(), virtualtetrahedron::v, vi, and vs.

Referenced by keyboard().

00568 {
00569   d4tri const & x(vi[cp]);
00570 messageglobal() << x << "\n";
00571 
00572   uint cp2 = x.ni[ vs.v[1] ];
00573 messageglobal() << "cp2=" << cp2 << "\n";
00574   if (cp2==0)
00575     return false;
00576 
00577   d4tri const &  y(vi[cp2]);
00578 
00579 messageglobal() << y << "\n";
00580 
00581   uint a = y.piInverse( x.pi[vs.v[2]] );
00582   uint b = y.piInverse( x.pi[vs.v[0]] );
00583   uint c = y.piInverse( x.pi[vs.v[3]] );
00584   uint d = y.niInverse(cp);
00585 
00586 
00587   messageglobal() << "a=" << a << " ";
00588   messageglobal() << "b=" << b << " ";
00589   messageglobal() << "c=" << c << " ";
00590   messageglobal() << "d=" << d << " ";
00591   messageglobal() << "\n";
00592 
00593   vs.set(a,b,c,d);
00594 
00595   cp = cp2;
00596 
00597   return true;
00598 }

boolc d4tess::tetmoveright (  ) 

Definition at line 532 of file d4tess.cpp.

References cp, messageglobal(), d4tri::ni, d4tri::niInverse(), d4tri::pi, d4tri::piInverse(), virtualtetrahedron::set(), virtualtetrahedron::v, vi, and vs.

Referenced by keyboard().

00533 {
00534   d4tri const & x(vi[cp]);
00535 messageglobal() << x << "\n";
00536 
00537 messageglobal() << "vs.v[0]" << vs.v[0] << "\n";
00538 
00539   uint cp2 = x.ni[ vs.v[0] ];
00540 messageglobal() << "cp2=" << cp2 << "\n";
00541   if (cp2==0)
00542     return false;
00543 
00544   d4tri const &  y(vi[cp2]);
00545 
00546 messageglobal() << y << "\n";
00547 
00548   uint a = y.piInverse( x.pi[vs.v[1]] );
00549   uint b = y.piInverse( x.pi[vs.v[2]] );
00550   uint c = y.piInverse( x.pi[vs.v[3]] );
00551   uint d = y.niInverse(cp);
00552 
00553 
00554   messageglobal() << "a=" << a << " ";
00555   messageglobal() << "b=" << b << " ";
00556   messageglobal() << "c=" << c << " ";
00557   messageglobal() << "d=" << d << " ";
00558   messageglobal() << "\n";
00559 
00560   vs.set(a,b,c,d);
00561 
00562   cp = cp2;
00563 
00564   return true;
00565 }

boolc d4tess::valid ( uintc  k  )  const

Definition at line 386 of file d4tess.cpp.

References vi.

00387 {
00388   if (k>=vi.size())
00389     return false;
00390 
00391   if (vi[k].isnull())
00392     return true;
00393 
00394   // Look at each neighbour for links.
00395   for (uint i=0, nb; i<4; ++i)
00396   {
00397     nb = vi[k].ni[i];
00398     if (nb==0)
00399       continue;
00400 
00401     bool res;
00402 
00403     // Each point bordering neighbour must also be one
00404     // of the neighbours own points.
00405     for (uint w=0; w<4; ++w)
00406     {
00407       if (w==i)
00408         continue;
00409 
00410       vi[nb].piInverse( res, vi[k].pi[w] );
00411       if (res==false)
00412         return false;
00413     }
00414 
00415     // The nieghbour must have a pointer back to k.
00416     vi[nb].niInverse( res, k );
00417     if (res==false)
00418       return false;
00419   }
00420 
00421   return true;
00422 }

boolc d4tess::valid (  )  const

Definition at line 426 of file d4tess.cpp.

References vi.

Referenced by debugcheck().

00427 {
00428   bool res(true);
00429 
00430   uintc visz = vi.size();
00431   for (uint i=1; i<visz; ++i)
00432     res &= valid(i);
00433 
00434   return res;
00435 }

void d4tess::viadd ( uintc  v0,
uintc  v1,
uintc  v2,
uintc  v3,
uintc  n0 = 0,
uintc  n1 = 0,
uintc  n2 = 0,
uintc  n3 = 0 
)

Definition at line 70 of file d4tess.cpp.

Referenced by init01(), and init02().

00074 {
00075   vi.push_back( d4tri(v0,v1,v2,v3,n0,n1,n2,n3) );
00076 }


Member Data Documentation

Definition at line 48 of file d4tess.h.

Referenced by addpoint().

Definition at line 52 of file d4tess.h.

Referenced by d4fan::eval(), minimizerSet(), and ~d4tess().

vector<pt4> d4tess::pt

vector<d4tri> d4tess::vi


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

Generated on Fri Mar 4 00:49:54 2011 for Chelton Evans Source by  doxygen 1.5.8