Files Classes Functions Hierarchy
00001 00002 00003 #include <d3minboundary.h> 00004 #include <d3tess.h> 00005 00006 typedef point2<double> pt2; 00007 typedef point3<double> pt3; 00008 00009 #define SHOW(x) #x << '=' << (x) 00010 00011 00012 00013 d3minboundary::d3minboundary(d3tess & _tess) 00014 : d3minoperator(_tess) 00015 { 00016 } 00017 00018 bool const d3minboundary::eval(uintc a, uintc b) 00019 { 00020 //cout << "minb:eval(" << a << "," << b << ")" << endl; 00021 if (tess.isconvex(a,b)==false) 00022 return false; 00023 00024 simplexD2linked const & A(tess.vi[a]); 00025 simplexD2linked const & B(tess.vi[b]); 00026 00027 uint ai = A.niInverse(b); 00028 uint bi = B.niInverse(a); 00029 00030 uint p[4]; 00031 p[0] = A.pi[ai]; 00032 p[3] = B.pi[bi]; 00033 p[1] = A.pi[(ai+1)%3]; 00034 p[2] = A.pi[(ai+2)%3]; 00035 00036 // d1 is the current arrangement 00037 00038 vector<pt3> const & pt(tess.pt); 00039 pt2 D1(pt[p[0]]-pt[p[3]]); 00040 pt2 D2(pt[p[1]]-pt[p[2]]); 00041 00042 double const d1=D1.distance(); 00043 double const d2=D2.distance(); 00044 //cout << SHOW(d1) << " " << SHOW(d2) << endl; 00045 00046 if (d1<d2) 00047 { 00048 //cout << "fliped " << a << "," << b << endl; 00049 tess.flip(a,b); 00050 return true; 00051 } 00052 00053 return false; 00054 } 00055 00056
1.5.8