proj home

Files   Classes   Functions   Hierarchy  

d4minboundary Class Reference

#include <d4minboundary.h>

Inheritance diagram for d4minboundary:
Collaboration diagram for d4minboundary:

List of all members.

Public Member Functions

 d4minboundary (d4tess &_tess)
bool const eval (uintc a, uintc b)


Detailed Description

Definition at line 8 of file d4minboundary.h.


Constructor & Destructor Documentation

d4minboundary::d4minboundary ( d4tess _tess  ) 

Definition at line 30 of file d4minboundary.cpp.

00031   : d4minoperator(_tess)
00032 {
00033 }


Member Function Documentation

bool const d4minboundary::eval ( uintc  a,
uintc  b 
) [virtual]

Reimplemented from d4minoperator.

Definition at line 40 of file d4minboundary.cpp.

References d4tess::debugcheck(), d4tri::getclockwiseface(), d4tess::isconvex(), d4tri::ni, d4tri::niInverse(), d4tri::pi, d4tri::piInverse(), d4tess::pt, SHOW, d4minoperator::tess, trianglearea(), and d4tess::vi.

00041 {
00042 MessageGlobal mg;
00043 
00044   mg() << "a=" << a << " b=" << b << " convex " << tess.isconvex(a,b) << endl;
00045 
00046   if (tess.isconvex(a,b)==false)
00047     return false;
00048 
00049   uint aj[5];
00050 
00051   d4tri const A(tess.vi[a]);
00052   aj[0] = A.niInverse(b);
00053 
00054   d4tri const B(tess.vi[b]);
00055   aj[4] = B.niInverse(a);
00056 
00057   A.getclockwiseface(aj[1],aj[2],aj[3],aj[0]);
00058 
00059   uint pj[5];
00060   for (uint i=0; i<4; ++i)
00061     pj[i] = A.pi[aj[i]];
00062   pj[4] = B.pi[aj[4]];
00063 
00064 for (uint i=0; i<5; ++i)
00065   mg() << "aj[" << i << "]=" << aj[i] << " ";
00066 mg() << endl;
00067 for (uint i=0; i<5; ++i)
00068   mg() << "pj[" << i << "]=" << pj[i] << " ";
00069 mg() << endl;
00070 
00071   // Find which combination of tetrahedrons has 
00072   // the minimal boundary.
00073 
00074   // There are two possible tetrahedron permuations.
00075   // The current on has one inner partition through p0,p1,p2.
00076   //
00077   // The other permutation has three blades off line p0 to p4, to points p1,p2,p3.
00078   //
00079   // Choose the permutation with the minimum boundary area.
00080 
00081   double area1;
00082   trianglearea
00083   (
00084     area1,
00085     tess.pt[pj[1]],
00086     tess.pt[pj[2]],
00087     tess.pt[pj[3]]
00088   );
00089 
00090 mg() << SHOW(area1) << endl;
00091 
00092   double area2=0.0;
00093 
00094   double area;
00095 
00096   for (uint i=1; i<4; ++i)
00097   {
00098     trianglearea
00099     (
00100       area,
00101       tess.pt[pj[4]],
00102       tess.pt[pj[i]],
00103       tess.pt[pj[0]]
00104     );
00105 
00106     area2 += area;
00107   }
00108 
00109 mg() << SHOW(area2) << endl;
00110 
00111   if (area1<area2)
00112     return false;
00113 
00114 mg() << "FUCK" << endl;
00115 
00116 
00117   // nj[0] is ignored.
00118   // the indexes correspond with the points : the neighbour is opposite the point
00119   // with the same index.  For neighbours >3 simply subtract 3 and that is the
00120   // index for the second tetrahedron.
00121   uint nj[7];
00122   
00123   for (uint i=1; i<=3; ++i)
00124     nj[i] = A.ni[aj[i]];
00125 
00126   for (uint i=4; i<=6; ++i)
00127     nj[i] = B.ni[ B.piInverse(pj[i-3]) ];
00128 
00129 for (uint i=1; i<=6; ++i)
00130   mg() << "nj[" << i << "]=" << nj[i] << " ";
00131 mg() << endl;
00132 
00133   uint k1(a), k2(b), k3(tess.vi.size());
00134 
00135   tess.vi[a] = d4tri( pj[4],pj[2],pj[0],pj[3], nj[1],k3,nj[4],k2 );
00136   tess.vi[b] = d4tri( pj[4],pj[0],pj[2],pj[1], nj[3],nj[6],k3,k1 );
00137   tess.vi.push_back( d4tri( pj[4],pj[0],pj[1],pj[3], nj[2],nj[5],k1,k2 ) );
00138 
00139   if (nj[1]!=0)
00140     tess.vi[nj[1]].niReset(a,k1);
00141   if (nj[2]!=0)
00142     tess.vi[nj[2]].niReset(a,k3);
00143   if (nj[3]!=0)
00144     tess.vi[nj[3]].niReset(a,k2);
00145   if (nj[4]!=0)
00146     tess.vi[nj[4]].niReset(b,k1);
00147   if (nj[5]!=0)
00148     tess.vi[nj[5]].niReset(b,k3);
00149   if (nj[6]!=0)
00150     tess.vi[nj[6]].niReset(b,k2);
00151 
00152   tess.debugcheck();
00153 
00154   return true;
00155 }


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