diff --git a/vcg/complex/trimesh/create/advancing_front.h b/vcg/complex/trimesh/create/advancing_front.h deleted file mode 100644 index a0689faf..00000000 --- a/vcg/complex/trimesh/create/advancing_front.h +++ /dev/null @@ -1,551 +0,0 @@ -#ifndef MLS_ADVANCE_H -#define MLS_ADVANCE_H - -#include -#include -#include -#include -#include -#include - -namespace vcg { - namespace tri { - -class FrontEdge { - public: - int v0, v1, v2; //v0, v1 represent the FrontEdge, v2 the other vertex - //in the face this FrontEdge belongs to - int face; //index of the face - bool active; //keep tracks of wether it is in front or in deads - - //the loops in the front are mantained as a double linked list - std::list::iterator next; - std::list::iterator previous; - - FrontEdge() {} - FrontEdge(int _v0, int _v1, int _v2, int _face): - v0(_v0), v1(_v1), v2(_v2), face(_face), active(true) { - assert(v0 != v1 && v1 != v2 && v0 != v2); - } - - const bool operator==(const FrontEdge& f) const - { - return ((v0 == f.v0) && (v1 == f.v1) && (v2 == f.v2) && (face == f.face)); - } -}; - -template class AdvancingFront { - public: - - typedef typename MESH::VertexType VertexType; - typedef typename MESH::FaceType FaceType; - typedef typename MESH::ScalarType ScalarType; - typedef typename MESH::VertexType::CoordType Point3x; - - //class FrontEdgeLists - //{ - - //}; - - -// protected: - std::list front; - std::list deads; - std::vector nb; //number of fronts a vertex is into, - //this is used for the Visited and Border flags - //but adding topology may not be needed anymore - - public: - - MESH &mesh; //this structure will be filled by the algorithm - - AdvancingFront(MESH &_mesh): mesh(_mesh) { - - - UpdateFlags::FaceBorderFromNone(mesh); - UpdateFlags::VertexBorderFromFace(mesh); - - nb.clear(); - nb.resize(mesh.vert.size(), 0); - - CreateLoops(); - } - virtual ~AdvancingFront() {} - virtual ScalarType radi() { return 0; } - - void BuildMesh(CallBackPos call = NULL, int interval = 512) { - float finalfacesext = mesh.vert.size() * 2.0f; - if(call) call(0, "Advancing front"); - while(1) { - - for(int i = 0; i < interval; i++) { - if(!front.size() && !SeedFace()) return; - AddFace(); - if(call) - { - float rap = float(mesh.face.size()) / finalfacesext; - int perc = (int) (100.0f * rap); - (*call)(perc,"Adding Faces"); - } - } - } - } - -protected: - //Implement these functions in your subclass - enum ListID {FRONT,DEADS}; - typedef std::pair< ListID,std::list::iterator > ResultIterator; - virtual bool Seed(int &v0, int &v1, int &v2) = 0; - virtual int Place(FrontEdge &e, ResultIterator &touch) = 0; - - bool CheckFrontEdge(int v0, int v1) { - int tot = 0; - //HACK to speed up things until i can use a seach structure -// int i = mesh.face.size() - 4*(front.size()); -// if(front.size() < 100) i = mesh.face.size() - 100; - int i = 0; - if(i < 0) i = 0; - for(; i < (int)mesh.face.size(); i++) { - FaceType &f = mesh.face[i]; - for(int k = 0; k < 3; k++) { - if(v1== (int)f.V(k) && v0 == (int)f.V((k+1)%3)) ++tot; - else if(v0 == (int)f.V(k) && v1 == (int)f.V((k+1)%3)) { //orientation non constistent - return false; - } - } - if(tot >= 2) { //non manifold - return false; - } - } - return true; - } - - //create the FrontEdge loops from seed faces - void CreateLoops() { - VertexType *start = &*mesh.vert.begin(); - for(int i = 0; i < (int)mesh.face.size(); i++) { - FaceType &f = mesh.face[i]; - if(f.IsD()) continue; - - for(int k = 0; k < 3; k++) { - if(f.IsB(k)) { - NewEdge(FrontEdge(f.V0(k) - start, f.V1(k) - start, f.V2(k) - start, i)); - nb[f.V0(k)-start]++; - } - } - } - - for(std::list::iterator s = front.begin(); s != front.end(); s++) { - (*s).previous = front.end(); - (*s).next = front.end(); - } - //now create loops: - for(std::list::iterator s = front.begin(); s != front.end(); s++) { - for(std::list::iterator j = front.begin(); j != front.end(); j++) { - if(s == j) continue; - if((*s).v1 != (*j).v0) continue; - if((*j).previous != front.end()) continue; - (*s).next = j; - (*j).previous = s; - break; - } - } - for(std::list::iterator s = front.begin(); s != front.end(); s++) { - assert((*s).next != front.end()); - assert((*s).previous != front.end()); - } - } - - bool SeedFace() { - int v[3]; - bool success = Seed(v[0], v[1], v[2]); - if(!success) return false; - - nb.resize(mesh.vert.size(), 0); - - //create the border of the first face - std::list::iterator e = front.end(); - std::list::iterator last = e; - std::list::iterator first; - - for(int i = 0; i < 3; i++) { - int v0 = v[i]; - int v1 = v[((i+1)%3)]; - int v2 = v[((i+2)%3)]; - - mesh.vert[v0].SetB(); - nb[v[i]]++; - - e = front.insert(front.begin(), FrontEdge(v0, v1, v2, mesh.face.size())); - if(i != 0) { - (*last).next = e; - (*e).previous = last; - } else - first = e; - - last = e; - } - //connect last and first - (*last).next = first; - (*first).previous = last; - - AddFace(v[0], v[1], v[2]); - return true; - } - -public: - bool AddFace() { - if(!front.size()) return false; - - std::list::iterator ei = front.begin(); - FrontEdge ¤t = *ei; - FrontEdge &previous = *current.previous; - FrontEdge &next = *current.next; - - int v0 = current.v0, v1 = current.v1; - assert(nb[v0] < 10 && nb[v1] < 10); - - ResultIterator touch; - touch.first = FRONT; - touch.second = front.end(); - int v2 = Place(current, touch); - - if(v2 == -1) { - KillEdge(ei); - return false; - } - - assert(v2 != v0 && v2 != v1); - - if ((touch.first == FRONT) && (touch.second != front.end()) || - (touch.first == DEADS) && (touch.second != deads.end())) - - { - //check for orientation and manifoldness - - //touch == current.previous? - if(v2 == previous.v0) { - if(!CheckEdge(v2, v1)) { - KillEdge(ei); - return false; - } - /*touching previous FrontEdge (we reuse previous) - next - ------->v2 -----> v1------> - \ / - \ / - previous \ / current - \ / - v0 */ - - Detach(v0); - - std::list::iterator up = NewEdge(FrontEdge(v2, v1, v0, mesh.face.size())); - MoveFront(up); - (*up).previous = previous.previous; - (*up).next = current.next; - (*previous.previous).next = up; - next.previous = up; - Erase(current.previous); - Erase(ei); - Glue(up); - - //touch == (*current.next).next - } else if(v2 == next.v1) { - if(!CheckEdge(v0, v2)) { - KillEdge(ei); - return false; - } - /*touching next FrontEdge (we reuse next) - previous - ------->v0 -----> v2------> - \ / - \ / - \ / next - \ / - v1 */ - - Detach(v1); - std::list::iterator up = NewEdge(FrontEdge(v0, v2, v1, mesh.face.size())); - MoveFront(up); - (*up).previous = current.previous; - (*up).next = (*current.next).next; - previous.next = up; - (*next.next).previous = up; - Erase(current.next); - Erase(ei); - Glue(up); - } else { - if(!CheckEdge(v0, v2) || !CheckEdge(v2, v1)) { - KillEdge(ei); - return false; - } - //touching some loop: split (or merge it is local does not matter. - //like this - /* - left right - <--------v2-<------ - /|\ - / \ - up / \ down - / \ - / V - ----v0 - - - > v1--------- - current */ - std::list::iterator left = touch.second; - std::list::iterator right = (*touch.second).previous; - - //this would be a really bad join - if(v1 == (*right).v0 || v0 == (*left).v1) { - KillEdge(ei); - return false; - } - - nb[v2]++; - - std::list::iterator down = NewEdge(FrontEdge(v2, v1, v0, mesh.face.size())); - std::list::iterator up = NewEdge(FrontEdge(v0, v2, v1, mesh.face.size())); - - (*right).next = down; - (*down).previous = right; - - (*down).next = current.next; - next.previous = down; - - (*left).previous = up; - (*up).next = left; - - (*up).previous = current.previous; - previous.next = up; - Erase(ei); - } - - - } - else if ((touch.first == FRONT) && (touch.second == front.end()) || - (touch.first == DEADS) && (touch.second == deads.end())) - { -// assert(CheckEdge(v0, v2)); -// assert(CheckEdge(v2, v1)); - /* adding a new vertex - - v2 - /|\ - / \ - up / \ down - / \ - / V - ----v0 - - - > v1--------- */ - assert(!mesh.vert[v2].IsB()); //fatal error! a new point is already a border? - nb[v2]++; - mesh.vert[v2].SetB(); - - std::list::iterator down = NewEdge(FrontEdge(v2, v1, v0, mesh.face.size())); - std::list::iterator up = NewEdge(FrontEdge(v0, v2, v1, mesh.face.size())); - - (*down).previous = up; - (*up).next = down; - (*down).next = current.next; - next.previous = down; - (*up).previous = current.previous; - previous.next = up; - Erase(ei); - } - - AddFace(v0, v2, v1); - return false; - } - -protected: - void AddFace(int v0, int v1, int v2) { - assert(v0 < (int)mesh.vert.size() && v1 < (int)mesh.vert.size() && v2 < (int)mesh.vert.size()); - FaceType face; - face.V(0) = &mesh.vert[v0]; - face.V(1) = &mesh.vert[v1]; - face.V(2) = &mesh.vert[v2]; - ComputeNormalizedNormal(face); - mesh.face.push_back(face); - mesh.fn++; - } - - void AddVertex(VertexType &vertex) { - VertexType *oldstart = NULL; - if(mesh.vert.size()) oldstart = &*mesh.vert.begin(); - mesh.vert.push_back(vertex); - mesh.vn++; - VertexType *newstart = &*mesh.vert.begin(); - if(oldstart && oldstart != newstart) { - for(int i = 0; i < mesh.face.size(); i++) { - FaceType &face = mesh.face[i]; - for(int k = 0; k < 3; k++) - face.V(k) = newstart + (face.V(k) - oldstart); - } - } - nb.push_back(0); - } - - - bool CheckEdge(int v0, int v1) { - int tot = 0; - //HACK to speed up things until i can use a seach structure -/* int i = mesh.face.size() - 4*(front.size()); - if(front.size() < 100) i = mesh.face.size() - 100; - if(i < 0) i = 0;*/ - VertexType *vv0 = &(mesh.vert[v0]); - VertexType *vv1 = &(mesh.vert[v1]); - - for(int i = 0; i < (int)mesh.face.size(); i++) { - FaceType &f = mesh.face[i]; - for(int k = 0; k < 3; k++) { - if(vv0 == f.V0(k) && vv1 == f.V1(k)) //orientation non constistent - return false; - else if(vv1 == f.V0(k) && vv0 == f.V1(k)) ++tot; - } - if(tot >= 2) { //non manifold - return false; - } - } - return true; - } - //front management: - - //Add a new FrontEdge to the back of the queue - std::list::iterator NewEdge(FrontEdge e) { - return front.insert(front.end(), e); - } - - //move an Edge among the dead ones - void KillEdge(std::list::iterator e) - { - if (e->active) - { - (*e).active = false; - //std::list::iterator res = std::find(front.begin(),front.end(),e); - FrontEdge tmp = *e; - deads.splice(deads.end(), front, e); - std::list::iterator newe = std::find(deads.begin(),deads.end(),tmp); - tmp.previous->next = newe; - tmp.next->previous = newe; - } - - } - - void Erase(std::list::iterator e) { - if((*e).active) front.erase(e); - else deads.erase(e); - } - - //move an FrontEdge to the back of the queue - void MoveBack(std::list::iterator e) { - front.splice(front.end(), front, e); - } - - void MoveFront(std::list::iterator e) { - front.splice(front.begin(), front, e); - } - - //check if e can be sewed with one of oits neighbours - bool Glue(std::list::iterator e) { - return Glue((*e).previous, e) || Glue(e, (*e).next); - } - - //Glue toghether a and b (where a.next = b - bool Glue(std::list::iterator a, std::list::iterator b) { - if((*a).v0 != (*b).v1) return false; - - std::list::iterator previous = (*a).previous; - std::list::iterator next = (*b).next; - (*previous).next = next; - (*next).previous = previous; - Detach((*a).v1); - Detach((*a).v0); - Erase(a); - Erase(b); - return true; - } - - void Detach(int v) { - assert(nb[v] > 0); - if(--nb[v] == 0) { - mesh.vert[v].ClearB(); - } - } -}; - -template class AdvancingTest: public AdvancingFront { - public: - typedef typename MESH::VertexType VertexType; - typedef typename MESH::VertexIterator VertexIterator; - typedef typename MESH::FaceType FaceType; - typedef typename MESH::FaceIterator FaceIterator; - - typedef typename MESH::ScalarType ScalarType; - typedef typename MESH::VertexType::CoordType Point3x; - - AdvancingTest(MESH &_mesh): AdvancingFront(_mesh) {} - - bool Seed(int &v0, int &v1, int &v2) { - VertexType v[3]; - v[0].P() = Point3x(0, 0, 0); - v[1].P() = Point3x(1, 0, 0); - v[2].P() = Point3x(0, 1, 0); - v[0].ClearFlags(); - v[1].ClearFlags(); - v[2].ClearFlags(); - - v0 = this->mesh.vert.size(); - AddVertex(v[0]); - v1 = this->mesh.vert.size(); - AddVertex(v[1]); - v2 = this->mesh.vert.size(); - AddVertex(v[2]); - return true; - } - - int Place(FrontEdge &e, typename AdvancingFront::ResultIterator &touch) - { - Point3f p[3]; - p[0] = this->mesh.vert[e.v0].P(); - p[1] = this->mesh.vert[e.v1].P(); - p[2] = this->mesh.vert[e.v2].P(); - Point3f point = p[0] + p[1] - p[2]; - - int vn = this->mesh.vert.size(); - for(int i = 0; i < this->mesh.vert.size(); i++) - { - if((this->mesh.vert[i].P() - point).Norm() < 0.1) - { - vn = i; - //find the border - assert(this->mesh.vert[i].IsB()); - for(std::list::iterator k = this->front.begin(); k != this->front.end(); k++) - if((*k).v0 == i) - { - touch.first = AdvancingFront::FRONT; - touch.second = k; - } - - for(std::list::iterator k = this->deads.begin(); k != this->deads.end(); k++) - if((*k).v0 == i) - if((*k).v0 == i) - { - touch.first = AdvancingFront::FRONT; - touch.second = k; - } - break; - } - } - if(vn == this->mesh.vert.size()) { - VertexType v; - v.P() = point; - v.ClearFlags(); - AddVertex(v); - } - return vn; - } -}; - -}//namespace tri -}//namespace vcg - -#endif diff --git a/vcg/complex/trimesh/create/ball_pivoting.h b/vcg/complex/trimesh/create/ball_pivoting.h deleted file mode 100644 index 6f71693e..00000000 --- a/vcg/complex/trimesh/create/ball_pivoting.h +++ /dev/null @@ -1,418 +0,0 @@ -#ifndef BALL_PIVOTING_H -#define BALL_PIVOTING_H - -#include "advancing_front.h" -#include -#include - -/* Ball pivoting algorithm: - 1) the vertices used in the new mesh are marked as visited - 2) the border vertices of the new mesh are marked as border - 3) the vector nb is used to keep track of the number of borders a vertex belongs to - 4) usedBit flag is used to select the points in the mesh already processed - -*/ -namespace vcg { - namespace tri { - -template class BallPivoting: public AdvancingFront { - public: - typedef typename MESH::VertexType VertexType; - typedef typename MESH::FaceType FaceType; - typedef typename MESH::ScalarType ScalarType; - typedef typename MESH::VertexIterator VertexIterator; - typedef typename MESH::VertexType::CoordType Point3x; - typedef GridStaticPtr StaticGrid; - - float radius; //radius of the ball - float min_edge; //min lenght of an edge - float max_edge; //min lenght of an edge - float max_angle; //max angle between 2 faces (cos(angle) actually) - - public: - ScalarType radi() { return radius; } - - // if radius ==0 an autoguess for the ball pivoting radius is attempted - // otherwise the passed value (in absolute mesh units) is used. - - BallPivoting(MESH &_mesh, float _radius = 0, - float minr = 0.2, float angle = M_PI/2): - - AdvancingFront(_mesh), radius(_radius), - min_edge(minr), max_edge(1.8), max_angle(cos(angle)), - last_seed(-1) { - - //compute bbox - baricenter = Point3x(0, 0, 0); - UpdateBounding::Box(_mesh); - for(VertexIterator vi=this->mesh.vert.begin();vi!=this->mesh.vert.end();++vi) - if( !(*vi).IsD() ) baricenter += (*vi).P(); - - baricenter /= this->mesh.vn; - - assert(this->mesh.vn > 3); - if(radius == 0) // radius ==0 means that an auto guess should be attempted. - radius = sqrt((this->mesh.bbox.Diag()*this->mesh.bbox.Diag())/this->mesh.vn); - - - min_edge *= radius; - max_edge *= radius; - - //enlarging the bbox for out-of-box queries - Box3 BPbbox=this->mesh.bbox; - BPbbox.Offset(4*radius); - grid.Set(this->mesh.vert.begin(), this->mesh.vert.end(), BPbbox); - - //mark visited points - std::vector targets; - std::vector points; - std::vector dists; - - usedBit = VertexType::NewBitFlag(); - for(int i = 0; i < (int)this->mesh.vert.size(); i++) - this->mesh.vert[i].ClearUserBit(usedBit); - - UpdateFlags::VertexClearV(this->mesh); - - for(int i = 0; i < (int)this->mesh.face.size(); i++) { - FaceType &f = this->mesh.face[i]; - if(f.IsD()) continue; - for(int k = 0; k < 3; k++) { - f.V(k)->SetV(); - int n = tri::GetInSphereVertex(this->mesh, grid, f.V(k)->P(), min_edge, targets, dists, points); - for(int t = 0; t < n; t++) { - targets[t]->SetUserBit(usedBit); - assert(targets[t]->IsUserBit(usedBit)); - } - assert(f.V(k)->IsUserBit(usedBit)); - } - } - } - - ~BallPivoting() { - VertexType::DeleteBitFlag(usedBit); - } - - bool Seed(int &v0, int &v1, int &v2) { - //get a sphere of neighbours - std::vector targets; - std::vector points; - std::vector dists; - while(++last_seed < (int)(this->mesh.vert.size())) { - VertexType &seed = this->mesh.vert[last_seed]; - if(seed.IsD() || seed.IsUserBit(usedBit)) continue; - - seed.SetUserBit(usedBit); - - int n = tri::GetInSphereVertex(this->mesh, grid, seed.P(), 2*radius, targets, dists, points); - if(n < 3) { - continue; - } - - bool success = true; - //find the closest visited or boundary - for(int i = 0; i < n; i++) { - VertexType &v = *(targets[i]); - if(v.IsV()) { - success = false; - break; - } - } - if(!success) continue; - - VertexType *vv0, *vv1, *vv2; - success = false; - //find a triplet that does not contains any other point - Point3x center; - for(int i = 0; i < n; i++) { - vv0 = targets[i]; - if(vv0->IsD()) continue; - Point3x &p0 = vv0->P(); - - for(int k = i+1; k < n; k++) { - vv1 = targets[k]; - if(vv1->IsD()) continue; - Point3x &p1 = vv1->P(); - float d2 = (p1 - p0).Norm(); - if(d2 < min_edge || d2 > max_edge) continue; - - for(int j = k+1; j < n; j++) { - vv2 = targets[j]; - if(vv2->IsD()) continue; - Point3x &p2 = vv2->P(); - float d1 = (p2 - p0).Norm(); - if(d1 < min_edge || d1 > max_edge) continue; - float d0 = (p2 - p1).Norm(); - if(d0 < min_edge || d0 > max_edge) continue; - - Point3x normal = (p1 - p0)^(p2 - p0); - if(normal.dot(p0 - baricenter) < 0) continue; -/* if(use_normals) { - if(normal * vv0->N() < 0) continue; - if(normal * vv1->N() < 0) continue; - if(normal * vv2->N() < 0) continue; - }*/ - - if(!FindSphere(p0, p1, p2, center)) { - continue; - } - - //check no other point inside - int t; - for(t = 0; t < n; t++) { - if((center - targets[t]->P()).Norm() <= radius) - break; - } - if(t < n) { - continue; - } - - //check on the other side there is not a surface - Point3x opposite = center + normal*(((center - p0).dot(normal))*2/normal.SquaredNorm()); - for(t = 0; t < n; t++) { - VertexType &v = *(targets[t]); - if((v.IsV()) && (opposite - v.P()).Norm() <= radius) - break; - } - if(t < n) { - continue; - } - success = true; - i = k = j = n; - } - } - } - - if(!success) { //see bad luck above - continue; - } - Mark(vv0); - Mark(vv1); - Mark(vv2); - - v0 = vv0 - &*this->mesh.vert.begin(); - v1 = vv1 - &*this->mesh.vert.begin(); - v2 = vv2 - &*this->mesh.vert.begin(); - return true; - } - return false; - } - - //select a new vertex, mark as Visited and mark as usedBit all neighbours (less than min_edge) - int Place(FrontEdge &edge,typename AdvancingFront::ResultIterator &touch) { - Point3x v0 = this->mesh.vert[edge.v0].P(); - Point3x v1 = this->mesh.vert[edge.v1].P(); - Point3x v2 = this->mesh.vert[edge.v2].P(); - /* TODO why using the face normals everything goes wrong? should be - exactly the same................................................ - - Point3x &normal = mesh.face[edge.face].N(); ? - */ - - Point3x normal = ((v1 - v0)^(v2 - v0)).Normalize(); - Point3x middle = (v0 + v1)/2; - Point3x center; - - if(!FindSphere(v0, v1, v2, center)) { -// assert(0); - return -1; - } - - Point3x start_pivot = center - middle; - Point3x axis = (v1 - v0); - - ScalarType axis_len = axis.SquaredNorm(); - if(axis_len > 4*radius*radius) { - return -1; - } - axis.Normalize(); - - // r is the radius of the thorus of all possible spheres passing throug v0 and v1 - ScalarType r = sqrt(radius*radius - axis_len/4); - - std::vector targets; - std::vector dists; - std::vector points; - - tri::GetInSphereVertex(this->mesh, grid, middle, r + radius, targets, dists, points); - - if(targets.size() == 0) { - return -1; //this really would be strange but one never knows. - } - - VertexType *candidate = NULL; - ScalarType min_angle = M_PI; - - for(int i = 0; i < static_cast(targets.size()); i++) { - VertexType *v = targets[i]; - int id = v - &*this->mesh.vert.begin(); - if(v->IsD()) continue; - - // this should always be true IsB => IsV , IsV => IsU - if(v->IsB()) assert(v->IsV()); - if(v->IsV()) assert(v->IsUserBit(usedBit)); - - - if(v->IsUserBit(usedBit) && !(v->IsB())) continue; - if(id == edge.v0 || id == edge.v1 || id == edge.v2) continue; - - Point3x p = this->mesh.vert[id].P(); - - /* Find the sphere through v0, p, v1 (store center on end_pivot */ - if(!FindSphere(v0, p, v1, center)) { - continue; - } - - /* Angle between old center and new center */ - ScalarType alpha = Angle(start_pivot, center - middle, axis); - - /* adding a small bias to already chosen vertices. - doesn't solve numerical problems, but helps. */ - // if(this->mesh.vert[id].IsB()) alpha -= 0.001; - - /* Sometimes alpha might be little less then M_PI while it should be 0, - by numerical errors: happens for example pivoting - on the diagonal of a square. */ - -/* if(alpha > 2*M_PI - 0.8) { - // Angle between old center and new *point* - //TODO is this really overshooting? shouldbe enough to alpha -= 2*M_PI - Point3x proj = p - axis * (axis * p - axis * middle); - ScalarType beta = angle(start_pivot, proj - middle, axis); - - if(alpha > beta) alpha -= 2*M_PI; - } */ - if(candidate == NULL || alpha < min_angle) { - candidate = v; - min_angle = alpha; - } - } - if(min_angle >= M_PI - 0.1) { - return -1; - } - - if(candidate == NULL) { - return -1; - } - if(!candidate->IsB()) { - assert((candidate->P() - v0).Norm() > min_edge); - assert((candidate->P() - v1).Norm() > min_edge); - } - - int id = candidate - &*this->mesh.vert.begin(); - assert(id != edge.v0 && id != edge.v1); - - Point3x newnormal = ((candidate->P() - v0)^(v1 - v0)).Normalize(); - if(normal.dot(newnormal) < max_angle || this->nb[id] >= 2) { - return -1; - } - - //test if id is in some border (to return touch - for(std::list::iterator k = this->front.begin(); k != this->front.end(); k++) - { - if((*k).v0 == id) - { - touch.first = AdvancingFront::FRONT; - touch.second = k; - } - } - for(std::list::iterator k = this->deads.begin(); k != this->deads.end(); k++) - { - if((*k).v0 == id) - { - touch.first = AdvancingFront::DEADS; - touch.second = k; - } - } - - //mark vertices close to candidate - Mark(candidate); - return id; - } - - private: - int last_seed; //used for new seeds when front is empty - int usedBit; //use to detect if a vertex has been already processed. - Point3x baricenter;//used for the first seed. - - StaticGrid grid; //lookup grid for points - - - /* returns the sphere touching p0, p1, p2 of radius r such that - the normal of the face points toward the center of the sphere */ - - bool FindSphere(Point3x &p0, Point3x &p1, Point3x &p2, Point3x ¢er) { - //we want p0 to be always the smallest one. - Point3x p[3]; - - if(p0 < p1 && p0 < p2) { - p[0] = p0; - p[1] = p1; - p[2] = p2; - } else if(p1 < p0 && p1 < p2) { - p[0] = p1; - p[1] = p2; - p[2] = p0; - } else { - p[0] = p2; - p[1] = p0; - p[2] = p1; - } - Point3x q1 = p[1] - p[0]; - Point3x q2 = p[2] - p[0]; - - Point3x up = q1^q2; - ScalarType uplen = up.Norm(); - - //the three points are aligned - if(uplen < 0.001*q1.Norm()*q2.Norm()) { - return false; - } - up /= uplen; - - - ScalarType a11 = q1.dot(q1); - ScalarType a12 = q1.dot(q2); - ScalarType a22 = q2.dot(q2); - - ScalarType m = 4*(a11*a22 - a12*a12); - ScalarType l1 = 2*(a11*a22 - a22*a12)/m; - ScalarType l2 = 2*(a11*a22 - a12*a11)/m; - - center = q1*l1 + q2*l2; - ScalarType circle_r = center.Norm(); - if(circle_r > radius) { - return false; //need too big a sphere - } - - ScalarType height = sqrt(radius*radius - circle_r*circle_r); - center += p[0] + up*height; - - return true; - } - - /* compute angle from p to q, using axis for orientation */ - ScalarType Angle(Point3x p, Point3x q, Point3x &axis) { - p.Normalize(); - q.Normalize(); - Point3x vec = p^q; - ScalarType angle = acos(p.dot(q)); - if(vec.dot(axis) < 0) angle = -angle; - if(angle < 0) angle += 2*M_PI; - return angle; - } - - void Mark(VertexType *v) { - std::vector targets; - std::vector points; - std::vector dists; - int n = tri::GetInSphereVertex(this->mesh, grid, v->P(), min_edge, targets, dists, points); - for(int t = 0; t < n; t++) - targets[t]->SetUserBit(usedBit); - v->SetV(); - } -}; - -} //namespace tri -} //namespace vcg -#endif diff --git a/vcg/complex/trimesh/create/emc_lookup_table.h b/vcg/complex/trimesh/create/emc_lookup_table.h deleted file mode 100644 index fde806dd..00000000 --- a/vcg/complex/trimesh/create/emc_lookup_table.h +++ /dev/null @@ -1,928 +0,0 @@ -/*===========================================================================*\ -* * -* IsoEx * -* Copyright (C) 2002 by Computer Graphics Group, RWTH Aachen * -* www.rwth-graphics.de * -* * -*---------------------------------------------------------------------------* -* * -* License * -* * -* This library is free software; you can redistribute it and/or modify it * -* under the terms of the GNU Library General Public License as published * -* by the Free Software Foundation, version 2. * -* * -* This library is distributed in the hope that it will be useful, but * -* WITHOUT ANY WARRANTY; without even the implied warranty of * -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * -* Library General Public License for more details. * -* * -* You should have received a copy of the GNU Library General Public * -* License along with this library; if not, write to the Free Software * -* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * -* * -\*===========================================================================*/ - -//== TABLES ================================================================== - -#ifndef __VCG_EMC_LOOK_UP_TABLE -#define __VCG_EMC_LOOK_UP_TABLE - -namespace vcg -{ - namespace tri - { - class EMCLookUpTable - { - public: - static const int EdgeTable(unsigned char cubetype) - { - static const int edgeTable[256]= - { - 0x0 , 0x109, 0x203, 0x30a, 0x406, 0x50f, 0x605, 0x70c, - 0x80c, 0x905, 0xa0f, 0xb06, 0xc0a, 0xd03, 0xe09, 0xf00, - 0x190, 0x99 , 0x393, 0x29a, 0x596, 0x49f, 0x795, 0x69c, - 0x99c, 0x895, 0xb9f, 0xa96, 0xd9a, 0xc93, 0xf99, 0xe90, - 0x230, 0x339, 0x33 , 0x13a, 0x636, 0x73f, 0x435, 0x53c, - 0xa3c, 0xb35, 0x83f, 0x936, 0xe3a, 0xf33, 0xc39, 0xd30, - 0x3a0, 0x2a9, 0x1a3, 0xaa , 0x7a6, 0x6af, 0x5a5, 0x4ac, - 0xbac, 0xaa5, 0x9af, 0x8a6, 0xfaa, 0xea3, 0xda9, 0xca0, - 0x460, 0x569, 0x663, 0x76a, 0x66 , 0x16f, 0x265, 0x36c, - 0xc6c, 0xd65, 0xe6f, 0xf66, 0x86a, 0x963, 0xa69, 0xb60, - 0x5f0, 0x4f9, 0x7f3, 0x6fa, 0x1f6, 0xff , 0x3f5, 0x2fc, - 0xdfc, 0xcf5, 0xfff, 0xef6, 0x9fa, 0x8f3, 0xbf9, 0xaf0, - 0x650, 0x759, 0x453, 0x55a, 0x256, 0x35f, 0x55 , 0x15c, - 0xe5c, 0xf55, 0xc5f, 0xd56, 0xa5a, 0xb53, 0x859, 0x950, - 0x7c0, 0x6c9, 0x5c3, 0x4ca, 0x3c6, 0x2cf, 0x1c5, 0xcc , - 0xfcc, 0xec5, 0xdcf, 0xcc6, 0xbca, 0xac3, 0x9c9, 0x8c0, - 0x8c0, 0x9c9, 0xac3, 0xbca, 0xcc6, 0xdcf, 0xec5, 0xfcc, - 0xcc , 0x1c5, 0x2cf, 0x3c6, 0x4ca, 0x5c3, 0x6c9, 0x7c0, - 0x950, 0x859, 0xb53, 0xa5a, 0xd56, 0xc5f, 0xf55, 0xe5c, - 0x15c, 0x55 , 0x35f, 0x256, 0x55a, 0x453, 0x759, 0x650, - 0xaf0, 0xbf9, 0x8f3, 0x9fa, 0xef6, 0xfff, 0xcf5, 0xdfc, - 0x2fc, 0x3f5, 0xff , 0x1f6, 0x6fa, 0x7f3, 0x4f9, 0x5f0, - 0xb60, 0xa69, 0x963, 0x86a, 0xf66, 0xe6f, 0xd65, 0xc6c, - 0x36c, 0x265, 0x16f, 0x66 , 0x76a, 0x663, 0x569, 0x460, - 0xca0, 0xda9, 0xea3, 0xfaa, 0x8a6, 0x9af, 0xaa5, 0xbac, - 0x4ac, 0x5a5, 0x6af, 0x7a6, 0xaa , 0x1a3, 0x2a9, 0x3a0, - 0xd30, 0xc39, 0xf33, 0xe3a, 0x936, 0x83f, 0xb35, 0xa3c, - 0x53c, 0x435, 0x73f, 0x636, 0x13a, 0x33 , 0x339, 0x230, - 0xe90, 0xf99, 0xc93, 0xd9a, 0xa96, 0xb9f, 0x895, 0x99c, - 0x69c, 0x795, 0x49f, 0x596, 0x29a, 0x393, 0x99 , 0x190, - 0xf00, 0xe09, 0xd03, 0xc0a, 0xb06, 0xa0f, 0x905, 0x80c, - 0x70c, 0x605, 0x50f, 0x406, 0x30a, 0x203, 0x109, 0x0 - }; - return edgeTable[cubetype]; - }; // end of EdgeTable - - //----------------------------------------------------------------------------- - - static int* TriTable(unsigned char cubetype, int u) - { - static int triTable[256][2][17] = - {{{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - { 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 3, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{0, 1, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 3, 0, 1, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{1, 8, 3, 9, 8, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 4, 1, 9, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 3, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{0, 8, 3, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {2, 3, 3, 0, 8, 3, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{9, 2, 10, 0, 2, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 4, 2, 10, 9, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{2, 8, 3, 2, 10, 8, 10, 9, 8, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 5, 10, 9, 8, 3, 2 , -1,-1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 3, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{0, 11, 2, 8, 11, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 4, 0, 8, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - /* 10 */ - {{1, 9, 0, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {2, 3, 3, 1, 9, 0, 2, 3,11, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{1, 11, 2, 1, 9, 11, 9, 8, 11, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 5, 9, 8, 11, 2, 1,-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{3, 10, 1, 11, 10, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 4, 3, 11,10, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{0, 10, 1, 0, 8, 10, 8, 11, 10, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 5, 8, 11, 10, 1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{3, 9, 0, 3, 11, 9, 11, 10, 9, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 5, 11,10, 9, 0, 3, -1,-1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - /* 15 */ - {{9, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 4, 8, 11, 10, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 3, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{4, 3, 0, 7, 3, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 4, 4, 7, 3, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{0, 1, 9, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {2, 3, 3, 0, 1, 9, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{4, 1, 9, 4, 7, 1, 7, 3, 1, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 5, 7, 3, 1, 9, 4, -1,-1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - /* 20 */ - {{1, 2, 10, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {2, 3, 3, 1, 2,10, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{3, 4, 7, 3, 0, 4, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1}, - {2, 4, 3, 3, 0, 4, 7, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1}}, - - {{9, 2, 10, 9, 0, 2, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1}, - {2, 4, 3, 2,10, 9, 0, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1}}, - - {{2, 10, 9, 2, 9, 7, 2, 7, 3, 7, 9, 4, -1, -1, -1, -1, -1}, - {1, 6, 7, 3, 2,10, 9, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{8, 4, 7, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {2, 3, 3, 8, 4, 7, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1}}, - - /* 25 */ - {{11, 4, 7, 11, 2, 4, 2, 0, 4, -1, -1, -1, -1, -1, -1, -1, -1}, - { 1, 5, 2, 0, 4, 7,11,-1,-1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{9, 0, 1, 8, 4, 7, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1}, - {3, 3, 3, 3, 9, 0, 1, 8, 4, 7, 2, 3, 11, -1, -1, -1, -1}}, - - {{4, 7, 11, 9, 4, 11, 9, 11, 2, 9, 2, 1, -1, -1, -1, -1, -1}, - {2, 4, 4, 2, 1, 9, 11, 11,9,4,7, -1, -1, -1, -1, -1 ,-1}}, - - {{3, 10, 1, 3, 11, 10, 7, 8, 4, -1, -1, -1, -1, -1, -1, -1, -1}, - {2, 4, 3, 3, 11,10, 1, 7, 8, 4, -1, -1, -1, -1, -1, -1, -1}}, - - {{1, 11, 10, 1, 4, 11, 1, 0, 4, 7, 11, 4, -1, -1, -1, -1, -1}, - {1, 6, 1, 0, 4, 7,11,10, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - /* 30 */ - {{4, 7, 8, 9, 0, 11, 9, 11, 10, 11, 0, 3, -1, -1, -1, -1, -1}, - {2, 3, 5, 4, 7, 8, 0, 3, 11, 10, 9, -1, -1, -1, -1, -1, -1}}, - - {{4, 7, 11, 4, 11, 9, 9, 11, 10, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 5, 4, 7,11,10, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 3, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{9, 5, 4, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {2, 3, 3, 9, 5, 4, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{0, 5, 4, 1, 5, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 4, 0, 1, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - /* 35 */ - {{8, 5, 4, 8, 3, 5, 3, 1, 5, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 5, 3, 1, 5, 4, 8,-1,-1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{1, 2, 10, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {2, 3, 3, 1, 2,10, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{3, 0, 8, 1, 2, 10, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1, -1}, - {3, 3, 3, 3, 3, 0, 8, 1, 2, 10, 4, 9, 5, -1, -1, -1, -1}}, - - {{5, 2, 10, 5, 4, 2, 4, 0, 2, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 5, 4, 0, 2,10, 5,-1,-1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{2, 10, 5, 3, 2, 5, 3, 5, 4, 3, 4, 8, -1, -1, -1, -1, -1}, - {2, 4, 4, 2, 10, 5, 3, 4, 8, 3, 5, -1, -1, -1, -1, -1, -1}}, - - /* 40 */ - {{9, 5, 4, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {2, 3, 3, 9, 5, 4, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{0, 11, 2, 0, 8, 11, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1, -1}, - {2, 4, 3, 0, 8, 11, 2, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1}}, - - {{0, 5, 4, 0, 1, 5, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1}, - {2, 4, 3, 0, 1, 5, 4, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1}}, - - {{2, 1, 5, 2, 5, 8, 2, 8, 11, 4, 8, 5, -1, -1, -1, -1, -1}, - {1, 6, 2, 1, 5, 4, 8,11, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{10, 3, 11, 10, 1, 3, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1}, - { 2, 4, 3, 3,11,10, 1, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1}}, - - /* 45 */ - {{4, 9, 5, 0, 8, 1, 8, 10, 1, 8, 11, 10, -1, -1, -1, -1, -1}, - {2, 3, 5, 4, 9, 5, 1, 0, 8,11, 10, -1, -1, -1, -1, -1, -1}}, - - {{5, 4, 0, 5, 0, 11, 5, 11, 10, 11, 0, 3, -1, -1, -1, -1, -1}, - {1, 6, 5, 4, 0, 3,11, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{5, 4, 8, 5, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 5, 5, 4, 8, 11, 10,-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{9, 7, 8, 5, 7, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 4, 7, 8, 9, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{9, 3, 0, 9, 5, 3, 5, 7, 3, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 5, 5, 7, 3, 0, 9,-1,-1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - /* 50 */ - {{0, 7, 8, 0, 1, 7, 1, 5, 7, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 5, 1, 5, 7, 8, 0,-1,-1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{1, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 4, 3, 1, 5, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{9, 7, 8, 9, 5, 7, 10, 1, 2, -1, -1, -1, -1, -1, -1, -1, -1}, - {2, 4, 3, 7, 8, 9, 5,10, 1, 2, -1, -1, -1, -1, -1, -1, -1}}, - - {{10, 1, 2, 9, 5, 0, 5, 3, 0, 5, 7, 3, -1, -1, -1, -1, -1}, - { 2, 3, 5,10, 1, 2, 0, 9, 5, 7, 3,-1, -1, -1, -1, -1, -1}}, - - {{8, 0, 2, 8, 2, 5, 8, 5, 7, 10, 5, 2, -1, -1, -1, -1, -1}, - {1, 6, 2,10, 5, 7, 8, 0,-1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - /* 55 */ - {{2, 10, 5, 2, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 5, 2,10, 5, 7, 3,-1,-1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{7, 9, 5, 7, 8, 9, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1}, - {2, 4, 3, 7, 8, 9, 5, 3,11, 2, -1, -1, -1, -1, -1, -1, -1}}, - - {{9, 5, 7, 9, 7, 2, 9, 2, 0, 2, 7, 11, -1, -1, -1, -1, -1}, - {1, 6, 2, 0, 9, 5, 7,11, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{2, 3, 11, 0, 1, 8, 1, 7, 8, 1, 5, 7, -1, -1, -1, -1, -1}, - {2, 3, 5, 2, 3,11, 8, 0, 1, 5, 7, -1, -1, -1, -1, -1, -1}}, - - {{11, 2, 1, 11, 1, 7, 7, 1, 5, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 5,11, 2, 1, 5, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - /* 60 */ - {{9, 5, 8, 8, 5, 7, 10, 1, 3, 10, 3, 11, -1, -1, -1, -1, -1}, - {2, 4, 4, 3,11, 10, 1, 5, 7, 8, 9, -1, -1, -1, -1, -1, -1}}, - - {{5, 7, 0, 5, 0, 9, 7, 11, 0, 1, 0, 10, 11, 10, 0, -1, -1}, - {1, 7, 5, 7, 11,10, 1, 0, 9, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{11, 10, 0, 11, 0, 3, 10, 5, 0, 8, 0, 7, 5, 7, 0, -1, -1}, - {1, 7, 11,10,5, 7, 8, 0,3, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{11, 10, 5, 7, 11, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - { 1, 4, 5, 7, 11,10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - { 1, 3,10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - /* 65 */ - {{0, 8, 3, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {2, 3, 3, 0, 8, 3, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{9, 0, 1, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {2, 3, 3, 9, 0, 1, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{1, 8, 3, 1, 9, 8, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1}, - {2, 4, 3, 1, 9, 8, 3, 5,10, 6, -1, -1, -1, -1, -1, -1, -1}}, - - {{1, 6, 5, 2, 6, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 4, 1, 2, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{1, 6, 5, 1, 2, 6, 3, 0, 8, -1, -1, -1, -1, -1, -1, -1, -1}, - {2, 4, 3, 1, 2, 6, 5, 3, 0, 8, -1, -1, -1, -1, -1, -1, -1}}, - - /* 70 */ - {{9, 6, 5, 9, 0, 6, 0, 2, 6, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 5, 0, 2, 6, 5, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{5, 9, 8, 5, 8, 2, 5, 2, 6, 3, 2, 8, -1, -1, -1, -1, -1}, - {1, 6, 2, 6, 5, 9, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{2, 3, 11, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {2, 3, 3, 2, 3,11, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{11, 0, 8, 11, 2, 0, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1}, - { 2, 4, 3, 0, 8, 11, 2, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1}}, - - {{0, 1, 9, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1}, - {3, 3, 3, 3, 0, 1, 9, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1}}, - - /* 75 */ - {{5, 10, 6, 1, 9, 2, 9, 11, 2, 9, 8, 11, -1, -1, -1, -1, -1}, - {2, 3, 5, 5,10, 6, 2, 1, 9, 8,11, -1, -1, -1, -1, -1, -1}}, - - {{6, 3, 11, 6, 5, 3, 5, 1, 3, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 5, 5, 1, 3, 11,6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{0, 8, 11, 0, 11, 5, 0, 5, 1, 5, 11, 6, -1, -1, -1, -1, -1}, - {1, 6, 5, 1, 0, 8,11, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{3, 11, 6, 0, 3, 6, 0, 6, 5, 0, 5, 9, -1, -1, -1, -1, -1}, - {2, 4, 4, 3, 11, 6, 0, 5, 9, 0, 6, -1, -1, -1, -1}}, - - {{6, 5, 9, 6, 9, 11, 11, 9, 8, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 5, 6, 5, 9, 8, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - /* 80 */ - {{5, 10, 6, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {2, 3, 3, 5,10, 6, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{4, 3, 0, 4, 7, 3, 6, 5, 10, -1, -1, -1, -1, -1, -1, -1, -1}, - {2, 4, 3, 4, 7, 3, 0, 6, 5, 10, -1, -1, -1, -1, -1, -1, -1}}, - - {{1, 9, 0, 5, 10, 6, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1}, - {3, 3, 3, 3, 1, 9, 0, 5,10, 6, 8, 4, 7, -1, -1, -1, -1}}, - - {{10, 6, 5, 1, 9, 7, 1, 7, 3, 7, 9, 4, -1, -1, -1, -1, -1}, - { 2, 3, 5,10, 6, 5, 9, 4, 7, 3, 1,-1, -1, -1, -1, -1, -1}}, - - {{6, 1, 2, 6, 5, 1, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1}, - {2, 4, 3, 1, 2, 6, 5, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1}}, - - /* 85 */ - {{1, 2, 5, 5, 2, 6, 3, 0, 4, 3, 4, 7, -1, -1, -1, -1, -1}, - {2, 4, 4, 2, 6, 5, 1, 3, 0, 4, 7, -1, -1, -1, -1, -1, -1}}, - - {{8, 4, 7, 9, 0, 5, 0, 6, 5, 0, 2, 6, -1, -1, -1, -1, -1}, - {2, 3, 5, 8, 4, 7, 5, 9, 0, 2, 6, -1, -1, -1, -1, -1, -1}}, - - {{7, 3, 9, 7, 9, 4, 3, 2, 9, 5, 9, 6, 2, 6, 9, -1, -1}, - {1, 7, 7, 3, 2, 6, 5, 9, 4,-1, -1, -1, -1, -1, -1, -1, -1}}, - - {{3, 11, 2, 7, 8, 4, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1}, - {3, 3, 3, 3, 3,11, 2, 7, 8, 4, 10, 6, 5, -1, -1, -1, -1}}, - - {{5, 10, 6, 4, 7, 2, 4, 2, 0, 2, 7, 11, -1, -1, -1, -1, -1}, - {2, 3, 5, 5,10, 6, 7,11, 2, 0, 4, -1, -1, -1, -1, -1, -1}}, - - /* 90 */ - {{0, 1, 9, 4, 7, 8, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1, -1}, - {4, 3, 3, 3, 3, 0, 1, 9, 4, 7, 8, 2, 3, 11, 5, 10, 6}}, - - {{9, 2, 1, 9, 11, 2, 9, 4, 11, 7, 11, 4, 5, 10, 6, -1, -1}, - {3, 4, 4, 3, 2, 1, 9,11, 4, 7, 11, 9, 5, 10, 6, -1, -1}}, - - {{8, 4, 7, 3, 11, 5, 3, 5, 1, 5, 11, 6, -1, -1, -1, -1, -1}, - {2, 3, 5, 8, 4, 7, 11, 6, 5, 1, 3, -1, -1, -1, -1, -1, -1}}, - - {{5, 1, 11, 5, 11, 6, 1, 0, 11, 7, 11, 4, 0, 4, 11, -1, -1}, - {1, 7, 5, 1, 0, 4, 7,11, 6, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{0, 5, 9, 0, 6, 5, 0, 3, 6, 11, 6, 3, 8, 4, 7, -1, -1}, - {3, 4, 4, 3, 0, 6, 5, 9, 3, 11, 6, 0, 8, 4, 7, -1, -1}}, - - /* 95 */ - {{6, 5, 9, 6, 9, 11, 4, 7, 9, 7, 11, 9, -1, -1, -1, -1, -1}, - {2, 4, 4, 9, 4, 7, 11, 6, 5, 9, 11,-1, -1, -1, -1, -1, -1}}, - - {{10, 4, 9, 6, 4, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - { 1, 4, 4, 9, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{4, 10, 6, 4, 9, 10, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1}, - {2, 4, 3, 4, 9,10, 6, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1}}, - - {{10, 0, 1, 10, 6, 0, 6, 4, 0, -1, -1, -1, -1, -1, -1, -1, -1}, - { 1, 5, 6, 4, 0, 1, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{8, 3, 1, 8, 1, 6, 8, 6, 4, 6, 1, 10, -1, -1, -1, -1, -1}, - {1, 6, 1,10, 6, 4, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - /* 100 */ - {{1, 4, 9, 1, 2, 4, 2, 6, 4, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 5, 2, 6, 4, 9, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{3, 0, 8, 1, 2, 9, 2, 4, 9, 2, 6, 4, -1, -1, -1, -1, -1}, - {2, 3, 5, 3, 0, 8, 9, 1, 2, 6, 4, -1, -1, -1, -1, -1, -1}}, - - {{0, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 4, 2, 6, 4, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{8, 3, 2, 8, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 5, 8, 3, 2, 6, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{10, 4, 9, 10, 6, 4, 11, 2, 3, -1, -1, -1, -1, -1, -1, -1, -1}, - { 2, 4, 3, 10, 6, 4, 9,11, 2, 3, -1, -1, -1, -1, -1, -1, -1}}, - - /* 105 */ - {{0, 8, 2, 2, 8, 11, 4, 9, 10, 4, 10, 6, -1, -1, -1, -1, -1}, - {2, 4, 4, 2, 11, 8, 0, 10, 6, 4, 9, -1, -1, -1, -1, -1, -1}}, - - {{3, 11, 2, 0, 1, 6, 0, 6, 4, 6, 1, 10, -1, -1, -1, -1, -1}, - {2, 3, 5, 3,11, 2, 1, 10,6, 4, 0, -1, -1, -1, -1, -1, -1}}, - - {{6, 4, 1, 6, 1, 10, 4, 8, 1, 2, 1, 11, 8, 11, 1, -1, -1}, - {1, 7, 6, 4, 8,11, 2, 1,10, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{9, 6, 4, 9, 3, 6, 9, 1, 3, 11, 6, 3, -1, -1, -1, -1, -1}, - {1, 6, 3,11, 6, 4, 9, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{8, 11, 1, 8, 1, 0, 11, 6, 1, 9, 1, 4, 6, 4, 1, -1, -1}, - {1, 7, 8,11, 6, 4, 9, 1, 0, -1, -1, -1, -1, -1, -1, -1, -1}}, - - /* 110 */ - {{3, 11, 6, 3, 6, 0, 0, 6, 4, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 5, 3,11, 6, 4, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{6, 4, 8, 11, 6, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 4, 8, 11, 6, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{7, 10, 6, 7, 8, 10, 8, 9, 10, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 5, 8, 9,10, 6, 7,-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{0, 7, 3, 0, 10, 7, 0, 9, 10, 6, 7, 10, -1, -1, -1, -1, -1}, - {1, 6, 0, 9, 10, 6, 7, 3, -1,-1,-1, -1, -1, -1, -1, -1, -1}}, - - {{10, 6, 7, 1, 10, 7, 1, 7, 8, 1, 8, 0, -1, -1, -1, -1, -1}, - { 2, 4, 4, 8, 0, 1, 7, 10, 6, 7, 1,-1, -1, -1, -1, -1, -1}}, - - /* 115 */ - {{10, 6, 7, 10, 7, 1, 1, 7, 3, -1, -1, -1, -1, -1, -1, -1, -1}, - { 1, 5, 10, 6, 7, 3, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{1, 2, 6, 1, 6, 8, 1, 8, 9, 8, 6, 7, -1, -1, -1, -1, -1}, - {1, 6, 1, 2, 6, 7, 8, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{2, 6, 9, 2, 9, 1, 6, 7, 9, 0, 9, 3, 7, 3, 9, -1, -1}, - {1, 7, 2, 6, 7, 3, 0, 9, 1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{7, 8, 0, 7, 0, 6, 6, 0, 2, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 5, 7, 8, 0, 2, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{7, 3, 2, 6, 7, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 4, 7, 3, 2, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - /* 120 */ - {{2, 3, 11, 10, 6, 8, 10, 8, 9, 8, 6, 7, -1, -1, -1, -1, -1}, - {2, 3, 5, 2, 3,11, 6, 7, 8, 9,10, -1, -1, -1, -1, -1, -1}}, - - {{2, 0, 7, 2, 7, 11, 0, 9, 7, 6, 7, 10, 9, 10, 7, -1, -1}, - {1, 7, 2, 0, 9,10,6, 7, 11, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{1, 8, 0, 1, 7, 8, 1, 10, 7, 6, 7, 10, 2, 3, 11, -1, -1}, - {3, 4, 4, 3, 8, 0, 1, 7, 10, 6, 7, 1, 11, 2, 3, -1, -1}}, - - {{11, 2, 1, 11, 1, 7, 10, 6, 1, 6, 7, 1, -1, -1, -1, -1, -1}, - { 2, 4, 4, 11, 2, 1,7, 1, 10, 6, 7,-1, -1, -1, -1, -1, -1}}, - - {{8, 9, 6, 8, 6, 7, 9, 1, 6, 11, 6, 3, 1, 3, 6, -1, -1}, - {1, 7, 8, 9, 1, 3, 11, 6, 7,-1, -1, -1, -1, -1, -1, -1, -1}}, - - /* 125 */ - {{0, 9, 1, 11, 6, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {2, 3, 3, 0, 9, 1, 11, 6, 7, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{7, 8, 0, 7, 0, 6, 3, 11, 0, 11, 6, 0, -1, -1, -1, -1, -1}, - {2, 4, 4, 0, 3,11, 6, 7, 8, 0, 6, -1, -1, -1, -1, -1, -1}}, - - {{7, 11, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 3, 7, 11, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 3, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{3, 0, 8, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {2, 3, 3, 3, 0, 8, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1}}, - - /* 130 */ - {{0, 1, 9, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {2, 3, 3, 0, 1, 9, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{8, 1, 9, 8, 3, 1, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1}, - {2, 4, 3, 1, 9, 8, 3,11, 7, 6, -1, -1, -1, -1, -1, -1, -1}}, - - {{10, 1, 2, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - { 2, 3, 3,10, 1, 2, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{1, 2, 10, 3, 0, 8, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1, -1}, - {3, 3, 3, 3, 1, 2,10, 3, 0, 8, 6, 11, 7, -1, -1, -1, -1}}, - - {{2, 9, 0, 2, 10, 9, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1, -1}, - {2, 4, 3, 2, 10, 9, 0, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1}}, - - /* 135 */ - {{6, 11, 7, 2, 10, 3, 10, 8, 3, 10, 9, 8, -1, -1, -1, -1, -1}, - {2, 3, 5, 6, 11, 7, 3, 2,10, 9, 8, -1, -1, -1, -1, -1, -1}}, - - {{7, 2, 3, 6, 2, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 4, 2, 3, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{7, 0, 8, 7, 6, 0, 6, 2, 0, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 5, 6, 2, 0, 8, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{2, 7, 6, 2, 3, 7, 0, 1, 9, -1, -1, -1, -1, -1, -1, -1, -1}, - {2, 4, 3, 2, 3, 7, 6, 0, 1, 9, -1, -1, -1, -1, -1, -1, -1}}, - - {{1, 6, 2, 1, 8, 6, 1, 9, 8, 8, 7, 6, -1, -1, -1, -1, -1}, - {1, 6, 6, 2, 1, 9, 8, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - /* 140 */ - {{10, 7, 6, 10, 1, 7, 1, 3, 7, -1, -1, -1, -1, -1, -1, -1, -1}, - { 1, 5, 1, 3, 7, 6,10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{10, 7, 6, 1, 7, 10, 1, 8, 7, 1, 0, 8, -1, -1, -1, -1, -1}, - { 2, 4, 4, 10, 1, 7, 6, 8, 7, 1, 0,-1, -1, -1, -1, -1, -1}}, - - {{0, 3, 7, 0, 7, 10, 0, 10, 9, 6, 10, 7, -1, -1, -1, -1, -1}, - {1, 6,10, 9, 0, 3, 7, 6,-1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{7, 6, 10, 7, 10, 8, 8, 10, 9, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 5, 7, 6, 10, 9, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{6, 8, 4, 11, 8, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 4, 6, 11, 8, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - /* 145 */ - {{3, 6, 11, 3, 0, 6, 0, 4, 6, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 5, 0, 4, 6,11, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{8, 6, 11, 8, 4, 6, 9, 0, 1, -1, -1, -1, -1, -1, -1, -1, -1}, - {2, 4, 3, 6,11, 8, 4, 9, 0, 1, -1, -1, -1, -1, -1, -1, -1}}, - - {{9, 4, 6, 9, 6, 3, 9, 3, 1, 11, 3, 6, -1, -1, -1, -1, -1}, - {1, 6, 6,11, 3, 1, 9, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{6, 8, 4, 6, 11, 8, 2, 10, 1, -1, -1, -1, -1, -1, -1, -1, -1}, - {2, 4, 3, 6, 11, 8, 4, 2, 10, 1, -1, -1, -1, -1, -1, -1, -1}}, - - {{1, 2, 10, 3, 0, 11, 0, 6, 11, 0, 4, 6, -1, -1, -1, -1, -1}, - {2, 3, 5, 1, 2, 10,11, 3,0,4, 6, -1, -1, -1, -1, -1, -1}}, - - /* 150 */ - {{4, 11, 8, 4, 6, 11, 0, 2, 9, 2, 10, 9, -1, -1, -1, -1, -1}, - {2, 4, 4, 4, 6, 11, 8, 2,10, 9, 0, -1, -1, -1, -1, -1, -1}}, - - {{10, 9, 3, 10, 3, 2, 9, 4, 3, 11, 3, 6, 4, 6, 3, -1, -1}, - {1, 7, 10,9, 4, 6, 11, 3, 2, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{8, 2, 3, 8, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 5, 4, 6, 2, 3, 8,-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{0, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 4, 4, 6, 2, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{1, 9, 0, 2, 3, 4, 2, 4, 6, 4, 3, 8, -1, -1, -1, -1, -1}, - {2, 3, 5, 1, 9, 0, 3, 8, 4, 6, 2, -1, -1, -1, -1, -1, -1}}, - - /* 155 */ - {{1, 9, 4, 1, 4, 2, 2, 4, 6, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 5, 1, 9, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{8, 1, 3, 8, 6, 1, 8, 4, 6, 6, 10, 1, -1, -1, -1, -1, -1}, - {1, 6, 1, 3, 8, 4, 6,10, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{10, 1, 0, 10, 0, 6, 6, 0, 4, -1, -1, -1, -1, -1, -1, -1, -1}, - { 1, 5,10, 1,0,4,6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{4, 6, 3, 4, 3, 8, 6, 10, 3, 0, 3, 9, 10, 9, 3, -1, -1}, - {1, 7, 4, 6, 10, 9, 0,3, 8, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{10, 9, 4, 6, 10, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - { 1, 4, 4, 6, 10, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - /* 160 */ - {{4, 9, 5, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {2, 3, 3, 4, 9, 5, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{0, 8, 3, 4, 9, 5, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1}, - {3, 3, 3, 3, 0, 8, 3, 4, 9, 5, 11, 7, 6, -1, -1, -1, -1}}, - - {{5, 0, 1, 5, 4, 0, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1}, - {2, 4, 3, 0, 1, 5, 4, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1}}, - - {{11, 7, 6, 8, 3, 4, 3, 5, 4, 3, 1, 5, -1, -1, -1, -1, -1}, - { 2, 3, 5,11, 7, 6, 4, 8, 3, 1, 5,-1, -1, -1, -1, -1, -1}}, - - {{9, 5, 4, 10, 1, 2, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1}, - {3, 3, 3, 3, 9, 5, 4,10, 1, 2, 7, 6, 11, -1, -1, -1, -1}}, - - /* 165 */ - {{6, 11, 7, 1, 2, 10, 0, 8, 3, 4, 9, 5, -1, -1, -1, -1, -1}, - {4, 3, 3, 3, 3, 6,11, 7, 1, 2,10, 0, 8, 3, 4, 9, 5}}, - - {{7, 6, 11, 5, 4, 10, 4, 2, 10, 4, 0, 2, -1, -1, -1, -1, -1}, - {2, 3, 5, 7, 6, 11, 10, 5, 4, 0, 2,-1, -1, -1, -1, -1, -1}}, - - {{3, 4, 8, 3, 5, 4, 3, 2, 5, 10, 5, 2, 11, 7, 6, -1, -1}, - {3, 4, 4, 3, 5, 3, 2,10, 4, 8, 3, 5, 6, 11, 7, 6, -1}}, - - {{7, 2, 3, 7, 6, 2, 5, 4, 9, -1, -1, -1, -1, -1, -1, -1, -1}, - {2, 4, 3, 2, 3, 7, 6, 5, 4, 9, -1, -1, -1, -1, -1, -1, -1}}, - - {{9, 5, 4, 0, 8, 6, 0, 6, 2, 6, 8, 7, -1, -1, -1, -1, -1}, - {2, 3, 5, 9, 5, 4, 8, 7, 6, 2, 0, -1, -1, -1, -1, -1, -1}}, - - /* 170 */ - {{3, 6, 2, 3, 7, 6, 1, 5, 0, 5, 4, 0, -1, -1, -1, -1, -1}, - {2, 4, 4, 3, 7, 6, 2, 0, 1, 5, 4, -1, -1, -1, -1, -1, -1}}, - - {{6, 2, 8, 6, 8, 7, 2, 1, 8, 4, 8, 5, 1, 5, 8, -1, -1}, - {1, 7, 6, 2, 1, 5, 4, 8, 7,-1, -1, -1, -1, -1, -1, -1, -1}}, - - {{9, 5, 4, 10, 1, 6, 1, 7, 6, 1, 3, 7, -1, -1, -1, -1, -1}, - {2, 3, 5, 9, 5, 4, 6,10, 1, 3, 7,-1, -1, -1, -1, -1, -1}}, - - {{1, 6, 10, 1, 7, 6, 1, 0, 7, 8, 7, 0, 9, 5, 4, -1, -1}, - {3, 4, 4, 3, 0, 8, 7, 1, 6, 10, 1, 7, 9, 5, 4, -1, -1}}, - - {{4, 0, 10, 4, 10, 5, 0, 3, 10, 6, 10, 7, 3, 7, 10, -1, -1}, - {1, 7, 4, 0, 3, 7, 6, 10, 5, -1, -1, -1, -1, -1, -1, -1, -1}}, - - /* 175 */ - {{7, 6, 10, 7, 10, 8, 5, 4, 10, 4, 8, 10, -1, -1, -1, -1, -1}, - {2, 4, 4, 4, 8, 10, 5, 7, 6,10, 8, -1, -1, -1, -1, -1, -1}}, - - {{6, 9, 5, 6, 11, 9, 11, 8, 9, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 5,11, 8, 9, 5, 6,-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{3, 6, 11, 0, 6, 3, 0, 5, 6, 0, 9, 5, -1, -1, -1, -1, -1}, - {2, 4, 4, 0, 9, 5, 6, 6,11, 3, 0, -1, -1, -1, -1, -1, -1}}, - - {{0, 11, 8, 0, 5, 11, 0, 1, 5, 5, 6, 11, -1, -1, -1, -1, -1}, - {1, 6, 0, 1, 5, 6,11, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{6, 11, 3, 6, 3, 5, 5, 3, 1, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 5, 6,11, 3, 1, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - /*180 */ - {{1, 2, 10, 9, 5, 11, 9, 11, 8, 11, 5, 6, -1, -1, -1, -1, -1}, - {2, 3, 5, 1, 2, 10, 5, 6,11, 8, 9, -1, -1, -1, -1, -1, -1}}, - - {{0, 11, 3, 0, 6, 11, 0, 9, 6, 5, 6, 9, 1, 2, 10, -1, -1}, - {3, 4, 4, 3, 11, 3,0, 6, 9, 5, 6, 0, 2, 10, 1, 2, 10}}, - - {{11, 8, 5, 11, 5, 6, 8, 0, 5, 10, 5, 2, 0, 2, 5, -1, -1}, - { 1, 7,11, 8, 0, 2,10, 5, 6,-1, -1, -1, -1, -1, -1, -1, -1}}, - - {{6, 11, 3, 6, 3, 5, 2, 10, 3, 10, 5, 3, -1, -1, -1, -1, -1}, - {2, 4, 4, 6,11, 3, 5, 10, 5, 3, 2, -1, -1, -1, -1, -1, -1}}, - - {{5, 8, 9, 5, 2, 8, 5, 6, 2, 3, 8, 2, -1, -1, -1, -1, -1}, - {1, 6, 2, 3, 8, 9, 5, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - /* 185 */ - {{9, 5, 6, 9, 6, 0, 0, 6, 2, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 5, 9, 5, 6, 2, 0,-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{1, 5, 8, 1, 8, 0, 5, 6, 8, 3, 8, 2, 6, 2, 8, -1, -1}, - {1, 7, 1, 5, 6, 2, 3, 8, 0, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{1, 5, 6, 2, 1, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 4, 1, 5, 6, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{1, 3, 6, 1, 6, 10, 3, 8, 6, 5, 6, 9, 8, 9, 6, -1, -1}, - {1, 7, 1, 3, 8, 9, 5, 6,10, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{10, 1, 0, 10, 0, 6, 9, 5, 0, 5, 6, 0, -1, -1, -1, -1, -1}, - { 2, 4, 4, 5, 6, 0, 9, 10, 1, 0, 6, -1, -1, -1, -1, -1, -1}}, - - /* 190 */ - {{0, 3, 8, 5, 6, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {2, 3, 3, 0, 3, 8, 5, 6, 10, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{10, 5, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - { 1, 3,10, 5, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{11, 5, 10, 7, 5, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - { 1, 4, 5,10, 11, 7,-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{11, 5, 10, 11, 7, 5, 8, 3, 0, -1, -1, -1, -1, -1, -1, -1, -1}, - { 2, 4, 3, 5,10,11, 7, 8, 3, 0, -1, -1, -1, -1, -1, -1, -1}}, - - {{5, 11, 7, 5, 10, 11, 1, 9, 0, -1, -1, -1, -1, -1, -1, -1, -1}, - { 2, 4, 3, 5, 10, 11, 7, 1, 9, 0, -1, -1, -1, -1, -1, -1, -1}}, - - /* 195 */ - {{10, 7, 5, 10, 11, 7, 9, 8, 1, 8, 3, 1, -1, -1, -1, -1, -1}, - { 2, 4, 4, 10, 11, 7, 5, 1, 9, 8, 3, -1, -1, -1, -1, -1, -1}}, - - {{11, 1, 2, 11, 7, 1, 7, 5, 1, -1, -1, -1, -1, -1, -1, -1, -1}, - { 1, 5, 7, 5, 1, 2,11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{0, 8, 3, 1, 2, 7, 1, 7, 5, 7, 2, 11, -1, -1, -1, -1, -1}, - {2, 3, 5, 0, 8, 3, 2,11, 7, 5,1, -1, -1, -1, -1, -1, -1}}, - - {{9, 7, 5, 9, 2, 7, 9, 0, 2, 2, 11, 7, -1, -1, -1, -1, -1}, - {1, 6, 2,11, 7, 5, 9, 0,-1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{7, 5, 2, 7, 2, 11, 5, 9, 2, 3, 2, 8, 9, 8, 2, -1, -1}, - {1, 7, 7, 5, 9, 8, 3, 2,11,-1, -1, -1, -1, -1, -1, -1, -1}}, - - /* 200 */ - {{2, 5, 10, 2, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 5, 3, 7, 5,10, 2,-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{8, 2, 0, 8, 5, 2, 8, 7, 5, 10, 2, 5, -1, -1, -1, -1, -1}, - {1, 6, 5,10, 2, 0, 8, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{9, 0, 1, 5, 10, 3, 5, 3, 7, 3, 10, 2, -1, -1, -1, -1, -1}, - {2, 3, 5, 9, 0, 1, 10, 2, 3, 7, 5, -1, -1, -1, -1, -1, -1}}, - - {{9, 8, 2, 9, 2, 1, 8, 7, 2, 10, 2, 5, 7, 5, 2, -1, -1}, - {1, 7, 9, 8, 7, 5,10, 2, 1,-1, -1, -1, -1, -1, -1, -1, -1}}, - - {{1, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 4, 3, 7, 5, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - /* 205 */ - {{0, 8, 7, 0, 7, 1, 1, 7, 5, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 5, 0, 8, 7, 5, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{9, 0, 3, 9, 3, 5, 5, 3, 7, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 5, 9, 0, 3, 7, 5,-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{9, 8, 7, 5, 9, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 4, 7, 5, 9, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{5, 8, 4, 5, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 5, 10,11, 8, 4, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{5, 0, 4, 5, 11, 0, 5, 10, 11, 11, 3, 0, -1, -1, -1, -1, -1}, - {1, 6, 0, 4, 5,10,11, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - /* 210 */ - {{0, 1, 9, 8, 4, 10, 8, 10, 11, 10, 4, 5, -1, -1, -1, -1, -1}, - {2, 3, 5, 0, 1, 9, 4, 5, 10, 11, 8, -1, -1, -1, -1, -1, -1}}, - - {{10, 11, 4, 10, 4, 5, 11, 3, 4, 9, 4, 1, 3, 1, 4, -1, -1}, - { 1, 7,10, 11, 3, 1, 9,4, 5,-1, -1, -1, -1, -1, -1, -1}}, - - {{2, 5, 1, 2, 8, 5, 2, 11, 8, 4, 5, 8, -1, -1, -1, -1, -1}, - {1, 6, 2,11, 8, 4, 5, 1,-1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{0, 4, 11, 0, 11, 3, 4, 5, 11, 2, 11, 1, 5, 1, 11, -1, -1}, - {1, 7, 0, 4, 5, 1, 2, 11, 3,-1, -1, -1, -1, -1, -1, -1, -1}}, - - {{0, 2, 5, 0, 5, 9, 2, 11, 5, 4, 5, 8, 11, 8, 5, -1, -1}, - {1, 7, 0, 2,11, 8, 4, 5, 9, -1, -1, -1, -1, -1, -1, -1, -1}}, - - /* 215 */ - {{9, 4, 5, 2, 11, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {2, 3, 3, 9, 4, 5, 2, 11, 3, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{2, 5, 10, 3, 5, 2, 3, 4, 5, 3, 8, 4, -1, -1, -1, -1, -1}, - {2, 4, 4, 2, 3, 5, 10, 4, 5, 3, 8,-1, -1, -1, -1, -1, -1}}, - - {{5, 10, 2, 5, 2, 4, 4, 2, 0, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 5, 5,10, 2, 0, 4,-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{3, 10, 2, 3, 5, 10, 3, 8, 5, 4, 5, 8, 0, 1, 9, -1, -1}, - {3, 4, 4, 3, 3, 5, 10, 2, 8, 4, 5, 3, 0, 1, 9, -1, -1}}, - - {{5, 10, 2, 5, 2, 4, 1, 9, 2, 9, 4, 2, -1, -1, -1, -1, -1}, - {1, 6,10, 2, 1, 9, 4, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - /* 220 */ - {{8, 4, 5, 8, 5, 3, 3, 5, 1, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 5, 8, 4, 5, 1, 3,-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{0, 4, 5, 1, 0, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 4, 0, 4, 5, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{8, 4, 5, 8, 5, 3, 9, 0, 5, 0, 3, 5, -1, -1, -1, -1, -1}, - {2, 4, 4, 0, 3, 5, 9, 8, 4, 5, 3, -1, -1, -1, -1, -1, -1}}, - - {{9, 4, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 3, 9, 4, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{4, 11, 7, 4, 9, 11, 9, 10, 11, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 5, 9,10, 11, 7, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - /* 225 */ - {{0, 8, 3, 4, 9, 7, 9, 11, 7, 9, 10, 11, -1, -1, -1, -1, -1}, - {2, 3, 5, 0, 8, 3, 7, 4, 9, 10, 11, -1, -1, -1, -1, -1, -1}}, - - {{1, 10, 11, 1, 11, 4, 1, 4, 0, 7, 4, 11, -1, -1, -1, -1, -1}, - {1, 6, 1, 10,11, 7, 4, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{3, 1, 4, 3, 4, 8, 1, 10, 4, 7, 4, 11, 10, 11, 4, -1, -1}, - {1, 7, 3, 1,10,11, 7, 4, 8, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{4, 11, 7, 9, 11, 4, 9, 2, 11, 9, 1, 2, -1, -1, -1, -1, -1}, - {2, 4, 4, 2, 11, 9, 1, 4, 9, 11, 7, -1, -1, -1, -1, -1, -1}}, - - {{9, 7, 4, 9, 11, 7, 9, 1, 11, 2, 11, 1, 0, 8, 3, -1, -1}, - {3, 4, 4, 3, 1, 2, 11, 9, 7, 4, 9,11, 8, 3, 0, 8, 3}}, - - /* 230 */ - {{11, 7, 4, 11, 4, 2, 2, 4, 0, -1, -1, -1, -1, -1, -1, -1, -1}, - { 1, 5, 11, 7, 4, 0, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{11, 7, 4, 11, 4, 2, 8, 3, 4, 3, 2, 4, -1, -1, -1, -1, -1}, - { 2, 4, 4, 11, 7, 4, 2, 3, 2, 4, 8,-1, -1, -1, -1, -1, -1}}, - - {{2, 9, 10, 2, 7, 9, 2, 3, 7, 7, 4, 9, -1, -1, -1, -1, -1}, - {1, 6, 2, 3, 7, 4, 9,10, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{9, 10, 7, 9, 7, 4, 10, 2, 7, 8, 7, 0, 2, 0, 7, -1, -1}, - {1, 7, 9,10, 2, 0, 8, 7, 4,-1, -1, -1, -1, -1, -1, -1, -1}}, - - {{3, 7, 10, 3, 10, 2, 7, 4, 10, 1, 10, 0, 4, 0, 10, -1, -1}, - {1, 7, 3, 7, 4, 0, 1,10, 2, -1, -1, -1, -1, -1, -1, -1, -1}}, - - /* 235 */ - {{1, 10, 2, 8, 7, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {2, 3, 3, 1,10, 2, 8, 7, 4, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{4, 9, 1, 4, 1, 7, 7, 1, 3, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 5, 4, 9, 1, 3, 7,-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{4, 9, 1, 4, 1, 7, 0, 8, 1, 8, 7, 1, -1, -1, -1, -1, -1}, - {2, 4, 4, 8, 7, 1, 0, 4, 9, 1, 7, -1, -1, -1, -1, -1, -1}}, - - {{4, 0, 3, 7, 4, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 4, 3, 7, 4, 0,-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{4, 8, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 3, 4, 8, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - /* 240 */ - {{9, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 4, 8, 9, 10,11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{3, 0, 9, 3, 9, 11, 11, 9, 10, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 5, 3, 0, 9, 10, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{0, 1, 10, 0, 10, 8, 8, 10, 11, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 5, 0, 1, 10,11, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{3, 1, 10, 11, 3, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 4, 3, 1,10, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{1, 2, 11, 1, 11, 9, 9, 11, 8, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 5, 1, 2, 11, 8, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - /* 245 */ - {{3, 0, 9, 3, 9, 11, 1, 2, 9, 2, 11, 9, -1, -1, -1, -1, -1}, - {2, 4, 4, 2,11, 9, 1, 3, 0, 9, 11, -1, -1, -1, -1, -1,-1}}, - - {{0, 2, 11, 8, 0, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 4, 0, 2,11, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{3, 2, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 3, 3, 2, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{2, 3, 8, 2, 8, 10, 10, 8, 9, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 5, 2, 3, 8, 9, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{9, 10, 2, 0, 9, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 4, 2, 0, 9,10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - /* 250 */ - {{2, 3, 8, 2, 8, 10, 0, 1, 8, 1, 10, 8, -1, -1, -1, -1, -1}, - {2, 4, 4, 2, 3, 8, 10, 1, 10, 8, 0, -1, -1, -1, -1, -1, -1}}, - - {{1, 10, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 3, 1, 10, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{1, 3, 8, 9, 1, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 4, 1, 3, 8, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{0, 9, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 3, 0, 9, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{0, 3, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {1, 3, 0, 3, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}, - - {{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - { 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}} - }; - return &triTable[cubetype][u][0]; - }; // end of TriTable - - - //----------------------------------------------------------------------------- - - - static const int PolyTable(unsigned int cubetype, int u) - { - static const int polyTable[8][16] = - { - {-1}, - {-1}, - {-1}, - {0, 1, 2, -1}, - {0, 1, 2, 2, 3, 0, -1}, - {0, 1, 2, 0, 2, 4, 4, 2, 3, -1}, - {0, 1, 2, 2, 3, 4, 4, 5, 0, 0, 2, 4, -1}, - {0, 1, 5, 0, 5, 6, 1, 2, 5, 4, 5, 3, 2, 3, 5, -1} - }; - return polyTable[cubetype][u]; - }; // end of PolyTable - - //============================================================================= - - }; //end of class EMCLookUpTable - }; // end of namespace tri -}; // end of namespace vcg -#endif // __VCG_EMC_LOOK_UP_TABLE diff --git a/vcg/complex/trimesh/create/extended_marching_cubes.h b/vcg/complex/trimesh/create/extended_marching_cubes.h deleted file mode 100644 index b48c241f..00000000 --- a/vcg/complex/trimesh/create/extended_marching_cubes.h +++ /dev/null @@ -1,462 +0,0 @@ -/**************************************************************************** -* VCGLib o o * -* Visual and Computer Graphics Library o o * -* _ O _ * -* Copyright(C) 2004 \/)\/ * -* Visual Computing Lab /\/| * -* ISTI - Italian National Research Council | * -* \ * -* All rights reserved. * -* * -* This program is free software; you can redistribute it and/or modify * -* it under the terms of the GNU General Public License as published by * -* the Free Software Foundation; either version 2 of the License, or * -* (at your option) any later version. * -* * -* This program is distributed in the hope that it will be useful, * -* but WITHOUT ANY WARRANTY; without even the implied warranty of * -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * -* for more details. * -* * -****************************************************************************/ -/***************************************************************************/ - - -#ifndef __VCG_EXTENDED_MARCHING_CUBES -#define __VCG_EXTENDED_MARCHING_CUBES - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "emc_lookup_table.h" - -namespace vcg -{ - namespace tri - { - // Doxygen documentation - /** \addtogroup trimesh */ - /*@{*/ - - /* - * Cube description: - * 3 ________ 2 _____2__ - * /| /| / | /| - * / | / | 11/ 3 10/ | - * 7 /_______ / | /__6_|__ / |1 - * | | |6 | | | | - * | 0|__|_____|1 | |__|_0|__| - * | / | / 7 8/ 5 / - * | / | / | / | /9 - * |/_______|/ |/___4___|/ - * 4 5 - */ - - //! This class implements the Extended Marching Cubes algorithm. - /*! - * The implementation is enough generic: this class works only on one volume cell for each - * call to ProcessCell. Using the field value at the cell corners, it adds to the - * mesh the triangles set approximating the surface that cross that cell. - * @param TRIMESH_TYPE (Template parameter) the mesh type that will be constructed - * @param WALKER_TYPE (Template parameter) the class that implements the traversal ordering of the volume. - **/ - template - class ExtendedMarchingCubes - { - public: -#if defined(__GNUC__) - typedef unsigned int size_t; -#else -#ifdef _WIN64 - typedef unsigned __int64 size_t; -#else - typedef _W64 unsigned int size_t; -#endif -#endif - typedef typename vcg::tri::Allocator< TRIMESH_TYPE > AllocatorType; - typedef typename TRIMESH_TYPE::ScalarType ScalarType; - typedef typename TRIMESH_TYPE::VertexType VertexType; - typedef typename TRIMESH_TYPE::VertexPointer VertexPointer; - typedef typename TRIMESH_TYPE::VertexIterator VertexIterator; - typedef typename TRIMESH_TYPE::FaceType FaceType; - typedef typename TRIMESH_TYPE::FacePointer FacePointer; - typedef typename TRIMESH_TYPE::FaceIterator FaceIterator; - typedef typename TRIMESH_TYPE::CoordType CoordType; - typedef typename TRIMESH_TYPE::CoordType* CoordPointer; - - struct LightEdge - { - LightEdge(size_t _face, size_t _edge):face(_face), edge(_edge) { } - size_t face, edge; - }; - - /*! - * Constructor - * \param mesh The mesh that will be constructed - * \param volume The volume describing the field - * \param walker The class implementing the traversal policy - * \param angle The feature detection threshold misuring the sharpness of a feature(default is 30 degree) - */ - ExtendedMarchingCubes(TRIMESH_TYPE &mesh, WALKER_TYPE &walker, ScalarType angle=30) - { - _mesh = &mesh; - _walker = &walker; - _featureAngle = vcg::math::ToRad(angle); - _initialized = _finalized = false; - }; - - /*! - * Execute the initialiazation. - * This method must be executed before the first call to ApplyEMC - */ - void Initialize() - { - assert(!_initialized && !_finalized); - _featureFlag = VertexType::NewBitFlag(); - _initialized = true; - }; - - /*! - * - * This method must be executed after the last call to ApplyEMC - */ - void Finalize() - { - assert(_initialized && !_finalized); - FlipEdges(); - - VertexIterator v_iter = _mesh->vert.begin(); - VertexIterator v_end = _mesh->vert.end(); - for ( ; v_iter!=v_end; v_iter++) - v_iter->ClearUserBit( _featureFlag ); - VertexType::DeleteBitFlag( _featureFlag ); - _featureFlag = 0; - _mesh = NULL; - _walker = NULL; - _finalized = true; - }; - - /*! - * Apply the extended marching cubes algorithm to the volume cell identified by the two points min and max. - * All the three coordinates of the first point must be smaller than the respectives three coordinatas of the second point. - * \param min the first point - * \param max the second point - */ - void ProcessCell(const vcg::Point3i &min, const vcg::Point3i &max) - { - assert(_initialized && !_finalized); - assert(min[0]V(_corners[0].X(), _corners[0].Y(), _corners[0].Z())) >= 0) cubetype+= 1; - if ((_field[1] = _walker->V(_corners[1].X(), _corners[1].Y(), _corners[1].Z())) >= 0) cubetype+= 2; - if ((_field[2] = _walker->V(_corners[2].X(), _corners[2].Y(), _corners[2].Z())) >= 0) cubetype+= 4; - if ((_field[3] = _walker->V(_corners[3].X(), _corners[3].Y(), _corners[3].Z())) >= 0) cubetype+= 8; - if ((_field[4] = _walker->V(_corners[4].X(), _corners[4].Y(), _corners[4].Z())) >= 0) cubetype+= 16; - if ((_field[5] = _walker->V(_corners[5].X(), _corners[5].Y(), _corners[5].Z())) >= 0) cubetype+= 32; - if ((_field[6] = _walker->V(_corners[6].X(), _corners[6].Y(), _corners[6].Z())) >= 0) cubetype+= 64; - if ((_field[7] = _walker->V(_corners[7].X(), _corners[7].Y(), _corners[7].Z())) >= 0) cubetype+=128; - - if (cubetype==0 || cubetype==255) - return; - - size_t vertices_idx[12]; - memset(vertices_idx, -1, 12*sizeof(size_t)); - int code = EMCLookUpTable::EdgeTable(cubetype); - VertexPointer vp = NULL; - if ( 1&code ) { _walker->GetXIntercept(_corners[0], _corners[1], vp); vertices_idx[ 0] = vp - &_mesh->vert[0]; } - if ( 2&code ) { _walker->GetYIntercept(_corners[1], _corners[2], vp); vertices_idx[ 1] = vp - &_mesh->vert[0]; } - if ( 4&code ) { _walker->GetXIntercept(_corners[3], _corners[2], vp); vertices_idx[ 2] = vp - &_mesh->vert[0]; } - if ( 8&code ) { _walker->GetYIntercept(_corners[0], _corners[3], vp); vertices_idx[ 3] = vp - &_mesh->vert[0]; } - if ( 16&code ) { _walker->GetXIntercept(_corners[4], _corners[5], vp); vertices_idx[ 4] = vp - &_mesh->vert[0]; } - if ( 32&code ) { _walker->GetYIntercept(_corners[5], _corners[6], vp); vertices_idx[ 5] = vp - &_mesh->vert[0]; } - if ( 64&code ) { _walker->GetXIntercept(_corners[7], _corners[6], vp); vertices_idx[ 6] = vp - &_mesh->vert[0]; } - if ( 128&code ) { _walker->GetYIntercept(_corners[4], _corners[7], vp); vertices_idx[ 7] = vp - &_mesh->vert[0]; } - if ( 256&code ) { _walker->GetZIntercept(_corners[0], _corners[4], vp); vertices_idx[ 8] = vp - &_mesh->vert[0]; } - if ( 512&code ) { _walker->GetZIntercept(_corners[1], _corners[5], vp); vertices_idx[ 9] = vp - &_mesh->vert[0]; } - if (1024&code ) { _walker->GetZIntercept(_corners[2], _corners[6], vp); vertices_idx[10] = vp - &_mesh->vert[0]; } - if (2048&code ) { _walker->GetZIntercept(_corners[3], _corners[7], vp); vertices_idx[11] = vp - &_mesh->vert[0]; } - - int m, n, vertices_num; - int components = EMCLookUpTable::TriTable(cubetype, 1)[0]; //unsigned int components = triTable[cubetype][1][0]; - int *indices = &EMCLookUpTable::TriTable(cubetype, 1)[components+1]; //int *indices = &EMCLookUpTable::TriTable(cubetype, 1, components+1); - - std::vector< size_t > vertices_list; - for (m=1; m<=components; m++) - { - // current sheet contains vertices_num vertices - vertices_num = EMCLookUpTable::TriTable(cubetype, 1)[m]; //vertices_num = triTable[cubetype][1][m]; - - // collect vertices - vertices_list.clear(); - for (n=0; n create triangle fan around feature vertex - size_t feature_idx = feature - &_mesh->vert[0]; - size_t face_idx = _mesh->face.size(); - vertices_list.push_back( vertices_list[0] ); - AllocatorType::AddFaces(*_mesh, (int) vertices_num); - for (int j=0; jface[face_idx].V(0) = &_mesh->vert[ vertices_list[j ] ]; - _mesh->face[face_idx].V(1) = &_mesh->vert[ vertices_list[j+1] ]; - _mesh->face[face_idx].V(2) = &_mesh->vert[ feature_idx ]; - } - } - else - { - // no feature -> old marching cubes triangle table - for (int j=0; EMCLookUpTable::PolyTable(vertices_num, j) != -1; j+=3) //for (int j=0; polyTable[vertices_num][j] != -1; j+=3) - { - size_t face_idx = _mesh->face.size(); - AllocatorType::AddFaces(*_mesh, 1); - //_mesh->face[ face_idx].V(0) = &_mesh->vert[ vertices_idx[ indices[ polyTable[vertices_num][j ] ] ] ]; - //_mesh->face[ face_idx].V(1) = &_mesh->vert[ vertices_idx[ indices[ polyTable[vertices_num][j+1] ] ] ]; - //_mesh->face[ face_idx].V(2) = &_mesh->vert[ vertices_idx[ indices[ polyTable[vertices_num][j+2] ] ] ]; - _mesh->face[ face_idx].V(0) = &_mesh->vert[ vertices_idx[ indices[ EMCLookUpTable::PolyTable(vertices_num, j ) ] ] ]; - _mesh->face[ face_idx].V(1) = &_mesh->vert[ vertices_idx[ indices[ EMCLookUpTable::PolyTable(vertices_num, j+1) ] ] ]; - _mesh->face[ face_idx].V(2) = &_mesh->vert[ vertices_idx[ indices[ EMCLookUpTable::PolyTable(vertices_num, j+2) ] ] ]; - } - } - indices += vertices_num; - - } - }; // end of ApplyEMC - - private: - /*! - */ - WALKER_TYPE *_walker; - /*! - */ - TRIMESH_TYPE *_mesh; - /*! - */ - bool _initialized;; - /*! - */ - bool _finalized; - /*! - * The feature detection threshold misuring the sharpness of a feature - */ - ScalarType _featureAngle; - /*! - * The flag used for marking the feature vertices. - */ - int _featureFlag; - /*! - * Array of the 8 corners of the volume cell being processed - */ - vcg::Point3i _corners[8]; - /*! - * The field value at the cell corners - */ - ScalarType _field[8]; - - - /*! - * Tests if the surface patch crossing the current cell contains a sharp feature - * \param vertices_idx The list of vertex indices intersecting the edges of the current cell - * \return The pointer to the new Vertex if a feature is detected; NULL otherwise. - */ - VertexPointer FindFeature(const std::vector &vertices_idx) - { - unsigned int i, j, rank; - size_t vertices_num = (size_t) vertices_idx.size(); - - CoordType *points = new CoordType[ vertices_num ]; - CoordType *normals = new CoordType[ vertices_num ]; - Box3 bb; - for (i=0; ivert[ vertices_idx[i] ].P(); - normals[i].Import(_mesh->vert[ vertices_idx[i] ].N()); - bb.Add(points[i]); - } - - // move barycenter of points into (0, 0, 0) - CoordType center((ScalarType) 0.0, (ScalarType) 0.0, (ScalarType) 0.0); - for (i=0; i cos(_featureAngle)) - return NULL; // invalid vertex - - // ok, we have a feature: is it edge or corner, i.e. rank 2 or 3 ? - axis.Normalize(); - for (minC=1.0, maxC=-1.0, i=0; i maxC) maxC = c; - } - c = std::max< double >(fabs(minC), fabs(maxC)); - c = sqrt(1.0-c*c); - rank = (c > cos(_featureAngle) ? 2 : 3); - - // setup linear system (find intersection of tangent planes) - vcg::ndim::Matrix A((unsigned int) vertices_num, 3); - double *b = new double[ vertices_num ]; - for (i=0; i V(3, 3); - double *w = new double[vertices_num]; - vcg::SingularValueDecomposition< typename vcg::ndim::Matrix > (A, w, V, LeaveUnsorted, 100); - - // rank == 2 -> suppress smallest singular value - if (rank == 2) - { - double smin = DBL_MAX; // the max value, as defined in - unsigned int sminid = 0; - unsigned int srank = std::min< unsigned int >(vertices_num, 3u); - - for (i=0; i least squares, least norm solution x - double *x = new double[3]; - vcg::SingularValueBacksubstitution< vcg::ndim::Matrix >(A, w, V, x, b); - - // transform x to world coords - CoordType point((ScalarType) x[0], (ScalarType) x[1], (ScalarType) x[2]); - point += center; - - // Safety check if the feature point found by svd is - // out of the bbox of the vertices perhaps it is better to put it back in the center... - if(!bb.IsIn(point)) point = center; - - // insert the feature-point - VertexPointer mean_point = &*AllocatorType::AddVertices( *_mesh, 1); - mean_point->SetUserBit(_featureFlag); - mean_point->P() = point; - mean_point->N().SetZero(); - delete []x; - delete []points; - delete []normals; - return mean_point; - } // end of FindFeature - - /*! - * Postprocessing step performed during the finalization tha flip some of the mesh edges. - * The flipping criterion is quite simple: each edge is flipped if it will connect two - * feature samples after the flip. - */ - void FlipEdges() - { - size_t i; - std::vector< LightEdge > edges; - FaceIterator f_iter = _mesh->face.begin(); - FaceIterator f_end = _mesh->face.end(); - for (i=0; f_iter!=f_end; f_iter++, i++) - { - if (f_iter->V(1) > f_iter->V(0)) edges.push_back( LightEdge(i,0) ); - if (f_iter->V(2) > f_iter->V(1)) edges.push_back( LightEdge(i,1) ); - if (f_iter->V(0) > f_iter->V(2)) edges.push_back( LightEdge(i,2) ); - } - vcg::tri::UpdateTopology< TRIMESH_TYPE >::FaceFace( *_mesh ); - - // Select all the triangles that has a vertex shared with a non manifold edge. - int nonManifEdge = tri::Clean< TRIMESH_TYPE >::CountNonManifoldEdgeFF(*_mesh,true); - if(nonManifEdge >0) - tri::UpdateSelection< TRIMESH_TYPE >::FaceFromVertexLoose(*_mesh); - //qDebug("Got %i non manif edges",nonManifEdge); - - typename std::vector< LightEdge >::iterator e_it = edges.begin(); - typename std::vector< LightEdge >::iterator e_end = edges.end(); - - FacePointer g, f; - int w, z; - for( ; e_it!=e_end; e_it++) - { - f = &_mesh->face[e_it->face]; - z = (int) e_it->edge; - -// v2------v1 swap the diagonal only if v2 and v3 are feature and v0 and v1 are not. -// | / | -// | / | -// v0------v3 - if (!(f->IsS()) && vcg::face::CheckFlipEdge< FaceType >(*f, z)) - { - VertexPointer v0, v1, v2, v3; - v0 = f->V(z); - v1 = f->V1(z); - v2 = f->V2(z); - g = f->FFp(z); - w = f->FFi(z); - v3 = g->V2(w); - bool b0, b1, b2, b3; - b0 = !v0->IsUserBit(_featureFlag) ; - b1 = !v1->IsUserBit(_featureFlag) ; - b2 = v2->IsUserBit(_featureFlag) ; - b3 = v3->IsUserBit(_featureFlag) ; - if( b0 && b1 && b2 && b3) - vcg::face::FlipEdge< FaceType >(*f, z); - - } // end if (vcg::face::CheckFlipEdge< _Face >(*f, z)) - } // end for( ; e_it!=e_end; e_it++) - }; //end of FlipEdges - }; // end of class ExtendedMarchingCubes - // /*! @} */ - // end of Doxygen documentation - - } // end of namespace tri -}; // end of namespace vcg - -#endif // __VCG_EXTENDED_MARCHING_CUBES diff --git a/vcg/complex/trimesh/create/marching_cubes.h b/vcg/complex/trimesh/create/marching_cubes.h deleted file mode 100644 index 1d732ccc..00000000 --- a/vcg/complex/trimesh/create/marching_cubes.h +++ /dev/null @@ -1,730 +0,0 @@ -/**************************************************************************** -* VCGLib o o * -* Visual and Computer Graphics Library o o * -* _ O _ * -* Copyright(C) 2004 \/)\/ * -* Visual Computing Lab /\/| * -* ISTI - Italian National Research Council | * -* \ * -* All rights reserved. * -* * -* This program is free software; you can redistribute it and/or modify * -* it under the terms of the GNU General Public License as published by * -* the Free Software Foundation; either version 2 of the License, or * -* (at your option) any later version. * -* * -* This program is distributed in the hope that it will be useful, * -* but WITHOUT ANY WARRANTY; without even the implied warranty of * -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * -* for more details. * -* * -****************************************************************************/ -/***************************************************************************/ - -#ifndef __VCG_MARCHING_CUBES -#define __VCG_MARCHING_CUBES - -#include -#include -#include -#include "mc_lookup_table.h" - -namespace vcg -{ - namespace tri - { - // Doxygen documentation - /** \addtogroup trimesh */ - /*@{*/ - - /* - * Cube description: - * 3 ________ 2 _____2__ - * /| /| / | /| - * / | / | 11/ 3 10/ | - * 7 /_______ / | /__6_|__ / |1 - * | | |6 | | | | | - * | 0|__|_____|1 | |__|__0__| - * | / | / 7 8/ 5 / - * | / | / | / | /9 - * |/_______|/ |/___4___|/ - * 4 5 - */ - - //! This class implements the Marching Cubes algorithm. - /*! - * The implementation is enough generic: this class works only on one volume cell for each - * call to ProcessCell. Using the field value at the cell corners, it adds to the - * mesh the triangles set approximating the surface that cross that cell. The ambiguities - * are resolved using an enhanced topologically controlled lookup table. - * @param TRIMESH_TYPE (Template parameter) the mesh type that will be constructed - * @param WALKER_TYPE (Template parameter) the class that implement the traversal ordering of the volume - **/ - template - class MarchingCubes - { - public: - enum Dimension {X, Y, Z}; - -#if defined(__GNUC__) - typedef unsigned int size_t; -#else -#ifdef _WIN64 - typedef unsigned __int64 size_t; -#else - typedef _W64 unsigned int size_t; -#endif -#endif - typedef typename vcg::tri::Allocator< TRIMESH_TYPE > AllocatorType; - typedef typename TRIMESH_TYPE::ScalarType ScalarType; - typedef typename TRIMESH_TYPE::VertexType VertexType; - typedef typename TRIMESH_TYPE::VertexPointer VertexPointer; - typedef typename TRIMESH_TYPE::VertexIterator VertexIterator; - typedef typename TRIMESH_TYPE::FaceType FaceType; - typedef typename TRIMESH_TYPE::FacePointer FacePointer; - typedef typename TRIMESH_TYPE::FaceIterator FaceIterator; - typedef typename TRIMESH_TYPE::CoordType CoordType; - typedef typename TRIMESH_TYPE::CoordType* CoordPointer; - - /*! - * Constructor - * \param mesh the mesh that will be constructed - * \param walker the class implementing the traversal policy - */ - MarchingCubes(TRIMESH_TYPE &mesh, WALKER_TYPE &walker) - { - _mesh = &mesh; - _walker = &walker; - }; - - /*! - * Execute the initialiazation. - * This method must be executed before the first call to ApplyMC - */ - void Initialize() - { - _mesh->Clear(); - }; // end of Initialize() - - /*! - * - * This method must be executed after the last call to ApplyMC - */ - void Finalize() - { - _mesh = NULL; - _walker = NULL; - }; // end of Finalize() - - /*! - * Apply the marching cubes algorithm to the volume cell identified by the two points min and max. - * All the three coordinates of the first point must be smaller than the respectives three coordinatas of the second point. - * \param min the first point - * \param max the second point - */ - void ProcessCell(const vcg::Point3i &min, const vcg::Point3i &max) - { - _case = _subconfig = _config = -1; - assert(min[0]V( _corners[i].X(), _corners[i].Y(), _corners[i].Z() ); - - unsigned char cubetype = 0; - for (int i=0; i<8; i++) - if (_field[i]>0) cubetype += 1<= 0 ; // face and A invert signs - }; // end of TestFace - - - /*! - * Tests if the components of the tesselation of the cube should be connected - * through the interior of the cube - */ - inline bool TestInterior(signed char s) - { - ScalarType t, At=0, Bt=0, Ct=0, Dt=0, a, b ; - char test = 0 ; - char edge = -1 ; // reference edge of the triangulation - - switch( _case ) - { - case 4 : - case 10 : - { - a = (_field[4]-_field[0])*(_field[6]-_field[2]) - (_field[7]-_field[3])*(_field[5]-_field[1]); - b = _field[2]*(_field[4]-_field[0])+_field[0]*(_field[6]-_field[2])-_field[1]*(_field[7]-_field[3])-_field[3]*(_field[5]-_field[1]); - t = - b / (2*a) ; - if( t<0 || t>1 ) - return s>0 ; - - At = _field[0] + ( _field[4] - _field[0] ) * t ; - Bt = _field[3] + ( _field[7] - _field[3] ) * t ; - Ct = _field[2] + ( _field[6] - _field[2] ) * t ; - Dt = _field[1] + ( _field[5] - _field[1] ) * t ; - break ; - } - case 6 : - case 7 : - case 12 : - case 13 : - switch( _case ) - { - case 6 : edge = MCLookUpTable::Test6 (_config, 2) ; break ; - case 7 : edge = MCLookUpTable::Test7 (_config, 4) ; break ; - case 12 : edge = MCLookUpTable::Test12(_config, 3) ; break ; - case 13 : edge = MCLookUpTable::Tiling13_5_1(_config, _subconfig)[0] ; break ; - } - switch( edge ) - { - case 0 : - t = _field[0] / ( _field[0] - _field[1] ) ; - At = 0 ; - Bt = _field[3] + ( _field[2] - _field[3] ) * t ; - Ct = _field[7] + ( _field[6] - _field[7] ) * t ; - Dt = _field[4] + ( _field[5] - _field[4] ) * t ; - break ; - case 1 : - t = _field[1] / ( _field[1] - _field[2] ) ; - At = 0 ; - Bt = _field[0] + ( _field[3] - _field[0] ) * t ; - Ct = _field[4] + ( _field[7] - _field[4] ) * t ; - Dt = _field[5] + ( _field[6] - _field[5] ) * t ; - break ; - case 2 : - t = _field[2] / ( _field[2] - _field[3] ) ; - At = 0 ; - Bt = _field[1] + ( _field[0] - _field[1] ) * t ; - Ct = _field[5] + ( _field[4] - _field[5] ) * t ; - Dt = _field[6] + ( _field[7] - _field[6] ) * t ; - break ; - case 3 : - t = _field[3] / ( _field[3] - _field[0] ) ; - At = 0 ; - Bt = _field[2] + ( _field[1] - _field[2] ) * t ; - Ct = _field[6] + ( _field[5] - _field[6] ) * t ; - Dt = _field[7] + ( _field[4] - _field[7] ) * t ; - break ; - case 4 : - t = _field[4] / ( _field[4] - _field[5] ) ; - At = 0 ; - Bt = _field[7] + ( _field[6] - _field[7] ) * t ; - Ct = _field[3] + ( _field[2] - _field[3] ) * t ; - Dt = _field[0] + ( _field[1] - _field[0] ) * t ; - break ; - case 5 : - t = _field[5] / ( _field[5] - _field[6] ) ; - At = 0 ; - Bt = _field[4] + ( _field[7] - _field[4] ) * t ; - Ct = _field[0] + ( _field[3] - _field[0] ) * t ; - Dt = _field[1] + ( _field[2] - _field[1] ) * t ; - break ; - case 6 : - t = _field[6] / ( _field[6] - _field[7] ) ; - At = 0 ; - Bt = _field[5] + ( _field[4] - _field[5] ) * t ; - Ct = _field[1] + ( _field[0] - _field[1] ) * t ; - Dt = _field[2] + ( _field[3] - _field[2] ) * t ; - break ; - case 7 : - t = _field[7] / ( _field[7] - _field[4] ) ; - At = 0 ; - Bt = _field[6] + ( _field[5] - _field[6] ) * t ; - Ct = _field[2] + ( _field[1] - _field[2] ) * t ; - Dt = _field[3] + ( _field[0] - _field[3] ) * t ; - break ; - case 8 : - t = _field[0] / ( _field[0] - _field[4] ) ; - At = 0 ; - Bt = _field[3] + ( _field[7] - _field[3] ) * t ; - Ct = _field[2] + ( _field[6] - _field[2] ) * t ; - Dt = _field[1] + ( _field[5] - _field[1] ) * t ; - break ; - case 9 : - t = _field[1] / ( _field[1] - _field[5] ) ; - At = 0 ; - Bt = _field[0] + ( _field[4] - _field[0] ) * t ; - Ct = _field[3] + ( _field[7] - _field[3] ) * t ; - Dt = _field[2] + ( _field[6] - _field[2] ) * t ; - break ; - case 10 : - t = _field[2] / ( _field[2] - _field[6] ) ; - At = 0 ; - Bt = _field[1] + ( _field[5] - _field[1] ) * t ; - Ct = _field[0] + ( _field[4] - _field[0] ) * t ; - Dt = _field[3] + ( _field[7] - _field[3] ) * t ; - break ; - case 11 : - t = _field[3] / ( _field[3] - _field[7] ) ; - At = 0 ; - Bt = _field[2] + ( _field[6] - _field[2] ) * t ; - Ct = _field[1] + ( _field[5] - _field[1] ) * t ; - Dt = _field[0] + ( _field[4] - _field[0] ) * t ; - break ; - default: { assert(false); /* Invalid edge */ break ; } - } - break ; - - default : assert(false); /* Invalid ambiguous case */ break; - } - - if( At >= 0 ) test ++ ; - if( Bt >= 0 ) test += 2 ; - if( Ct >= 0 ) test += 4 ; - if( Dt >= 0 ) test += 8 ; - switch( test ) - { - case 0 : return s>0 ; - case 1 : return s>0 ; - case 2 : return s>0 ; - case 3 : return s>0 ; - case 4 : return s>0 ; - case 5 : if( At * Ct < Bt * Dt ) return s>0 ; break ; - case 6 : return s>0 ; - case 7 : return s<0 ; - case 8 : return s>0 ; - case 9 : return s>0 ; - case 10 : if( At * Ct >= Bt * Dt ) return s>0 ; break ; - case 11 : return s<0 ; - case 12 : return s>0 ; - case 13 : return s<0 ; - case 14 : return s<0 ; - case 15 : return s<0 ; - } - return s<0 ; - }; //end of TestInterior - - /*! - * Adds a vertex inside the current cube - * \param v The pointer to the new vertex along the edge - */ - inline void ComputeCVertex(VertexPointer &v12) - { - v12 = &*AllocatorType::AddVertices(*_mesh, 1); - v12->P() = CoordType(0.0, 0.0, 0.0); - - unsigned int count = 0; - VertexPointer v = NULL; - if (_walker->Exist(_corners[0], _corners[1], v) ) - { - count++; - v12->P() += v->P(); - } - if (_walker->Exist(_corners[1], _corners[2], v) ) - { - count++; - v12->P() += v->P(); - } - if (_walker->Exist(_corners[3], _corners[2], v) ) - { - count++; - v12->P() += v->P(); - } - if (_walker->Exist(_corners[0], _corners[3], v) ) - { - count++; - v12->P() += v->P(); - } - if (_walker->Exist(_corners[4], _corners[5], v) ) - { - count++; - v12->P() += v->P(); - } - if (_walker->Exist(_corners[5], _corners[6], v) ) - { - count++; - v12->P() += v->P(); - } - if (_walker->Exist(_corners[7], _corners[6], v) ) - { - count++; - v12->P() += v->P(); - } - if (_walker->Exist(_corners[4], _corners[7], v) ) - { - count++; - v12->P() += v->P(); - } - if (_walker->Exist(_corners[0], _corners[4], v) ) - { - count++; - v12->P() += v->P(); - } - if (_walker->Exist(_corners[1], _corners[5], v) ) - { - count++; - v12->P() += v->P(); - } - if (_walker->Exist(_corners[2], _corners[6], v) ) - { - count++; - v12->P() += v->P(); - } - if (_walker->Exist(_corners[3], _corners[7], v) ) - { - count++; - v12->P() += v->P(); - } - v12->P() /= (float) count; - } // end of AddCVertex - /*! - * Adds new triangles to the mesh - * \param vertices_list The list of vertex indices - * \param n The number of triangles that will be added to the mesh - * \param v12 The pointer to the vertex inside the current cell - */ - inline void AddTriangles(const char *vertices_list, char n, VertexPointer v12=NULL) - { - VertexPointer vp = NULL; - size_t face_idx = _mesh->face.size(); - size_t v12_idx = -1; - size_t vertices_idx[3]; - if (v12 != NULL) v12_idx = v12 - &_mesh->vert[0]; - AllocatorType::AddFaces(*_mesh, (int) n); - - for (int trig=0; trig<3*n; face_idx++ ) - { - vp = NULL; - memset(vertices_idx, -1, 3*sizeof(size_t)); - for (int vert=0; vert<3; vert++, trig++) //ok - { - - switch ( vertices_list[trig] ) - { - case 0: { _walker->GetXIntercept(_corners[0], _corners[1], vp); vertices_idx[vert] = vp - &_mesh->vert[0]; break; } - case 1: { _walker->GetYIntercept(_corners[1], _corners[2], vp); vertices_idx[vert] = vp - &_mesh->vert[0]; break; } - case 2: { _walker->GetXIntercept(_corners[3], _corners[2], vp); vertices_idx[vert] = vp - &_mesh->vert[0]; break; } - case 3: { _walker->GetYIntercept(_corners[0], _corners[3], vp); vertices_idx[vert] = vp - &_mesh->vert[0]; break; } - case 4: { _walker->GetXIntercept(_corners[4], _corners[5], vp); vertices_idx[vert] = vp - &_mesh->vert[0]; break; } - case 5: { _walker->GetYIntercept(_corners[5], _corners[6], vp); vertices_idx[vert] = vp - &_mesh->vert[0]; break; } - case 6: { _walker->GetXIntercept(_corners[7], _corners[6], vp); vertices_idx[vert] = vp - &_mesh->vert[0]; break; } - case 7: { _walker->GetYIntercept(_corners[4], _corners[7], vp); vertices_idx[vert] = vp - &_mesh->vert[0]; break; } - case 8: { _walker->GetZIntercept(_corners[0], _corners[4], vp); vertices_idx[vert] = vp - &_mesh->vert[0]; break; } - case 9: { _walker->GetZIntercept(_corners[1], _corners[5], vp); vertices_idx[vert] = vp - &_mesh->vert[0]; break; } - case 10: { _walker->GetZIntercept(_corners[2], _corners[6], vp); vertices_idx[vert] = vp - &_mesh->vert[0]; break; } - case 11: { _walker->GetZIntercept(_corners[3], _corners[7], vp); vertices_idx[vert] = vp - &_mesh->vert[0]; break; } - case 12: { assert(v12 != NULL); vertices_idx[vert] = v12_idx; break; } - default: { assert(false); /* Invalid edge identifier */ } - } // end of switch - - // Note that vp can be zero if we are in case 12 and that vertices_idx is surely >0 so the following assert has to be corrected as below. - // assert((vp - &_mesh->vert[0])>=0 && vertices_idx[vert]<_mesh->vert.size()); - assert(vertices_idx[vert]<_mesh->vert.size()); - } // end for (int vert=0 ...) - - _mesh->face[face_idx].V(0) = &_mesh->vert[vertices_idx[0]]; - _mesh->face[face_idx].V(1) = &_mesh->vert[vertices_idx[1]]; - _mesh->face[face_idx].V(2) = &_mesh->vert[vertices_idx[2]]; - } // end for (int trig=0...) - }; // end of AddTriangles - - - }; // end of class MarchingCubes - - /*! @} */ - //end of Doxygen documentation - - }; // end of namespace tri -}; // end of namespace vcg - -#endif //__VCG_MARCHING_CUBES diff --git a/vcg/complex/trimesh/create/mc_lookup_table.h b/vcg/complex/trimesh/create/mc_lookup_table.h deleted file mode 100644 index 12669550..00000000 --- a/vcg/complex/trimesh/create/mc_lookup_table.h +++ /dev/null @@ -1,2560 +0,0 @@ -/** -* @file LookUpTable.h -* @author Thomas Lewiner -* @author Math Dept, PUC-Rio -* @version 0.2 -* @date 12/08/2002 -* -* @brief LookUpTable for the MarchingCubes 33 Algorithm -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) -* for more details. -*/ -//________________________________________________ - - -#ifndef __VCG_MC_LOOK_UP_TABLE -#define __VCG_MC_LOOK_UP_TABLE - -namespace vcg -{ - namespace tri - { - class MCLookUpTable - { - public: - //_____________________________________________________________________________ - /** - * \brief case mapping - * For each of the possible vertex states listed in this table there is a - * specific triangulation of the edge intersection points. The table lists - * all of them in the form of 0-5 edge triples with the list terminated by - * the invalid value -1. For example: case[3] list the 2 triangles - * formed when cube[0] and cube[1] are inside of the surface, but the rest of - * the cube is not. - * - * Cube description: - * 7 ________ 6 _____6__ ________ - * /| /| 7/| /| /| /| - * / | / | / | /5 | / 6 / | - * 4 /_______ / | /__4____ / 10 /_______3/ | - * | | |5 | | 11 | | | | | 2 | - * | 3|__|_____|2 | |__|__2__| | 4 |__|_____| - * | / | / 8 3/ 9 / | / | / - * | / | / | / | /1 | / 5 / - * |/_______|/ |/___0___|/ |/_1_____|/ - * 0 1 0 1 - */ - //----------------------------------------------------------------------------- - static char Cases(unsigned char cubetype, unsigned char u) - { - static const char cases[256][2] = { - /* 0: */ { 0, -1 }, - /* 1: 0, */ { 1, 0 }, - /* 2: 1, */ { 1, 1 }, - /* 3: 0, 1, */ { 2, 0 }, - /* 4: 2, */ { 1, 2 }, - /* 5: 0, 2, */ { 3, 0 }, - /* 6: 1, 2, */ { 2, 3 }, - /* 7: 0, 1, 2, */ { 5, 0 }, - /* 8: 3, */ { 1, 3 }, - /* 9: 0, 3, */ { 2, 1 }, - /* 10: 1, 3, */ { 3, 3 }, - /* 11: 0, 1, 3, */ { 5, 1 }, - /* 12: 2, 3, */ { 2, 5 }, - /* 13: 0, 2, 3, */ { 5, 4 }, - /* 14: 1, 2, 3, */ { 5, 9 }, - /* 15: 0, 1, 2, 3, */ { 8, 0 }, - /* 16: 4, */ { 1, 4 }, - /* 17: 0, 4, */ { 2, 2 }, - /* 18: 1, 4, */ { 3, 4 }, - /* 19: 0, 1, 4, */ { 5, 2 }, - /* 20: 2, 4, */ { 4, 2 }, - /* 21: 0, 2, 4, */ { 6, 2 }, - /* 22: 1, 2, 4, */ { 6, 9 }, - /* 23: 0, 1, 2, 4, */ { 11, 0 }, - /* 24: 3, 4, */ { 3, 8 }, - /* 25: 0, 3, 4, */ { 5, 5 }, - /* 26: 1, 3, 4, */ { 7, 3 }, - /* 27: 0, 1, 3, 4, */ { 9, 1 }, - /* 28: 2, 3, 4, */ { 6, 16 }, - /* 29: 0, 2, 3, 4, */ { 14, 3 }, - /* 30: 1, 2, 3, 4, */ { 12, 12 }, - /* 31: 0, 1, 2, 3, 4, */ { 5, 24 }, - /* 32: 5, */ { 1, 5 }, - /* 33: 0, 5, */ { 3, 1 }, - /* 34: 1, 5, */ { 2, 4 }, - /* 35: 0, 1, 5, */ { 5, 3 }, - /* 36: 2, 5, */ { 3, 6 }, - /* 37: 0, 2, 5, */ { 7, 0 }, - /* 38: 1, 2, 5, */ { 5, 10 }, - /* 39: 0, 1, 2, 5, */ { 9, 0 }, - /* 40: 3, 5, */ { 4, 3 }, - /* 41: 0, 3, 5, */ { 6, 4 }, - /* 42: 1, 3, 5, */ { 6, 11 }, - /* 43: 0, 1, 3, 5, */ { 14, 1 }, - /* 44: 2, 3, 5, */ { 6, 17 }, - /* 45: 0, 2, 3, 5, */ { 12, 4 }, - /* 46: 1, 2, 3, 5, */ { 11, 6 }, - /* 47: 0, 1, 2, 3, 5, */ { 5, 25 }, - /* 48: 4, 5, */ { 2, 8 }, - /* 49: 0, 4, 5, */ { 5, 7 }, - /* 50: 1, 4, 5, */ { 5, 12 }, - /* 51: 0, 1, 4, 5, */ { 8, 1 }, - /* 52: 2, 4, 5, */ { 6, 18 }, - /* 53: 0, 2, 4, 5, */ { 12, 5 }, - /* 54: 1, 2, 4, 5, */ { 14, 7 }, - /* 55: 0, 1, 2, 4, 5, */ { 5, 28 }, - /* 56: 3, 4, 5, */ { 6, 21 }, - /* 57: 0, 3, 4, 5, */ { 11, 4 }, - /* 58: 1, 3, 4, 5, */ { 12, 15 }, - /* 59: 0, 1, 3, 4, 5, */ { 5, 30 }, - /* 60: 2, 3, 4, 5, */ { 10, 5 }, - /* 61: 0, 2, 3, 4, 5, */ { 6, 32 }, - /* 62: 1, 2, 3, 4, 5, */ { 6, 39 }, - /* 63: 0, 1, 2, 3, 4, 5, */ { 2, 12 }, - /* 64: 6, */ { 1, 6 }, - /* 65: 0, 6, */ { 4, 0 }, - /* 66: 1, 6, */ { 3, 5 }, - /* 67: 0, 1, 6, */ { 6, 0 }, - /* 68: 2, 6, */ { 2, 6 }, - /* 69: 0, 2, 6, */ { 6, 3 }, - /* 70: 1, 2, 6, */ { 5, 11 }, - /* 71: 0, 1, 2, 6, */ { 14, 0 }, - /* 72: 3, 6, */ { 3, 9 }, - /* 73: 0, 3, 6, */ { 6, 5 }, - /* 74: 1, 3, 6, */ { 7, 4 }, - /* 75: 0, 1, 3, 6, */ { 12, 1 }, - /* 76: 2, 3, 6, */ { 5, 14 }, - /* 77: 0, 2, 3, 6, */ { 11, 3 }, - /* 78: 1, 2, 3, 6, */ { 9, 4 }, - /* 79: 0, 1, 2, 3, 6, */ { 5, 26 }, - /* 80: 4, 6, */ { 3, 10 }, - /* 81: 0, 4, 6, */ { 6, 6 }, - /* 82: 1, 4, 6, */ { 7, 5 }, - /* 83: 0, 1, 4, 6, */ { 12, 2 }, - /* 84: 2, 4, 6, */ { 6, 19 }, - /* 85: 0, 2, 4, 6, */ { 10, 1 }, - /* 86: 1, 2, 4, 6, */ { 12, 13 }, - /* 87: 0, 1, 2, 4, 6, */ { 6, 24 }, - /* 88: 3, 4, 6, */ { 7, 7 }, - /* 89: 0, 3, 4, 6, */ { 12, 9 }, - /* 90: 1, 3, 4, 6, */ { 13, 1 }, - /* 91: 0, 1, 3, 4, 6, */ { 7, 9 }, - /* 92: 2, 3, 4, 6, */ { 12, 20 }, - /* 93: 0, 2, 3, 4, 6, */ { 6, 33 }, - /* 94: 1, 2, 3, 4, 6, */ { 7, 13 }, - /* 95: 0, 1, 2, 3, 4, 6, */ { 3, 12 }, - /* 96: 5, 6, */ { 2, 10 }, - /* 97: 0, 5, 6, */ { 6, 7 }, - /* 98: 1, 5, 6, */ { 5, 13 }, - /* 99: 0, 1, 5, 6, */ { 11, 2 }, - /* 100: 2, 5, 6, */ { 5, 16 }, - /* 101: 0, 2, 5, 6, */ { 12, 7 }, - /* 102: 1, 2, 5, 6, */ { 8, 3 }, - /* 103: 0, 1, 2, 5, 6, */ { 5, 29 }, - /* 104: 3, 5, 6, */ { 6, 22 }, - /* 105: 0, 3, 5, 6, */ { 10, 2 }, - /* 106: 1, 3, 5, 6, */ { 12, 17 }, - /* 107: 0, 1, 3, 5, 6, */ { 6, 27 }, - /* 108: 2, 3, 5, 6, */ { 14, 9 }, - /* 109: 0, 2, 3, 5, 6, */ { 6, 34 }, - /* 110: 1, 2, 3, 5, 6, */ { 5, 39 }, - /* 111: 0, 1, 2, 3, 5, 6, */ { 2, 14 }, - /* 112: 4, 5, 6, */ { 5, 20 }, - /* 113: 0, 4, 5, 6, */ { 14, 5 }, - /* 114: 1, 4, 5, 6, */ { 9, 5 }, - /* 115: 0, 1, 4, 5, 6, */ { 5, 32 }, - /* 116: 2, 4, 5, 6, */ { 11, 10 }, - /* 117: 0, 2, 4, 5, 6, */ { 6, 35 }, - /* 118: 1, 2, 4, 5, 6, */ { 5, 41 }, - /* 119: 0, 1, 2, 4, 5, 6, */ { 2, 16 }, - /* 120: 3, 4, 5, 6, */ { 12, 23 }, - /* 121: 0, 3, 4, 5, 6, */ { 6, 37 }, - /* 122: 1, 3, 4, 5, 6, */ { 7, 14 }, - /* 123: 0, 1, 3, 4, 5, 6, */ { 3, 16 }, - /* 124: 2, 3, 4, 5, 6, */ { 6, 46 }, - /* 125: 0, 2, 3, 4, 5, 6, */ { 4, 6 }, - /* 126: 1, 2, 3, 4, 5, 6, */ { 3, 21 }, - /* 127: 0, 1, 2, 3, 4, 5, 6, */ { 1, 8 }, - /* 128: 7, */ { 1, 7 }, - /* 129: 0, 7, */ { 3, 2 }, - /* 130: 1, 7, */ { 4, 1 }, - /* 131: 0, 1, 7, */ { 6, 1 }, - /* 132: 2, 7, */ { 3, 7 }, - /* 133: 0, 2, 7, */ { 7, 1 }, - /* 134: 1, 2, 7, */ { 6, 10 }, - /* 135: 0, 1, 2, 7, */ { 12, 0 }, - /* 136: 3, 7, */ { 2, 7 }, - /* 137: 0, 3, 7, */ { 5, 6 }, - /* 138: 1, 3, 7, */ { 6, 12 }, - /* 139: 0, 1, 3, 7, */ { 11, 1 }, - /* 140: 2, 3, 7, */ { 5, 15 }, - /* 141: 0, 2, 3, 7, */ { 9, 2 }, - /* 142: 1, 2, 3, 7, */ { 14, 6 }, - /* 143: 0, 1, 2, 3, 7, */ { 5, 27 }, - /* 144: 4, 7, */ { 2, 9 }, - /* 145: 0, 4, 7, */ { 5, 8 }, - /* 146: 1, 4, 7, */ { 6, 13 }, - /* 147: 0, 1, 4, 7, */ { 14, 2 }, - /* 148: 2, 4, 7, */ { 6, 20 }, - /* 149: 0, 2, 4, 7, */ { 12, 6 }, - /* 150: 1, 2, 4, 7, */ { 10, 3 }, - /* 151: 0, 1, 2, 4, 7, */ { 6, 25 }, - /* 152: 3, 4, 7, */ { 5, 18 }, - /* 153: 0, 3, 4, 7, */ { 8, 2 }, - /* 154: 1, 3, 4, 7, */ { 12, 16 }, - /* 155: 0, 1, 3, 4, 7, */ { 5, 31 }, - /* 156: 2, 3, 4, 7, */ { 11, 9 }, - /* 157: 0, 2, 3, 4, 7, */ { 5, 34 }, - /* 158: 1, 2, 3, 4, 7, */ { 6, 40 }, - /* 159: 0, 1, 2, 3, 4, 7, */ { 2, 13 }, - /* 160: 5, 7, */ { 3, 11 }, - /* 161: 0, 5, 7, */ { 7, 2 }, - /* 162: 1, 5, 7, */ { 6, 14 }, - /* 163: 0, 1, 5, 7, */ { 12, 3 }, - /* 164: 2, 5, 7, */ { 7, 6 }, - /* 165: 0, 2, 5, 7, */ { 13, 0 }, - /* 166: 1, 2, 5, 7, */ { 12, 14 }, - /* 167: 0, 1, 2, 5, 7, */ { 7, 8 }, - /* 168: 3, 5, 7, */ { 6, 23 }, - /* 169: 0, 3, 5, 7, */ { 12, 10 }, - /* 170: 1, 3, 5, 7, */ { 10, 4 }, - /* 171: 0, 1, 3, 5, 7, */ { 6, 28 }, - /* 172: 2, 3, 5, 7, */ { 12, 21 }, - /* 173: 0, 2, 3, 5, 7, */ { 7, 10 }, - /* 174: 1, 2, 3, 5, 7, */ { 6, 41 }, - /* 175: 0, 1, 2, 3, 5, 7, */ { 3, 13 }, - /* 176: 4, 5, 7, */ { 5, 21 }, - /* 177: 0, 4, 5, 7, */ { 9, 3 }, - /* 178: 1, 4, 5, 7, */ { 11, 8 }, - /* 179: 0, 1, 4, 5, 7, */ { 5, 33 }, - /* 180: 2, 4, 5, 7, */ { 12, 22 }, - /* 181: 0, 2, 4, 5, 7, */ { 7, 11 }, - /* 182: 1, 2, 4, 5, 7, */ { 6, 42 }, - /* 183: 0, 1, 2, 4, 5, 7, */ { 3, 14 }, - /* 184: 3, 4, 5, 7, */ { 14, 11 }, - /* 185: 0, 3, 4, 5, 7, */ { 5, 36 }, - /* 186: 1, 3, 4, 5, 7, */ { 6, 44 }, - /* 187: 0, 1, 3, 4, 5, 7, */ { 2, 17 }, - /* 188: 2, 3, 4, 5, 7, */ { 6, 47 }, - /* 189: 0, 2, 3, 4, 5, 7, */ { 3, 18 }, - /* 190: 1, 2, 3, 4, 5, 7, */ { 4, 7 }, - /* 191: 0, 1, 2, 3, 4, 5, 7, */ { 1, 9 }, - /* 192: 6, 7, */ { 2, 11 }, - /* 193: 0, 6, 7, */ { 6, 8 }, - /* 194: 1, 6, 7, */ { 6, 15 }, - /* 195: 0, 1, 6, 7, */ { 10, 0 }, - /* 196: 2, 6, 7, */ { 5, 17 }, - /* 197: 0, 2, 6, 7, */ { 12, 8 }, - /* 198: 1, 2, 6, 7, */ { 11, 7 }, - /* 199: 0, 1, 2, 6, 7, */ { 6, 26 }, - /* 200: 3, 6, 7, */ { 5, 19 }, - /* 201: 0, 3, 6, 7, */ { 14, 4 }, - /* 202: 1, 3, 6, 7, */ { 12, 18 }, - /* 203: 0, 1, 3, 6, 7, */ { 6, 29 }, - /* 204: 2, 3, 6, 7, */ { 8, 4 }, - /* 205: 0, 2, 3, 6, 7, */ { 5, 35 }, - /* 206: 1, 2, 3, 6, 7, */ { 5, 40 }, - /* 207: 0, 1, 2, 3, 6, 7, */ { 2, 15 }, - /* 208: 4, 6, 7, */ { 5, 22 }, - /* 209: 0, 4, 6, 7, */ { 11, 5 }, - /* 210: 1, 4, 6, 7, */ { 12, 19 }, - /* 211: 0, 1, 4, 6, 7, */ { 6, 30 }, - /* 212: 2, 4, 6, 7, */ { 14, 10 }, - /* 213: 0, 2, 4, 6, 7, */ { 6, 36 }, - /* 214: 1, 2, 4, 6, 7, */ { 6, 43 }, - /* 215: 0, 1, 2, 4, 6, 7, */ { 4, 4 }, - /* 216: 3, 4, 6, 7, */ { 9, 7 }, - /* 217: 0, 3, 4, 6, 7, */ { 5, 37 }, - /* 218: 1, 3, 4, 6, 7, */ { 7, 15 }, - /* 219: 0, 1, 3, 4, 6, 7, */ { 3, 17 }, - /* 220: 2, 3, 4, 6, 7, */ { 5, 44 }, - /* 221: 0, 2, 3, 4, 6, 7, */ { 2, 19 }, - /* 222: 1, 2, 3, 4, 6, 7, */ { 3, 22 }, - /* 223: 0, 1, 2, 3, 4, 6, 7, */ { 1, 10 }, - /* 224: 5, 6, 7, */ { 5, 23 }, - /* 225: 0, 5, 6, 7, */ { 12, 11 }, - /* 226: 1, 5, 6, 7, */ { 14, 8 }, - /* 227: 0, 1, 5, 6, 7, */ { 6, 31 }, - /* 228: 2, 5, 6, 7, */ { 9, 6 }, - /* 229: 0, 2, 5, 6, 7, */ { 7, 12 }, - /* 230: 1, 2, 5, 6, 7, */ { 5, 42 }, - /* 231: 0, 1, 2, 5, 6, 7, */ { 3, 15 }, - /* 232: 3, 5, 6, 7, */ { 11, 11 }, - /* 233: 0, 3, 5, 6, 7, */ { 6, 38 }, - /* 234: 1, 3, 5, 6, 7, */ { 6, 45 }, - /* 235: 0, 1, 3, 5, 6, 7, */ { 4, 5 }, - /* 236: 2, 3, 5, 6, 7, */ { 5, 45 }, - /* 237: 0, 2, 3, 5, 6, 7, */ { 3, 19 }, - /* 238: 1, 2, 3, 5, 6, 7, */ { 2, 21 }, - /* 239: 0, 1, 2, 3, 5, 6, 7, */ { 1, 11 }, - /* 240: 4, 5, 6, 7, */ { 8, 5 }, - /* 241: 0, 4, 5, 6, 7, */ { 5, 38 }, - /* 242: 1, 4, 5, 6, 7, */ { 5, 43 }, - /* 243: 0, 1, 4, 5, 6, 7, */ { 2, 18 }, - /* 244: 2, 4, 5, 6, 7, */ { 5, 46 }, - /* 245: 0, 2, 4, 5, 6, 7, */ { 3, 20 }, - /* 246: 1, 2, 4, 5, 6, 7, */ { 2, 22 }, - /* 247: 0, 1, 2, 4, 5, 6, 7, */ { 1, 12 }, - /* 248: 3, 4, 5, 6, 7, */ { 5, 47 }, - /* 249: 0, 3, 4, 5, 6, 7, */ { 2, 20 }, - /* 250: 1, 3, 4, 5, 6, 7, */ { 3, 23 }, - /* 251: 0, 1, 3, 4, 5, 6, 7, */ { 1, 13 }, - /* 252: 2, 3, 4, 5, 6, 7, */ { 2, 23 }, - /* 253: 0, 2, 3, 4, 5, 6, 7, */ { 1, 14 }, - /* 254: 1, 2, 3, 4, 5, 6, 7, */ { 1, 15 }, - /* 255: 0, 1, 2, 3, 4, 5, 6, 7, */ { 0, -1 } - }; - return cases[cubetype][u]; - }; // end of Cases - //_____________________________________________________________________________ - - - //_____________________________________________________________________________ - /** - * \brief tiling table for case 1 - * For each of the case above, the specific triangulation of the edge - * intersection points is given. - * When a case is ambiguous, there is an auxiliary table that contains - * the face number to test and the tiling table contains the specific - * triangulations depending on the results - * A minus sign means to invert the result of the test. - */ - //----------------------------------------------------------------------------- - static const char* Tiling1(unsigned char config) - { - static const char tiling1[16][3] = { - /* 1: 0, */ { 0, 8, 3 }, - /* 2: 1, */ { 0, 1, 9 }, - /* 4: 2, */ { 1, 2, 10 }, - /* 8: 3, */ { 3, 11, 2 }, - /* 16: 4, */ { 4, 7, 8 }, - /* 32: 5, */ { 9, 5, 4 }, - /* 64: 6, */ { 10, 6, 5 }, - /* 128: 7, */ { 7, 6, 11 }, - /* 127: 0, 1, 2, 3, 4, 5, 6, */ { 7, 11, 6 }, - /* 191: 0, 1, 2, 3, 4, 5, 7, */ { 10, 5, 6 }, - /* 223: 0, 1, 2, 3, 4, 6, 7, */ { 9, 4, 5 }, - /* 239: 0, 1, 2, 3, 5, 6, 7, */ { 4, 8, 7 }, - /* 247: 0, 1, 2, 4, 5, 6, 7, */ { 3, 2, 11 }, - /* 251: 0, 1, 3, 4, 5, 6, 7, */ { 1, 10, 2 }, - /* 253: 0, 2, 3, 4, 5, 6, 7, */ { 0, 9, 1 }, - /* 254: 1, 2, 3, 4, 5, 6, 7, */ { 0, 3, 8 } - }; - return &tiling1[config][0]; - }; // end of Tiling1 - //_____________________________________________________________________________ - - - //_____________________________________________________________________________ - /** - * \brief tiling table for case 2 - * For each of the case above, the specific triangulation of the edge - * intersection points is given. - * When a case is ambiguous, there is an auxiliary table that contains - * the face number to test and the tiling table contains the specific - * triangulations depending on the results - * A minus sign means to invert the result of the test. - */ - //----------------------------------------------------------------------------- - static const char* Tiling2(unsigned char config) - { - static const char tiling2[24][6] = { - /* 3: 0, 1, */ { 1, 8, 3, 9, 8, 1 }, - /* 9: 0, 3, */ { 0, 11, 2, 8, 11, 0 }, - /* 17: 0, 4, */ { 4, 3, 0, 7, 3, 4 }, - /* 6: 1, 2, */ { 9, 2, 10, 0, 2, 9 }, - /* 34: 1, 5, */ { 0, 5, 4, 1, 5, 0 }, - /* 12: 2, 3, */ { 3, 10, 1, 11, 10, 3 }, - /* 68: 2, 6, */ { 1, 6, 5, 2, 6, 1 }, - /* 136: 3, 7, */ { 7, 2, 3, 6, 2, 7 }, - /* 48: 4, 5, */ { 9, 7, 8, 5, 7, 9 }, - /* 144: 4, 7, */ { 6, 8, 4, 11, 8, 6 }, - /* 96: 5, 6, */ { 10, 4, 9, 6, 4, 10 }, - /* 192: 6, 7, */ { 11, 5, 10, 7, 5, 11 }, - /* 63: 0, 1, 2, 3, 4, 5, */ { 11, 10, 5, 7, 11, 5 }, - /* 159: 0, 1, 2, 3, 4, 7, */ { 10, 9, 4, 6, 10, 4 }, - /* 111: 0, 1, 2, 3, 5, 6, */ { 6, 4, 8, 11, 6, 8 }, - /* 207: 0, 1, 2, 3, 6, 7, */ { 9, 8, 7, 5, 9, 7 }, - /* 119: 0, 1, 2, 4, 5, 6, */ { 7, 3, 2, 6, 7, 2 }, - /* 187: 0, 1, 3, 4, 5, 7, */ { 1, 5, 6, 2, 1, 6 }, - /* 243: 0, 1, 4, 5, 6, 7, */ { 3, 1, 10, 11, 3, 10 }, - /* 221: 0, 2, 3, 4, 6, 7, */ { 0, 4, 5, 1, 0, 5 }, - /* 249: 0, 3, 4, 5, 6, 7, */ { 9, 10, 2, 0, 9, 2 }, - /* 238: 1, 2, 3, 5, 6, 7, */ { 4, 0, 3, 7, 4, 3 }, - /* 246: 1, 2, 4, 5, 6, 7, */ { 0, 2, 11, 8, 0, 11 }, - /* 252: 2, 3, 4, 5, 6, 7, */ { 1, 3, 8, 9, 1, 8 } - }; - return &tiling2[config][0]; - }; // end of Tiling2 - //_____________________________________________________________________________ - - - - //_____________________________________________________________________________ - - - /** - * \brief test table for case 3 - * One face to test - * When the test on the specified face is positive : 4 first triangles - * When the test on the specified face is negative : 2 last triangles - * - * For each of the case above, the specific triangulation of the edge - * intersection points is given. - * When a case is ambiguous, there is an auxiliary table that contains - * the face number to test and the tiling table contains the specific - * triangulations depending on the results - * A minus sign means to invert the result of the test. - */ - //----------------------------------------------------------------------------- - static char Test3(unsigned char config) - { - static const char test3[24] = { - /* 5: 0, 2, */ 5, - /* 33: 0, 5, */ 1, - /* 129: 0, 7, */ 4, - /* 10: 1, 3, */ 5, - /* 18: 1, 4, */ 1, - /* 66: 1, 6, */ 2, - /* 36: 2, 5, */ 2, - /* 132: 2, 7, */ 3, - /* 24: 3, 4, */ 4, - /* 72: 3, 6, */ 3, - /* 80: 4, 6, */ 6, - /* 160: 5, 7, */ 6, - /* 95: 0, 1, 2, 3, 4, 6, */ -6, - /* 175: 0, 1, 2, 3, 5, 7, */ -6, - /* 183: 0, 1, 2, 4, 5, 7, */ -3, - /* 231: 0, 1, 2, 5, 6, 7, */ -4, - /* 123: 0, 1, 3, 4, 5, 6, */ -3, - /* 219: 0, 1, 3, 4, 6, 7, */ -2, - /* 189: 0, 2, 3, 4, 5, 7, */ -2, - /* 237: 0, 2, 3, 5, 6, 7, */ -1, - /* 245: 0, 2, 4, 5, 6, 7, */ -5, - /* 126: 1, 2, 3, 4, 5, 6, */ -4, - /* 222: 1, 2, 3, 4, 6, 7, */ -1, - /* 250: 1, 3, 4, 5, 6, 7, */ -5 - }; - return test3[config]; - }; // end of Test3 - - - //_____________________________________________________________________________ - /** - * \brief tiling table for case 3.1 - * For each of the case above, the specific triangulation of the edge - * intersection points is given. - * When a case is ambiguous, there is an auxiliary table that contains - * the face number to test and the tiling table contains the specific - * triangulations depending on the results - * A minus sign means to invert the result of the test. - */ - //----------------------------------------------------------------------------- - static const char* Tiling3_1(unsigned char config) - { - static const char tiling3_1[24][6] = { - /* 5: 0, 2, */ { 0, 8, 3, 1, 2, 10 }, - /* 33: 0, 5, */ { 9, 5, 4, 0, 8, 3 }, - /* 129: 0, 7, */ { 3, 0, 8, 11, 7, 6 }, - /* 10: 1, 3, */ { 1, 9, 0, 2, 3, 11 }, - /* 18: 1, 4, */ { 0, 1, 9, 8, 4, 7 }, - /* 66: 1, 6, */ { 9, 0, 1, 5, 10, 6 }, - /* 36: 2, 5, */ { 1, 2, 10, 9, 5, 4 }, - /* 132: 2, 7, */ { 10, 1, 2, 6, 11, 7 }, - /* 24: 3, 4, */ { 8, 4, 7, 3, 11, 2 }, - /* 72: 3, 6, */ { 2, 3, 11, 10, 6, 5 }, - /* 80: 4, 6, */ { 5, 10, 6, 4, 7, 8 }, - /* 160: 5, 7, */ { 4, 9, 5, 7, 6, 11 }, - /* 95: 0, 1, 2, 3, 4, 6, */ { 5, 9, 4, 11, 6, 7 }, - /* 175: 0, 1, 2, 3, 5, 7, */ { 6, 10, 5, 8, 7, 4 }, - /* 183: 0, 1, 2, 4, 5, 7, */ { 11, 3, 2, 5, 6, 10 }, - /* 231: 0, 1, 2, 5, 6, 7, */ { 7, 4, 8, 2, 11, 3 }, - /* 123: 0, 1, 3, 4, 5, 6, */ { 2, 1, 10, 7, 11, 6 }, - /* 219: 0, 1, 3, 4, 6, 7, */ { 10, 2, 1, 4, 5, 9 }, - /* 189: 0, 2, 3, 4, 5, 7, */ { 1, 0, 9, 6, 10, 5 }, - /* 237: 0, 2, 3, 5, 6, 7, */ { 9, 1, 0, 7, 4, 8 }, - /* 245: 0, 2, 4, 5, 6, 7, */ { 0, 9, 1, 11, 3, 2 }, - /* 126: 1, 2, 3, 4, 5, 6, */ { 8, 0, 3, 6, 7, 11 }, - /* 222: 1, 2, 3, 4, 6, 7, */ { 4, 5, 9, 3, 8, 0 }, - /* 250: 1, 3, 4, 5, 6, 7, */ { 3, 8, 0, 10, 2, 1 } - }; - return &tiling3_1[config][0]; - }; // end of Tiling3_1 - - - //_____________________________________________________________________________ - /** - * \brief tiling table for case 3.2 - * For each of the case above, the specific triangulation of the edge - * intersection points is given. - * When a case is ambiguous, there is an auxiliary table that contains - * the face number to test and the tiling table contains the specific - * triangulations depending on the results - * A minus sign means to invert the result of the test. - */ - //----------------------------------------------------------------------------- - static const char* Tiling3_2(unsigned char config) - { - static const char tiling3_2[24][12] = { - /* 5: 0, 2, */ { 10, 3, 2, 10, 8, 3, 10, 1, 0, 8, 10, 0 }, - /* 33: 0, 5, */ { 3, 4, 8, 3, 5, 4, 3, 0, 9, 5, 3, 9 }, - /* 129: 0, 7, */ { 6, 8, 7, 6, 0, 8, 6, 11, 3, 0, 6, 3 }, - /* 10: 1, 3, */ { 11, 0, 3, 11, 9, 0, 11, 2, 1, 9, 11, 1 }, - /* 18: 1, 4, */ { 7, 9, 4, 7, 1, 9, 7, 8, 0, 1, 7, 0 }, - /* 66: 1, 6, */ { 6, 1, 10, 6, 0, 1, 9, 0, 6, 9, 6, 5 }, - /* 36: 2, 5, */ { 4, 10, 5, 4, 2, 10, 4, 9, 1, 2, 4, 1 }, - /* 132: 2, 7, */ { 7, 2, 11, 7, 1, 2, 7, 6, 10, 1, 7, 10 }, - /* 24: 3, 4, */ { 2, 7, 11, 2, 4, 7, 2, 3, 8, 4, 2, 8 }, - /* 72: 3, 6, */ { 5, 11, 6, 5, 3, 11, 5, 10, 2, 3, 5, 2 }, - /* 80: 4, 6, */ { 8, 6, 7, 8, 10, 6, 8, 4, 5, 10, 8, 5 }, - /* 160: 5, 7, */ { 11, 5, 6, 11, 9, 5, 11, 7, 4, 9, 11, 4 }, - /* 95: 0, 1, 2, 3, 4, 6, */ { 6, 5, 11, 5, 9, 11, 4, 7, 11, 4, 11, 9 }, - /* 175: 0, 1, 2, 3, 5, 7, */ { 7, 6, 8, 6, 10, 8, 5, 4, 8, 5, 8, 10 }, - /* 183: 0, 1, 2, 4, 5, 7, */ { 6, 11, 5, 11, 3, 5, 2, 10, 5, 2, 5, 3 }, - /* 231: 0, 1, 2, 5, 6, 7, */ { 11, 7, 2, 7, 4, 2, 8, 3, 2, 8, 2, 4 }, - /* 123: 0, 1, 3, 4, 5, 6, */ { 11, 2, 7, 2, 1, 7, 10, 6, 7, 10, 7, 1 }, - /* 219: 0, 1, 3, 4, 6, 7, */ { 5, 10, 4, 10, 2, 4, 1, 9, 4, 1, 4, 2 }, - /* 189: 0, 2, 3, 4, 5, 7, */ { 10, 1, 6, 1, 0, 6, 6, 0, 9, 5, 6, 9 }, - /* 237: 0, 2, 3, 5, 6, 7, */ { 4, 9, 7, 9, 1, 7, 0, 8, 7, 0, 7, 1 }, - /* 245: 0, 2, 4, 5, 6, 7, */ { 3, 0, 11, 0, 9, 11, 1, 2, 11, 1, 11, 9 }, - /* 126: 1, 2, 3, 4, 5, 6, */ { 7, 8, 6, 8, 0, 6, 3, 11, 6, 3, 6, 0 }, - /* 222: 1, 2, 3, 4, 6, 7, */ { 8, 4, 3, 4, 5, 3, 9, 0, 3, 9, 3, 5 }, - /* 250: 1, 3, 4, 5, 6, 7, */ { 2, 3, 10, 3, 8, 10, 0, 1, 10, 0, 10, 8 } - }; - return &tiling3_2[config][0]; - }; // end of Tiling3_2 - //_____________________________________________________________________________ - - - - //_____________________________________________________________________________ - /** - * \brief test table for case 4 - * Interior to test - * When the test on the interior is negative : 2 first triangles - * When the test on the interior is positive : 6 last triangles - * - * For each of the case above, the specific triangulation of the edge - * intersection points is given. - * When a case is ambiguous, there is an auxiliary table that contains - * the face number to test and the tiling table contains the specific - * triangulations depending on the results - * A minus sign means to invert the result of the test. - */ - //----------------------------------------------------------------------------- - static char Test4(unsigned char config) - { - static const char test4[8] = { - /* 65: 0, 6, */ 7, - /* 130: 1, 7, */ 7, - /* 20: 2, 4, */ 7, - /* 40: 3, 5, */ 7, - /* 215: 0, 1, 2, 4, 6, 7, */ -7, - /* 235: 0, 1, 3, 5, 6, 7, */ -7, - /* 125: 0, 2, 3, 4, 5, 6, */ -7, - /* 190: 1, 2, 3, 4, 5, 7, */ -7 - }; - return test4[config]; - }; // end of Test4 - - - //_____________________________________________________________________________ - /** - * \brief tiling table for case 4.1 - * For each of the case above, the specific triangulation of the edge - * intersection points is given. - * When a case is ambiguous, there is an auxiliary table that contains - * the face number to test and the tiling table contains the specific - * triangulations depending on the results - * A minus sign means to invert the result of the test. - */ - //----------------------------------------------------------------------------- - static const char* Tiling4_1(unsigned char config) - { - static const char tiling4_1[8][6] = { - /* 65: 0, 6, */ { 0, 8, 3, 5, 10, 6 }, - /* 130: 1, 7, */ { 0, 1, 9, 11, 7, 6 }, - /* 20: 2, 4, */ { 1, 2, 10, 8, 4, 7 }, - /* 40: 3, 5, */ { 9, 5, 4, 2, 3, 11 }, - /* 215: 0, 1, 2, 4, 6, 7, */ { 4, 5, 9, 11, 3, 2 }, - /* 235: 0, 1, 3, 5, 6, 7, */ { 10, 2, 1, 7, 4, 8 }, - /* 125: 0, 2, 3, 4, 5, 6, */ { 9, 1, 0, 6, 7, 11 }, - /* 190: 1, 2, 3, 4, 5, 7, */ { 3, 8, 0, 6, 10, 5 } - }; - return &tiling4_1[config][0]; - }; // end of Tiling4_1 - - - //_____________________________________________________________________________ - /** - * \brief tiling table for case 4.2 - * For each of the case above, the specific triangulation of the edge - * intersection points is given. - * When a case is ambiguous, there is an auxiliary table that contains - * the face number to test and the tiling table contains the specific - * triangulations depending on the results - * A minus sign means to invert the result of the test. - */ - //----------------------------------------------------------------------------- - static const char* Tiling4_2(unsigned char config) - { - static const char tiling4_2[8][18] = { - /* 65: 0, 6, */ { 8, 5, 0, 5, 8, 6, 3, 6, 8, 6, 3, 10, 0, 10, 3, 10, 0, 5 }, - /* 130: 1, 7, */ { 9, 6, 1, 6, 9, 7, 0, 7, 9, 7, 0, 11, 1, 11, 0, 11, 1, 6 }, - /* 20: 2, 4, */ { 10, 7, 2, 7, 10, 4, 1, 4, 10, 4, 1, 8, 2, 8, 1, 8, 2, 7 }, - /* 40: 3, 5, */ { 11, 4, 3, 4, 11, 5, 2, 5, 11, 5, 2, 9, 3, 9, 2, 9, 3, 4 }, - /* 215: 0, 1, 2, 4, 6, 7, */ { 3, 4, 11, 5, 11, 4, 11, 5, 2, 9, 2, 5, 2, 9, 3, 4, 3, 9 }, - /* 235: 0, 1, 3, 5, 6, 7, */ { 2, 7, 10, 4, 10, 7, 10, 4, 1, 8, 1, 4, 1, 8, 2, 7, 2, 8 }, - /* 125: 0, 2, 3, 4, 5, 6, */ { 1, 6, 9, 7, 9, 6, 9, 7, 0, 11, 0, 7, 0, 11, 1, 6, 1, 11 }, - /* 190: 1, 2, 3, 4, 5, 7, */ { 0, 5, 8, 6, 8, 5, 8, 6, 3, 10, 3, 6, 3, 10, 0, 5, 0, 10 } - }; - return &tiling4_2[config][0]; - }; // end of Tiling4_2 - //_____________________________________________________________________________ - - - - //_____________________________________________________________________________ - /** - * \brief tiling table for case 5 - * For each of the case above, the specific triangulation of the edge - * intersection points is given. - * When a case is ambiguous, there is an auxiliary table that contains - * the face number to test and the tiling table contains the specific - * triangulations depending on the results - * A minus sign means to invert the result of the test. - */ - //----------------------------------------------------------------------------- - static const char* Tiling5(unsigned char config) - { - static const char tiling5[48][9] = { - /* 7: 0, 1, 2, */ { 2, 8, 3, 2, 10, 8, 10, 9, 8 }, - /* 11: 0, 1, 3, */ { 1, 11, 2, 1, 9, 11, 9, 8, 11 }, - /* 19: 0, 1, 4, */ { 4, 1, 9, 4, 7, 1, 7, 3, 1 }, - /* 35: 0, 1, 5, */ { 8, 5, 4, 8, 3, 5, 3, 1, 5 }, - /* 13: 0, 2, 3, */ { 0, 10, 1, 0, 8, 10, 8, 11, 10 }, - /* 25: 0, 3, 4, */ { 11, 4, 7, 11, 2, 4, 2, 0, 4 }, - /* 137: 0, 3, 7, */ { 7, 0, 8, 7, 6, 0, 6, 2, 0 }, - /* 49: 0, 4, 5, */ { 9, 3, 0, 9, 5, 3, 5, 7, 3 }, - /* 145: 0, 4, 7, */ { 3, 6, 11, 3, 0, 6, 0, 4, 6 }, - /* 14: 1, 2, 3, */ { 3, 9, 0, 3, 11, 9, 11, 10, 9 }, - /* 38: 1, 2, 5, */ { 5, 2, 10, 5, 4, 2, 4, 0, 2 }, - /* 70: 1, 2, 6, */ { 9, 6, 5, 9, 0, 6, 0, 2, 6 }, - /* 50: 1, 4, 5, */ { 0, 7, 8, 0, 1, 7, 1, 5, 7 }, - /* 98: 1, 5, 6, */ { 10, 0, 1, 10, 6, 0, 6, 4, 0 }, - /* 76: 2, 3, 6, */ { 6, 3, 11, 6, 5, 3, 5, 1, 3 }, - /* 140: 2, 3, 7, */ { 10, 7, 6, 10, 1, 7, 1, 3, 7 }, - /* 100: 2, 5, 6, */ { 1, 4, 9, 1, 2, 4, 2, 6, 4 }, - /* 196: 2, 6, 7, */ { 11, 1, 2, 11, 7, 1, 7, 5, 1 }, - /* 152: 3, 4, 7, */ { 8, 2, 3, 8, 4, 2, 4, 6, 2 }, - /* 200: 3, 6, 7, */ { 2, 5, 10, 2, 3, 5, 3, 7, 5 }, - /* 112: 4, 5, 6, */ { 7, 10, 6, 7, 8, 10, 8, 9, 10 }, - /* 176: 4, 5, 7, */ { 6, 9, 5, 6, 11, 9, 11, 8, 9 }, - /* 208: 4, 6, 7, */ { 5, 8, 4, 5, 10, 8, 10, 11, 8 }, - /* 224: 5, 6, 7, */ { 4, 11, 7, 4, 9, 11, 9, 10, 11 }, - /* 31: 0, 1, 2, 3, 4, */ { 4, 7, 11, 4, 11, 9, 9, 11, 10 }, - /* 47: 0, 1, 2, 3, 5, */ { 5, 4, 8, 5, 8, 10, 10, 8, 11 }, - /* 79: 0, 1, 2, 3, 6, */ { 6, 5, 9, 6, 9, 11, 11, 9, 8 }, - /* 143: 0, 1, 2, 3, 7, */ { 7, 6, 10, 7, 10, 8, 8, 10, 9 }, - /* 55: 0, 1, 2, 4, 5, */ { 2, 10, 5, 2, 5, 3, 3, 5, 7 }, - /* 103: 0, 1, 2, 5, 6, */ { 8, 3, 2, 8, 2, 4, 4, 2, 6 }, - /* 59: 0, 1, 3, 4, 5, */ { 11, 2, 1, 11, 1, 7, 7, 1, 5 }, - /* 155: 0, 1, 3, 4, 7, */ { 1, 9, 4, 1, 4, 2, 2, 4, 6 }, - /* 115: 0, 1, 4, 5, 6, */ { 10, 6, 7, 10, 7, 1, 1, 7, 3 }, - /* 179: 0, 1, 4, 5, 7, */ { 6, 11, 3, 6, 3, 5, 5, 3, 1 }, - /* 157: 0, 2, 3, 4, 7, */ { 10, 1, 0, 10, 0, 6, 6, 0, 4 }, - /* 205: 0, 2, 3, 6, 7, */ { 0, 8, 7, 0, 7, 1, 1, 7, 5 }, - /* 185: 0, 3, 4, 5, 7, */ { 9, 5, 6, 9, 6, 0, 0, 6, 2 }, - /* 217: 0, 3, 4, 6, 7, */ { 5, 10, 2, 5, 2, 4, 4, 2, 0 }, - /* 241: 0, 4, 5, 6, 7, */ { 3, 0, 9, 3, 9, 11, 11, 9, 10 }, - /* 110: 1, 2, 3, 5, 6, */ { 3, 11, 6, 3, 6, 0, 0, 6, 4 }, - /* 206: 1, 2, 3, 6, 7, */ { 9, 0, 3, 9, 3, 5, 5, 3, 7 }, - /* 118: 1, 2, 4, 5, 6, */ { 7, 8, 0, 7, 0, 6, 6, 0, 2 }, - /* 230: 1, 2, 5, 6, 7, */ { 11, 7, 4, 11, 4, 2, 2, 4, 0 }, - /* 242: 1, 4, 5, 6, 7, */ { 0, 1, 10, 0, 10, 8, 8, 10, 11 }, - /* 220: 2, 3, 4, 6, 7, */ { 8, 4, 5, 8, 5, 3, 3, 5, 1 }, - /* 236: 2, 3, 5, 6, 7, */ { 4, 9, 1, 4, 1, 7, 7, 1, 3 }, - /* 244: 2, 4, 5, 6, 7, */ { 1, 2, 11, 1, 11, 9, 9, 11, 8 }, - /* 248: 3, 4, 5, 6, 7, */ { 2, 3, 8, 2, 8, 10, 10, 8, 9 } - }; - return &tiling5[config][0]; - }; // end of Tiling5 - //_____________________________________________________________________________ - - - //_____________________________________________________________________________ - /** - * \brief test table for case 6 - * 1 face to test + eventually the interior - * When the test on the specified face is positive : 5 first triangles - * When the test on the specified face is negative : - * - if the test on the interior is negative : 3 middle triangles - * - if the test on the interior is positive : 8 last triangles - * The support edge for the interior test is marked as the 3rd column. - * - * For each of the case above, the specific triangulation of the edge - * intersection points is given. - * When a case is ambiguous, there is an auxiliary table that contains - * the face number to test and the tiling table contains the specific - * triangulations depending on the results - * A minus sign means to invert the result of the test. - */ - //----------------------------------------------------------------------------- - static char Test6(unsigned char config, int u) - { - static const char test6[48][3] = { - /* 67: 0, 1, 6, */ { 2, 7, 10 }, - /* 131: 0, 1, 7, */ { 4, 7, 11 }, - /* 21: 0, 2, 4, */ { 5, 7, 1 }, - /* 69: 0, 2, 6, */ { 5, 7, 3 }, - /* 41: 0, 3, 5, */ { 1, 7, 9 }, - /* 73: 0, 3, 6, */ { 3, 7, 10 }, - /* 81: 0, 4, 6, */ { 6, 7, 5 }, - /* 97: 0, 5, 6, */ { 1, 7, 8 }, - /* 193: 0, 6, 7, */ { 4, 7, 8 }, - /* 22: 1, 2, 4, */ { 1, 7, 8 }, - /* 134: 1, 2, 7, */ { 3, 7, 11 }, - /* 42: 1, 3, 5, */ { 5, 7, 2 }, - /* 138: 1, 3, 7, */ { 5, 7, 0 }, - /* 146: 1, 4, 7, */ { 1, 7, 9 }, - /* 162: 1, 5, 7, */ { 6, 7, 6 }, - /* 194: 1, 6, 7, */ { 2, 7, 9 }, - /* 28: 2, 3, 4, */ { 4, 7, 8 }, - /* 44: 2, 3, 5, */ { 2, 7, 9 }, - /* 52: 2, 4, 5, */ { 2, 7, 10 }, - /* 84: 2, 4, 6, */ { 6, 7, 7 }, - /* 148: 2, 4, 7, */ { 3, 7, 10 }, - /* 56: 3, 4, 5, */ { 4, 7, 11 }, - /* 104: 3, 5, 6, */ { 3, 7, 11 }, - /* 168: 3, 5, 7, */ { 6, 7, 4 }, - /* 87: 0, 1, 2, 4, 6, */ { -6, -7, 4 }, - /* 151: 0, 1, 2, 4, 7, */ { -3, -7, 11 }, - /* 199: 0, 1, 2, 6, 7, */ { -4, -7, 11 }, - /* 107: 0, 1, 3, 5, 6, */ { -3, -7, 10 }, - /* 171: 0, 1, 3, 5, 7, */ { -6, -7, 7 }, - /* 203: 0, 1, 3, 6, 7, */ { -2, -7, 10 }, - /* 211: 0, 1, 4, 6, 7, */ { -2, -7, 9 }, - /* 227: 0, 1, 5, 6, 7, */ { -4, -7, 8 }, - /* 61: 0, 2, 3, 4, 5, */ { -2, -7, 9 }, - /* 93: 0, 2, 3, 4, 6, */ { -6, -7, 6 }, - /* 109: 0, 2, 3, 5, 6, */ { -1, -7, 9 }, - /* 117: 0, 2, 4, 5, 6, */ { -5, -7, 0 }, - /* 213: 0, 2, 4, 6, 7, */ { -5, -7, 2 }, - /* 121: 0, 3, 4, 5, 6, */ { -3, -7, 11 }, - /* 233: 0, 3, 5, 6, 7, */ { -1, -7, 8 }, - /* 62: 1, 2, 3, 4, 5, */ { -4, -7, 8 }, - /* 158: 1, 2, 3, 4, 7, */ { -1, -7, 8 }, - /* 174: 1, 2, 3, 5, 7, */ { -6, -7, 5 }, - /* 182: 1, 2, 4, 5, 7, */ { -3, -7, 10 }, - /* 214: 1, 2, 4, 6, 7, */ { -1, -7, 9 }, - /* 186: 1, 3, 4, 5, 7, */ { -5, -7, 3 }, - /* 234: 1, 3, 5, 6, 7, */ { -5, -7, 1 }, - /* 124: 2, 3, 4, 5, 6, */ { -4, -7, 11 }, - /* 188: 2, 3, 4, 5, 7, */ { -2, -7, 10 } - }; - return test6[config][u]; - }; // end of Test6 - - - //_____________________________________________________________________________ - /** - * \brief tiling table for case 6.1.1 - * For each of the case above, the specific triangulation of the edge - * intersection points is given. - * When a case is ambiguous, there is an auxiliary table that contains - * the face number to test and the tiling table contains the specific - * triangulations depending on the results - * A minus sign means to invert the result of the test. - */ - //----------------------------------------------------------------------------- - static const char* Tiling6_1_1(unsigned char config) - { - static const char tiling6_1_1[48][9] = { - /* 67: 0, 1, 6, */ { 6, 5, 10, 3, 1, 8, 9, 8, 1 }, - /* 131: 0, 1, 7, */ { 11, 7, 6, 9, 3, 1, 3, 9, 8 }, - /* 21: 0, 2, 4, */ { 1, 2, 10, 7, 0, 4, 0, 7, 3 }, - /* 69: 0, 2, 6, */ { 3, 0, 8, 5, 2, 6, 2, 5, 1 }, - /* 41: 0, 3, 5, */ { 5, 4, 9, 2, 0, 11, 8, 11, 0 }, - /* 73: 0, 3, 6, */ { 10, 6, 5, 8, 2, 0, 2, 8, 11 }, - /* 81: 0, 4, 6, */ { 10, 6, 5, 0, 4, 3, 7, 3, 4 }, - /* 97: 0, 5, 6, */ { 3, 0, 8, 6, 4, 10, 9, 10, 4 }, - /* 193: 0, 6, 7, */ { 8, 3, 0, 10, 7, 5, 7, 10, 11 }, - /* 22: 1, 2, 4, */ { 8, 4, 7, 10, 0, 2, 0, 10, 9 }, - /* 134: 1, 2, 7, */ { 7, 6, 11, 0, 2, 9, 10, 9, 2 }, - /* 42: 1, 3, 5, */ { 2, 3, 11, 4, 1, 5, 1, 4, 0 }, - /* 138: 1, 3, 7, */ { 0, 1, 9, 6, 3, 7, 3, 6, 2 }, - /* 146: 1, 4, 7, */ { 9, 0, 1, 11, 4, 6, 4, 11, 8 }, - /* 162: 1, 5, 7, */ { 11, 7, 6, 1, 5, 0, 4, 0, 5 }, - /* 194: 1, 6, 7, */ { 0, 1, 9, 7, 5, 11, 10, 11, 5 }, - /* 28: 2, 3, 4, */ { 4, 7, 8, 1, 3, 10, 11, 10, 3 }, - /* 44: 2, 3, 5, */ { 9, 5, 4, 11, 1, 3, 1, 11, 10 }, - /* 52: 2, 4, 5, */ { 10, 1, 2, 8, 5, 7, 5, 8, 9 }, - /* 84: 2, 4, 6, */ { 8, 4, 7, 2, 6, 1, 5, 1, 6 }, - /* 148: 2, 4, 7, */ { 1, 2, 10, 4, 6, 8, 11, 8, 6 }, - /* 56: 3, 4, 5, */ { 2, 3, 11, 5, 7, 9, 8, 9, 7 }, - /* 104: 3, 5, 6, */ { 11, 2, 3, 9, 6, 4, 6, 9, 10 }, - /* 168: 3, 5, 7, */ { 9, 5, 4, 3, 7, 2, 6, 2, 7 }, - /* 87: 0, 1, 2, 4, 6, */ { 4, 5, 9, 2, 7, 3, 7, 2, 6 }, - /* 151: 0, 1, 2, 4, 7, */ { 3, 2, 11, 4, 6, 9, 10, 9, 6 }, - /* 199: 0, 1, 2, 6, 7, */ { 11, 3, 2, 9, 7, 5, 7, 9, 8 }, - /* 107: 0, 1, 3, 5, 6, */ { 10, 2, 1, 8, 6, 4, 6, 8, 11 }, - /* 171: 0, 1, 3, 5, 7, */ { 7, 4, 8, 1, 6, 2, 6, 1, 5 }, - /* 203: 0, 1, 3, 6, 7, */ { 2, 1, 10, 7, 5, 8, 9, 8, 5 }, - /* 211: 0, 1, 4, 6, 7, */ { 4, 5, 9, 3, 1, 11, 10, 11, 1 }, - /* 227: 0, 1, 5, 6, 7, */ { 8, 7, 4, 10, 3, 1, 3, 10, 11 }, - /* 61: 0, 2, 3, 4, 5, */ { 9, 1, 0, 11, 5, 7, 5, 11, 10 }, - /* 93: 0, 2, 3, 4, 6, */ { 6, 7, 11, 0, 5, 1, 5, 0, 4 }, - /* 109: 0, 2, 3, 5, 6, */ { 1, 0, 9, 6, 4, 11, 8, 11, 4 }, - /* 117: 0, 2, 4, 5, 6, */ { 9, 1, 0, 7, 3, 6, 2, 6, 3 }, - /* 213: 0, 2, 4, 6, 7, */ { 11, 3, 2, 5, 1, 4, 0, 4, 1 }, - /* 121: 0, 3, 4, 5, 6, */ { 11, 6, 7, 9, 2, 0, 2, 9, 10 }, - /* 233: 0, 3, 5, 6, 7, */ { 7, 4, 8, 2, 0, 10, 9, 10, 0 }, - /* 62: 1, 2, 3, 4, 5, */ { 0, 3, 8, 5, 7, 10, 11, 10, 7 }, - /* 158: 1, 2, 3, 4, 7, */ { 8, 0, 3, 10, 4, 6, 4, 10, 9 }, - /* 174: 1, 2, 3, 5, 7, */ { 5, 6, 10, 3, 4, 0, 4, 3, 7 }, - /* 182: 1, 2, 4, 5, 7, */ { 5, 6, 10, 0, 2, 8, 11, 8, 2 }, - /* 214: 1, 2, 4, 6, 7, */ { 9, 4, 5, 11, 0, 2, 0, 11, 8 }, - /* 186: 1, 3, 4, 5, 7, */ { 8, 0, 3, 6, 2, 5, 1, 5, 2 }, - /* 234: 1, 3, 5, 6, 7, */ { 10, 2, 1, 4, 0, 7, 3, 7, 0 }, - /* 124: 2, 3, 4, 5, 6, */ { 6, 7, 11, 1, 3, 9, 8, 9, 3 }, - /* 188: 2, 3, 4, 5, 7, */ { 10, 5, 6, 8, 1, 3, 1, 8, 9 } - }; - return &tiling6_1_1[config][0]; - }; // end of Tiling6_1_1 - - - //_____________________________________________________________________________ - /** - * \brief tiling table for case 6.1.2 - * For each of the case above, the specific triangulation of the edge - * intersection points is given. - * When a case is ambiguous, there is an auxiliary table that contains - * the face number to test and the tiling table contains the specific - * triangulations depending on the results - * A minus sign means to invert the result of the test. - */ - //----------------------------------------------------------------------------- - static const char* Tiling6_1_2(unsigned char config) - { - static const char tiling6_1_2[48][21] = { - /* 67: 0, 1, 6, */ { 1, 10, 3, 6, 3, 10, 3, 6, 8, 5, 8, 6, 8, 5, 9, 1, 9, 5, 10, 1, 5 }, - /* 131: 0, 1, 7, */ { 1, 11, 3, 11, 1, 6, 9, 6, 1, 6, 9, 7, 8, 7, 9, 7, 8, 3, 7, 3, 11 }, - /* 21: 0, 2, 4, */ { 4, 1, 0, 1, 4, 10, 7, 10, 4, 10, 7, 2, 3, 2, 7, 2, 3, 0, 2, 0, 1 }, - /* 69: 0, 2, 6, */ { 6, 3, 2, 3, 6, 8, 5, 8, 6, 8, 5, 0, 1, 0, 5, 0, 1, 2, 0, 2, 3 }, - /* 41: 0, 3, 5, */ { 0, 9, 2, 5, 2, 9, 2, 5, 11, 4, 11, 5, 11, 4, 8, 0, 8, 4, 9, 0, 4 }, - /* 73: 0, 3, 6, */ { 0, 10, 2, 10, 0, 5, 8, 5, 0, 5, 8, 6, 11, 6, 8, 6, 11, 2, 6, 2, 10 }, - /* 81: 0, 4, 6, */ { 4, 5, 0, 10, 0, 5, 0, 10, 3, 6, 3, 10, 3, 6, 7, 4, 7, 6, 5, 4, 6 }, - /* 97: 0, 5, 6, */ { 4, 8, 6, 3, 6, 8, 6, 3, 10, 0, 10, 3, 10, 0, 9, 4, 9, 0, 8, 4, 0 }, - /* 193: 0, 6, 7, */ { 5, 8, 7, 8, 5, 0, 10, 0, 5, 0, 10, 3, 11, 3, 10, 3, 11, 7, 3, 7, 8 }, - /* 22: 1, 2, 4, */ { 2, 8, 0, 8, 2, 7, 10, 7, 2, 7, 10, 4, 9, 4, 10, 4, 9, 0, 4, 0, 8 }, - /* 134: 1, 2, 7, */ { 2, 11, 0, 7, 0, 11, 0, 7, 9, 6, 9, 7, 9, 6, 10, 2, 10, 6, 11, 2, 6 }, - /* 42: 1, 3, 5, */ { 5, 2, 1, 2, 5, 11, 4, 11, 5, 11, 4, 3, 0, 3, 4, 3, 0, 1, 3, 1, 2 }, - /* 138: 1, 3, 7, */ { 7, 0, 3, 0, 7, 9, 6, 9, 7, 9, 6, 1, 2, 1, 6, 1, 2, 3, 1, 3, 0 }, - /* 146: 1, 4, 7, */ { 6, 9, 4, 9, 6, 1, 11, 1, 6, 1, 11, 0, 8, 0, 11, 0, 8, 4, 0, 4, 9 }, - /* 162: 1, 5, 7, */ { 5, 6, 1, 11, 1, 6, 1, 11, 0, 7, 0, 11, 0, 7, 4, 5, 4, 7, 6, 5, 7 }, - /* 194: 1, 6, 7, */ { 5, 9, 7, 0, 7, 9, 7, 0, 11, 1, 11, 0, 11, 1, 10, 5, 10, 1, 9, 5, 1 }, - /* 28: 2, 3, 4, */ { 3, 8, 1, 4, 1, 8, 1, 4, 10, 7, 10, 4, 10, 7, 11, 3, 11, 7, 8, 3, 7 }, - /* 44: 2, 3, 5, */ { 3, 9, 1, 9, 3, 4, 11, 4, 3, 4, 11, 5, 10, 5, 11, 5, 10, 1, 5, 1, 9 }, - /* 52: 2, 4, 5, */ { 7, 10, 5, 10, 7, 2, 8, 2, 7, 2, 8, 1, 9, 1, 8, 1, 9, 5, 1, 5, 10 }, - /* 84: 2, 4, 6, */ { 6, 7, 2, 8, 2, 7, 2, 8, 1, 4, 1, 8, 1, 4, 5, 6, 5, 4, 7, 6, 4 }, - /* 148: 2, 4, 7, */ { 6, 10, 4, 1, 4, 10, 4, 1, 8, 2, 8, 1, 8, 2, 11, 6, 11, 2, 10, 6, 2 }, - /* 56: 3, 4, 5, */ { 7, 11, 5, 2, 5, 11, 5, 2, 9, 3, 9, 2, 9, 3, 8, 7, 8, 3, 11, 7, 3 }, - /* 104: 3, 5, 6, */ { 4, 11, 6, 11, 4, 3, 9, 3, 4, 3, 9, 2, 10, 2, 9, 2, 10, 6, 2, 6, 11 }, - /* 168: 3, 5, 7, */ { 7, 4, 3, 9, 3, 4, 3, 9, 2, 5, 2, 9, 2, 5, 6, 7, 6, 5, 4, 7, 5 }, - /* 87: 0, 1, 2, 4, 6, */ { 3, 4, 7, 4, 3, 9, 2, 9, 3, 9, 2, 5, 6, 5, 2, 5, 6, 7, 5, 7, 4 }, - /* 151: 0, 1, 2, 4, 7, */ { 6, 11, 4, 3, 4, 11, 4, 3, 9, 2, 9, 3, 9, 2, 10, 6, 10, 2, 11, 6, 2 }, - /* 199: 0, 1, 2, 6, 7, */ { 5, 11, 7, 11, 5, 2, 9, 2, 5, 2, 9, 3, 8, 3, 9, 3, 8, 7, 3, 7, 11 }, - /* 107: 0, 1, 3, 5, 6, */ { 4, 10, 6, 10, 4, 1, 8, 1, 4, 1, 8, 2, 11, 2, 8, 2, 11, 6, 2, 6, 10 }, - /* 171: 0, 1, 3, 5, 7, */ { 2, 7, 6, 7, 2, 8, 1, 8, 2, 8, 1, 4, 5, 4, 1, 4, 5, 6, 4, 6, 7 }, - /* 203: 0, 1, 3, 6, 7, */ { 5, 10, 7, 2, 7, 10, 7, 2, 8, 1, 8, 2, 8, 1, 9, 5, 9, 1, 10, 5, 1 }, - /* 211: 0, 1, 4, 6, 7, */ { 1, 9, 3, 4, 3, 9, 3, 4, 11, 5, 11, 4, 11, 5, 10, 1, 10, 5, 9, 1, 5 }, - /* 227: 0, 1, 5, 6, 7, */ { 1, 8, 3, 8, 1, 4, 10, 4, 1, 4, 10, 7, 11, 7, 10, 7, 11, 3, 7, 3, 8 }, - /* 61: 0, 2, 3, 4, 5, */ { 7, 9, 5, 9, 7, 0, 11, 0, 7, 0, 11, 1, 10, 1, 11, 1, 10, 5, 1, 5, 9 }, - /* 93: 0, 2, 3, 4, 6, */ { 1, 6, 5, 6, 1, 11, 0, 11, 1, 11, 0, 7, 4, 7, 0, 7, 4, 5, 7, 5, 6 }, - /* 109: 0, 2, 3, 5, 6, */ { 4, 9, 6, 1, 6, 9, 6, 1, 11, 0, 11, 1, 11, 0, 8, 4, 8, 0, 9, 4, 0 }, - /* 117: 0, 2, 4, 5, 6, */ { 3, 0, 7, 9, 7, 0, 7, 9, 6, 1, 6, 9, 6, 1, 2, 3, 2, 1, 0, 3, 1 }, - /* 213: 0, 2, 4, 6, 7, */ { 1, 2, 5, 11, 5, 2, 5, 11, 4, 3, 4, 11, 4, 3, 0, 1, 0, 3, 2, 1, 3 }, - /* 121: 0, 3, 4, 5, 6, */ { 0, 11, 2, 11, 0, 7, 9, 7, 0, 7, 9, 6, 10, 6, 9, 6, 10, 2, 6, 2, 11 }, - /* 233: 0, 3, 5, 6, 7, */ { 0, 8, 2, 7, 2, 8, 2, 7, 10, 4, 10, 7, 10, 4, 9, 0, 9, 4, 8, 0, 4 }, - /* 62: 1, 2, 3, 4, 5, */ { 7, 8, 5, 0, 5, 8, 5, 0, 10, 3, 10, 0, 10, 3, 11, 7, 11, 3, 8, 7, 3 }, - /* 158: 1, 2, 3, 4, 7, */ { 6, 8, 4, 8, 6, 3, 10, 3, 6, 3, 10, 0, 9, 0, 10, 0, 9, 4, 0, 4, 8 }, - /* 174: 1, 2, 3, 5, 7, */ { 0, 5, 4, 5, 0, 10, 3, 10, 0, 10, 3, 6, 7, 6, 3, 6, 7, 4, 6, 4, 5 }, - /* 182: 1, 2, 4, 5, 7, */ { 2, 10, 0, 5, 0, 10, 0, 5, 8, 6, 8, 5, 8, 6, 11, 2, 11, 6, 10, 2, 6 }, - /* 214: 1, 2, 4, 6, 7, */ { 2, 9, 0, 9, 2, 5, 11, 5, 2, 5, 11, 4, 8, 4, 11, 4, 8, 0, 4, 0, 9 }, - /* 186: 1, 3, 4, 5, 7, */ { 2, 3, 6, 8, 6, 3, 6, 8, 5, 0, 5, 8, 5, 0, 1, 2, 1, 0, 3, 2, 0 }, - /* 234: 1, 3, 5, 6, 7, */ { 0, 1, 4, 10, 4, 1, 4, 10, 7, 2, 7, 10, 7, 2, 3, 0, 3, 2, 1, 0, 2 }, - /* 124: 2, 3, 4, 5, 6, */ { 3, 11, 1, 6, 1, 11, 1, 6, 9, 7, 9, 6, 9, 7, 8, 3, 8, 7, 11, 3, 7 }, - /* 188: 2, 3, 4, 5, 7, */ { 3, 10, 1, 10, 3, 6, 8, 6, 3, 6, 8, 5, 9, 5, 8, 5, 9, 1, 5, 1, 10 } - }; - return &tiling6_1_2[config][0]; - }; // end of Tiling6_1_2 - - - - //_____________________________________________________________________________ - /** - * \brief tiling table for case 6.2 - * For each of the case above, the specific triangulation of the edge - * intersection points is given. - * When a case is ambiguous, there is an auxiliary table that contains - * the face number to test and the tiling table contains the specific - * triangulations depending on the results - * A minus sign means to invert the result of the test. - */ - //----------------------------------------------------------------------------- - static const char* Tiling6_2(unsigned char config) - { - static const char tiling6_2[48][15] = { - /* 67: 0, 1, 6, */ { 1, 10, 3, 6, 3, 10, 3, 6, 8, 5, 8, 6, 8, 5, 9 }, - /* 131: 0, 1, 7, */ { 1, 11, 3, 11, 1, 6, 9, 6, 1, 6, 9, 7, 8, 7, 9 }, - /* 21: 0, 2, 4, */ { 4, 1, 0, 1, 4, 10, 7, 10, 4, 10, 7, 2, 3, 2, 7 }, - /* 69: 0, 2, 6, */ { 6, 3, 2, 3, 6, 8, 5, 8, 6, 8, 5, 0, 1, 0, 5 }, - /* 41: 0, 3, 5, */ { 0, 9, 2, 5, 2, 9, 2, 5, 11, 4, 11, 5, 11, 4, 8 }, - /* 73: 0, 3, 6, */ { 0, 10, 2, 10, 0, 5, 8, 5, 0, 5, 8, 6, 11, 6, 8 }, - /* 81: 0, 4, 6, */ { 4, 5, 0, 10, 0, 5, 0, 10, 3, 6, 3, 10, 3, 6, 7 }, - /* 97: 0, 5, 6, */ { 4, 8, 6, 3, 6, 8, 6, 3, 10, 0, 10, 3, 10, 0, 9 }, - /* 193: 0, 6, 7, */ { 5, 8, 7, 8, 5, 0, 10, 0, 5, 0, 10, 3, 11, 3, 10 }, - /* 22: 1, 2, 4, */ { 2, 8, 0, 8, 2, 7, 10, 7, 2, 7, 10, 4, 9, 4, 10 }, - /* 134: 1, 2, 7, */ { 2, 11, 0, 7, 0, 11, 0, 7, 9, 6, 9, 7, 9, 6, 10 }, - /* 42: 1, 3, 5, */ { 5, 2, 1, 2, 5, 11, 4, 11, 5, 11, 4, 3, 0, 3, 4 }, - /* 138: 1, 3, 7, */ { 7, 0, 3, 0, 7, 9, 6, 9, 7, 9, 6, 1, 2, 1, 6 }, - /* 146: 1, 4, 7, */ { 6, 9, 4, 9, 6, 1, 11, 1, 6, 1, 11, 0, 8, 0, 11 }, - /* 162: 1, 5, 7, */ { 5, 6, 1, 11, 1, 6, 1, 11, 0, 7, 0, 11, 0, 7, 4 }, - /* 194: 1, 6, 7, */ { 5, 9, 7, 0, 7, 9, 7, 0, 11, 1, 11, 0, 11, 1, 10 }, - /* 28: 2, 3, 4, */ { 3, 8, 1, 4, 1, 8, 1, 4, 10, 7, 10, 4, 10, 7, 11 }, - /* 44: 2, 3, 5, */ { 3, 9, 1, 9, 3, 4, 11, 4, 3, 4, 11, 5, 10, 5, 11 }, - /* 52: 2, 4, 5, */ { 7, 10, 5, 10, 7, 2, 8, 2, 7, 2, 8, 1, 9, 1, 8 }, - /* 84: 2, 4, 6, */ { 6, 7, 2, 8, 2, 7, 2, 8, 1, 4, 1, 8, 1, 4, 5 }, - /* 148: 2, 4, 7, */ { 6, 10, 4, 1, 4, 10, 4, 1, 8, 2, 8, 1, 8, 2, 11 }, - /* 56: 3, 4, 5, */ { 7, 11, 5, 2, 5, 11, 5, 2, 9, 3, 9, 2, 9, 3, 8 }, - /* 104: 3, 5, 6, */ { 4, 11, 6, 11, 4, 3, 9, 3, 4, 3, 9, 2, 10, 2, 9 }, - /* 168: 3, 5, 7, */ { 7, 4, 3, 9, 3, 4, 3, 9, 2, 5, 2, 9, 2, 5, 6 }, - /* 87: 0, 1, 2, 4, 6, */ { 3, 4, 7, 4, 3, 9, 2, 9, 3, 9, 2, 5, 6, 5, 2 }, - /* 151: 0, 1, 2, 4, 7, */ { 6, 11, 4, 3, 4, 11, 4, 3, 9, 2, 9, 3, 9, 2, 10 }, - /* 199: 0, 1, 2, 6, 7, */ { 5, 11, 7, 11, 5, 2, 9, 2, 5, 2, 9, 3, 8, 3, 9 }, - /* 107: 0, 1, 3, 5, 6, */ { 4, 10, 6, 10, 4, 1, 8, 1, 4, 1, 8, 2, 11, 2, 8 }, - /* 171: 0, 1, 3, 5, 7, */ { 2, 7, 6, 7, 2, 8, 1, 8, 2, 8, 1, 4, 5, 4, 1 }, - /* 203: 0, 1, 3, 6, 7, */ { 5, 10, 7, 2, 7, 10, 7, 2, 8, 1, 8, 2, 8, 1, 9 }, - /* 211: 0, 1, 4, 6, 7, */ { 1, 9, 3, 4, 3, 9, 3, 4, 11, 5, 11, 4, 11, 5, 10 }, - /* 227: 0, 1, 5, 6, 7, */ { 1, 8, 3, 8, 1, 4, 10, 4, 1, 4, 10, 7, 11, 7, 10 }, - /* 61: 0, 2, 3, 4, 5, */ { 7, 9, 5, 9, 7, 0, 11, 0, 7, 0, 11, 1, 10, 1, 11 }, - /* 93: 0, 2, 3, 4, 6, */ { 1, 6, 5, 6, 1, 11, 0, 11, 1, 11, 0, 7, 4, 7, 0 }, - /* 109: 0, 2, 3, 5, 6, */ { 4, 9, 6, 1, 6, 9, 6, 1, 11, 0, 11, 1, 11, 0, 8 }, - /* 117: 0, 2, 4, 5, 6, */ { 3, 0, 7, 9, 7, 0, 7, 9, 6, 1, 6, 9, 6, 1, 2 }, - /* 213: 0, 2, 4, 6, 7, */ { 1, 2, 5, 11, 5, 2, 5, 11, 4, 3, 4, 11, 4, 3, 0 }, - /* 121: 0, 3, 4, 5, 6, */ { 0, 11, 2, 11, 0, 7, 9, 7, 0, 7, 9, 6, 10, 6, 9 }, - /* 233: 0, 3, 5, 6, 7, */ { 0, 8, 2, 7, 2, 8, 2, 7, 10, 4, 10, 7, 10, 4, 9 }, - /* 62: 1, 2, 3, 4, 5, */ { 7, 8, 5, 0, 5, 8, 5, 0, 10, 3, 10, 0, 10, 3, 11 }, - /* 158: 1, 2, 3, 4, 7, */ { 6, 8, 4, 8, 6, 3, 10, 3, 6, 3, 10, 0, 9, 0, 10 }, - /* 174: 1, 2, 3, 5, 7, */ { 0, 5, 4, 5, 0, 10, 3, 10, 0, 10, 3, 6, 7, 6, 3 }, - /* 182: 1, 2, 4, 5, 7, */ { 2, 10, 0, 5, 0, 10, 0, 5, 8, 6, 8, 5, 8, 6, 11 }, - /* 214: 1, 2, 4, 6, 7, */ { 2, 9, 0, 9, 2, 5, 11, 5, 2, 5, 11, 4, 8, 4, 11 }, - /* 186: 1, 3, 4, 5, 7, */ { 2, 3, 6, 8, 6, 3, 6, 8, 5, 0, 5, 8, 5, 0, 1 }, - /* 234: 1, 3, 5, 6, 7, */ { 0, 1, 4, 10, 4, 1, 4, 10, 7, 2, 7, 10, 7, 2, 3 }, - /* 124: 2, 3, 4, 5, 6, */ { 3, 11, 1, 6, 1, 11, 1, 6, 9, 7, 9, 6, 9, 7, 8 }, - /* 188: 2, 3, 4, 5, 7, */ { 3, 10, 1, 10, 3, 6, 8, 6, 3, 6, 8, 5, 9, 5, 8 } - }; - return &tiling6_2[config][0]; - }; // end of Tiling6_2 - //_____________________________________________________________________________ - - - //_____________________________________________________________________________ - /** - * \brief test table for case 7 - * 3 faces to test + eventually the interior - * When the tests on the 3 specified faces are positive : - * - if the test on the interior is positive : 5 first triangles - * - if the test on the interior is negative : 9 next triangles - * When the tests on the first and the second specified faces are positive : 9 next triangles - * When the tests on the first and the third specified faces are positive : 9 next triangles - * When the tests on the second and the third specified faces are positive : 9 next triangles - * When the test on the first specified face is positive : 5 next triangles - * When the test on the second specified face is positive : 5 next triangles - * When the test on the third specified face is positive : 5 next triangles - * When the tests on the 3 specified faces are negative : 3 last triangles - * The support edge for the interior test is marked as the 5th column. - * - * For each of the case above, the specific triangulation of the edge - * intersection points is given. - * When a case is ambiguous, there is an auxiliary table that contains - * the face number to test and the tiling table contains the specific - * triangulations depending on the results - * A minus sign means to invert the result of the test. - */ - //----------------------------------------------------------------------------- - static char Test7(unsigned char config, int u) - { - static const char test7[16][5] = { - /* 37: 0, 2, 5, */ { 1, 2, 5, 7, 1 }, - /* 133: 0, 2, 7, */ { 3, 4, 5, 7, 3 }, - /* 161: 0, 5, 7, */ { 4, 1, 6, 7, 4 }, - /* 26: 1, 3, 4, */ { 4, 1, 5, 7, 0 }, - /* 74: 1, 3, 6, */ { 2, 3, 5, 7, 2 }, - /* 82: 1, 4, 6, */ { 1, 2, 6, 7, 5 }, - /* 164: 2, 5, 7, */ { 2, 3, 6, 7, 6 }, - /* 88: 3, 4, 6, */ { 3, 4, 6, 7, 7 }, - /* 167: 0, 1, 2, 5, 7, */ { -3, -4, -6, -7, 7 }, - /* 91: 0, 1, 3, 4, 6, */ { -2, -3, -6, -7, 6 }, - /* 173: 0, 2, 3, 5, 7, */ { -1, -2, -6, -7, 5 }, - /* 181: 0, 2, 4, 5, 7, */ { -2, -3, -5, -7, 2 }, - /* 229: 0, 2, 5, 6, 7, */ { -4, -1, -5, -7, 0 }, - /* 94: 1, 2, 3, 4, 6, */ { -4, -1, -6, -7, 4 }, - /* 122: 1, 3, 4, 5, 6, */ { -3, -4, -5, -7, 3 }, - /* 218: 1, 3, 4, 6, 7, */ { -1, -2, -5, -7, 1 } - }; - return test7[config][u]; - }; // end of Test7 - - - //_____________________________________________________________________________ - /** - * \brief tiling table for case 7.1 - * For each of the case above, the specific triangulation of the edge - * intersection points is given. - * When a case is ambiguous, there is an auxiliary table that contains - * the face number to test and the tiling table contains the specific - * triangulations depending on the results - * A minus sign means to invert the result of the test. - */ - //----------------------------------------------------------------------------- - static const char* Tiling7_1(unsigned char config) - { - static const char tiling7_1[16][9] = { - /* 37: 0, 2, 5, */ { 9, 5, 4, 10, 1, 2, 8, 3, 0 }, - /* 133: 0, 2, 7, */ { 11, 7, 6, 8, 3, 0, 10, 1, 2 }, - /* 161: 0, 5, 7, */ { 3, 0, 8, 5, 4, 9, 7, 6, 11 }, - /* 26: 1, 3, 4, */ { 8, 4, 7, 9, 0, 1, 11, 2, 3 }, - /* 74: 1, 3, 6, */ { 10, 6, 5, 11, 2, 3, 9, 0, 1 }, - /* 82: 1, 4, 6, */ { 0, 1, 9, 6, 5, 10, 4, 7, 8 }, - /* 164: 2, 5, 7, */ { 1, 2, 10, 7, 6, 11, 5, 4, 9 }, - /* 88: 3, 4, 6, */ { 2, 3, 11, 4, 7, 8, 6, 5, 10 }, - /* 167: 0, 1, 2, 5, 7, */ { 11, 3, 2, 8, 7, 4, 10, 5, 6 }, - /* 91: 0, 1, 3, 4, 6, */ { 10, 2, 1, 11, 6, 7, 9, 4, 5 }, - /* 173: 0, 2, 3, 5, 7, */ { 9, 1, 0, 10, 5, 6, 8, 7, 4 }, - /* 181: 0, 2, 4, 5, 7, */ { 5, 6, 10, 3, 2, 11, 1, 0, 9 }, - /* 229: 0, 2, 5, 6, 7, */ { 7, 4, 8, 1, 0, 9, 3, 2, 11 }, - /* 94: 1, 2, 3, 4, 6, */ { 8, 0, 3, 9, 4, 5, 11, 6, 7 }, - /* 122: 1, 3, 4, 5, 6, */ { 6, 7, 11, 0, 3, 8, 2, 1, 10 }, - /* 218: 1, 3, 4, 6, 7, */ { 4, 5, 9, 2, 1, 10, 0, 3, 8 } - }; - return &tiling7_1[config][0]; - }; // end of Tiling7_1 - - - //_____________________________________________________________________________ - /** - * \brief tiling table for case 7.2 - * For each of the case above, the specific triangulation of the edge - * intersection points is given. - * When a case is ambiguous, there is an auxiliary table that contains - * the face number to test and the tiling table contains the specific - * triangulations depending on the results - * A minus sign means to invert the result of the test. - */ - //----------------------------------------------------------------------------- - static const char* Tiling7_2(unsigned char config, int u) - { - static const char tiling7_2[16][3][15] = { - /* 37: 0, 2, 5, */ { - /* 1,0 */ { 1, 2, 10, 3, 4, 8, 4, 3, 5, 0, 5, 3, 5, 0, 9 }, - /* 0,1 */ { 3, 0, 8, 9, 1, 4, 2, 4, 1, 4, 2, 5, 10, 5, 2 }, - /* 1,1 */ { 9, 5, 4, 0, 10, 1, 10, 0, 8, 10, 8, 2, 3, 2, 8 } - }, - /* 133: 0, 2, 7, */ { - /* 1,0 */ { 3, 0, 8, 1, 6, 10, 6, 1, 7, 2, 7, 1, 7, 2, 11 }, - /* 0,1 */ { 1, 2, 10, 11, 3, 6, 0, 6, 3, 6, 0, 7, 8, 7, 0 }, - /* 1,1 */ { 11, 7, 6, 2, 8, 3, 8, 2, 10, 8, 10, 0, 1, 0, 10 } - }, - /* 161: 0, 5, 7, */ { - /* 1,0 */ { 9, 5, 4, 11, 3, 6, 0, 6, 3, 6, 0, 7, 8, 7, 0 }, - /* 0,1 */ { 11, 7, 6, 3, 4, 8, 4, 3, 5, 0, 5, 3, 5, 0, 9 }, - /* 1,1 */ { 3, 0, 8, 4, 9, 7, 11, 7, 9, 5, 11, 9, 11, 5, 6 } - }, - /* 26: 1, 3, 4, */ { - /* 1,0 */ { 0, 1, 9, 2, 7, 11, 7, 2, 4, 3, 4, 2, 4, 3, 8 }, - /* 0,1 */ { 2, 3, 11, 8, 0, 7, 1, 7, 0, 7, 1, 4, 9, 4, 1 }, - /* 1,1 */ { 8, 4, 7, 3, 9, 0, 9, 3, 11, 9, 11, 1, 2, 1, 11 } - }, - /* 74: 1, 3, 6, */ { - /* 1,0 */ { 2, 3, 11, 0, 5, 9, 5, 0, 6, 1, 6, 0, 6, 1, 10 }, - /* 0,1 */ { 0, 1, 9, 10, 2, 5, 3, 5, 2, 5, 3, 6, 11, 6, 3 }, - /* 1,1 */ { 6, 5, 10, 1, 11, 2, 11, 1, 9, 11, 9, 3, 0, 3, 9 } - }, - /* 82: 1, 4, 6, */ { - /* 1,0 */ { 6, 5, 10, 8, 0, 7, 1, 7, 0, 7, 1, 4, 9, 4, 1 }, - /* 0,1 */ { 8, 4, 7, 0, 5, 9, 5, 0, 6, 1, 6, 0, 6, 1, 10 }, - /* 1,1 */ { 0, 1, 9, 5, 10, 4, 8, 4, 10, 6, 8, 10, 8, 6, 7 } - }, - /* 164: 2, 5, 7, */ { - /* 1,0 */ { 11, 7, 6, 9, 1, 4, 2, 4, 1, 4, 2, 5, 10, 5, 2 }, - /* 0,1 */ { 9, 5, 4, 1, 6, 10, 6, 1, 7, 2, 7, 1, 7, 2, 11 }, - /* 1,1 */ { 1, 2, 10, 6, 11, 5, 9, 5, 11, 7, 9, 11, 9, 7, 4 } - }, - /* 88: 3, 4, 6, */ { - /* 1,0 */ { 8, 4, 7, 10, 2, 5, 3, 5, 2, 5, 3, 6, 11, 6, 3 }, - /* 0,1 */ { 6, 5, 10, 2, 7, 11, 7, 2, 4, 3, 4, 2, 4, 3, 8 }, - /* 1,1 */ { 2, 3, 11, 7, 8, 6, 10, 6, 8, 4, 10, 8, 10, 4, 5 } - }, - /* 167: 0, 1, 2, 5, 7, */ { - /* 1,0 */ { 7, 4, 8, 5, 2, 10, 2, 5, 3, 6, 3, 5, 3, 6, 11 }, - /* 0,1 */ { 10, 5, 6, 11, 7, 2, 4, 2, 7, 2, 4, 3, 8, 3, 4 }, - /* 1,1 */ { 11, 3, 2, 6, 8, 7, 8, 6, 10, 8, 10, 4, 5, 4, 10 } - }, - /* 91: 0, 1, 3, 4, 6, */ { - /* 1,0 */ { 6, 7, 11, 4, 1, 9, 1, 4, 2, 5, 2, 4, 2, 5, 10 }, - /* 0,1 */ { 4, 5, 9, 10, 6, 1, 7, 1, 6, 1, 7, 2, 11, 2, 7 }, - /* 1,1 */ { 10, 2, 1, 5, 11, 6, 11, 5, 9, 11, 9, 7, 4, 7, 9 } - }, - /* 173: 0, 2, 3, 5, 7, */ { - /* 1,0 */ { 10, 5, 6, 7, 0, 8, 0, 7, 1, 4, 1, 7, 1, 4, 9 }, - /* 0,1 */ { 7, 4, 8, 9, 5, 0, 6, 0, 5, 0, 6, 1, 10, 1, 6 }, - /* 1,1 */ { 9, 1, 0, 4, 10, 5, 10, 4, 8, 10, 8, 6, 7, 6, 8 } - }, - /* 181: 0, 2, 4, 5, 7, */ { - /* 1,0 */ { 11, 3, 2, 9, 5, 0, 6, 0, 5, 0, 6, 1, 10, 1, 6 }, - /* 0,1 */ { 9, 1, 0, 5, 2, 10, 2, 5, 3, 6, 3, 5, 3, 6, 11 }, - /* 1,1 */ { 10, 5, 6, 2, 11, 1, 9, 1, 11, 3, 9, 11, 9, 3, 0 } - }, - /* 229: 0, 2, 5, 6, 7, */ { - /* 1,0 */ { 9, 1, 0, 11, 7, 2, 4, 2, 7, 2, 4, 3, 8, 3, 4 }, - /* 0,1 */ { 11, 3, 2, 7, 0, 8, 0, 7, 1, 4, 1, 7, 1, 4, 9 }, - /* 1,1 */ { 7, 4, 8, 0, 9, 3, 11, 3, 9, 1, 11, 9, 11, 1, 2 } - }, - /* 94: 1, 2, 3, 4, 6, */ { - /* 1,0 */ { 4, 5, 9, 6, 3, 11, 3, 6, 0, 7, 0, 6, 0, 7, 8 }, - /* 0,1 */ { 6, 7, 11, 8, 4, 3, 5, 3, 4, 3, 5, 0, 9, 0, 5 }, - /* 1,1 */ { 8, 0, 3, 7, 9, 4, 9, 7, 11, 9, 11, 5, 6, 5, 11 } - }, - /* 122: 1, 3, 4, 5, 6, */ { - /* 1,0 */ { 8, 0, 3, 10, 6, 1, 7, 1, 6, 1, 7, 2, 11, 2, 7 }, - /* 0,1 */ { 10, 2, 1, 6, 3, 11, 3, 6, 0, 7, 0, 6, 0, 7, 8 }, - /* 1,1 */ { 6, 7, 11, 3, 8, 2, 10, 2, 8, 0, 10, 8, 10, 0, 1 } - }, - /* 218: 1, 3, 4, 6, 7, */ { - /* 1,0 */ { 10, 2, 1, 8, 4, 3, 5, 3, 4, 3, 5, 0, 9, 0, 5 }, - /* 0,1 */ { 8, 0, 3, 4, 1, 9, 1, 4, 2, 5, 2, 4, 2, 5, 10 }, - /* 1,1 */ { 4, 5, 9, 1, 10, 0, 8, 0, 10, 2, 8, 10, 8, 2, 3 } } - }; - return &tiling7_2[config][u][0]; - }; // end of Tiling7_2 - - - //_____________________________________________________________________________ - /** - * \brief tiling table for case 7.3 - * For each of the case above, the specific triangulation of the edge - * intersection points is given. - * When a case is ambiguous, there is an auxiliary table that contains - * the face number to test and the tiling table contains the specific - * triangulations depending on the results - * A minus sign means to invert the result of the test. - */ - //----------------------------------------------------------------------------- - static const char* Tiling7_3(unsigned char config, unsigned char u) - { - static const char tiling7_3[16][3][27] = { - /* 37: 0, 2, 5, */ { - /* 1,0 */ { 12, 2, 10, 12, 10, 5, 12, 5, 4, 12, 4, 8, 12, 8, 3, 12, 3, 0, 12, 0, 9, 12, 9, 1, 12, 1, 2 }, - /* 0,1 */ { 12, 5, 4, 12, 4, 8, 12, 8, 3, 12, 3, 2, 12, 2, 10, 12, 10, 1, 12, 1, 0, 12, 0, 9, 12, 9, 5 }, - /* 1,1 */ { 5, 4, 12, 10, 5, 12, 2, 10, 12, 3, 2, 12, 8, 3, 12, 0, 8, 12, 1, 0, 12, 9, 1, 12, 4, 9, 12 } - }, - /* 133: 0, 2, 7, */ { - /* 1,0 */ { 12, 0, 8, 12, 8, 7, 12, 7, 6, 12, 6, 10, 12, 10, 1, 12, 1, 2, 12, 2, 11, 12, 11, 3, 12, 3, 0 }, - /* 0,1 */ { 12, 7, 6, 12, 6, 10, 12, 10, 1, 12, 1, 0, 12, 0, 8, 12, 8, 3, 12, 3, 2, 12, 2, 11, 12, 11, 7 }, - /* 1,1 */ { 7, 6, 12, 8, 7, 12, 0, 8, 12, 1, 0, 12, 10, 1, 12, 2, 10, 12, 3, 2, 12, 11, 3, 12, 6, 11, 12 } - }, - /* 161: 0, 5, 7, */ { - /* 1,0 */ { 9, 5, 12, 0, 9, 12, 3, 0, 12, 11, 3, 12, 6, 11, 12, 7, 6, 12, 8, 7, 12, 4, 8, 12, 5, 4, 12 }, - /* 0,1 */ { 3, 0, 12, 11, 3, 12, 6, 11, 12, 5, 6, 12, 9, 5, 12, 4, 9, 12, 7, 4, 12, 8, 7, 12, 0, 8, 12 }, - /* 1,1 */ { 12, 3, 0, 12, 0, 9, 12, 9, 5, 12, 5, 6, 12, 6, 11, 12, 11, 7, 12, 7, 4, 12, 4, 8, 12, 8, 3 } - }, - /* 26: 1, 3, 4, */ { - /* 1,0 */ { 12, 1, 9, 12, 9, 4, 12, 4, 7, 12, 7, 11, 12, 11, 2, 12, 2, 3, 12, 3, 8, 12, 8, 0, 12, 0, 1 }, - /* 0,1 */ { 12, 4, 7, 12, 7, 11, 12, 11, 2, 12, 2, 1, 12, 1, 9, 12, 9, 0, 12, 0, 3, 12, 3, 8, 12, 8, 4 }, - /* 1,1 */ { 4, 7, 12, 9, 4, 12, 1, 9, 12, 2, 1, 12, 11, 2, 12, 3, 11, 12, 0, 3, 12, 8, 0, 12, 7, 8, 12 } - }, - /* 74: 1, 3, 6, */ { - /* 1,0 */ { 12, 3, 11, 12, 11, 6, 12, 6, 5, 12, 5, 9, 12, 9, 0, 12, 0, 1, 12, 1, 10, 12, 10, 2, 12, 2, 3 }, - /* 0,1 */ { 12, 6, 5, 12, 5, 9, 12, 9, 0, 12, 0, 3, 12, 3, 11, 12, 11, 2, 12, 2, 1, 12, 1, 10, 12, 10, 6 }, - /* 1,1 */ { 6, 5, 12, 11, 6, 12, 3, 11, 12, 0, 3, 12, 9, 0, 12, 1, 9, 12, 2, 1, 12, 10, 2, 12, 5, 10, 12 } - }, - /* 82: 1, 4, 6, */ { - /* 1,0 */ { 10, 6, 12, 1, 10, 12, 0, 1, 12, 8, 0, 12, 7, 8, 12, 4, 7, 12, 9, 4, 12, 5, 9, 12, 6, 5, 12 }, - /* 0,1 */ { 0, 1, 12, 8, 0, 12, 7, 8, 12, 6, 7, 12, 10, 6, 12, 5, 10, 12, 4, 5, 12, 9, 4, 12, 1, 9, 12 }, - /* 1,1 */ { 12, 0, 1, 12, 1, 10, 12, 10, 6, 12, 6, 7, 12, 7, 8, 12, 8, 4, 12, 4, 5, 12, 5, 9, 12, 9, 0 } - }, - /* 164: 2, 5, 7, */ { - /* 1,0 */ { 11, 7, 12, 2, 11, 12, 1, 2, 12, 9, 1, 12, 4, 9, 12, 5, 4, 12, 10, 5, 12, 6, 10, 12, 7, 6, 12 }, - /* 0,1 */ { 1, 2, 12, 9, 1, 12, 4, 9, 12, 7, 4, 12, 11, 7, 12, 6, 11, 12, 5, 6, 12, 10, 5, 12, 2, 10, 12 }, - /* 1,1 */ { 12, 1, 2, 12, 2, 11, 12, 11, 7, 12, 7, 4, 12, 4, 9, 12, 9, 5, 12, 5, 6, 12, 6, 10, 12, 10, 1 } - }, - /* 88: 3, 4, 6, */ { - /* 1,0 */ { 8, 4, 12, 3, 8, 12, 2, 3, 12, 10, 2, 12, 5, 10, 12, 6, 5, 12, 11, 6, 12, 7, 11, 12, 4, 7, 12 }, - /* 0,1 */ { 2, 3, 12, 10, 2, 12, 5, 10, 12, 4, 5, 12, 8, 4, 12, 7, 8, 12, 6, 7, 12, 11, 6, 12, 3, 11, 12 }, - /* 1,1 */ { 12, 2, 3, 12, 3, 8, 12, 8, 4, 12, 4, 5, 12, 5, 10, 12, 10, 6, 12, 6, 7, 12, 7, 11, 12, 11, 2 } - }, - /* 167: 0, 1, 2, 5, 7, */ { - /* 1,0 */ { 12, 4, 8, 12, 8, 3, 12, 3, 2, 12, 2, 10, 12, 10, 5, 12, 5, 6, 12, 6, 11, 12, 11, 7, 12, 7, 4 }, - /* 0,1 */ { 12, 3, 2, 12, 2, 10, 12, 10, 5, 12, 5, 4, 12, 4, 8, 12, 8, 7, 12, 7, 6, 12, 6, 11, 12, 11, 3 }, - /* 1,1 */ { 3, 2, 12, 8, 3, 12, 4, 8, 12, 5, 4, 12, 10, 5, 12, 6, 10, 12, 7, 6, 12, 11, 7, 12, 2, 11, 12 } - }, - /* 91: 0, 1, 3, 4, 6, */ { - /* 1,0 */ { 12, 7, 11, 12, 11, 2, 12, 2, 1, 12, 1, 9, 12, 9, 4, 12, 4, 5, 12, 5, 10, 12, 10, 6, 12, 6, 7 }, - /* 0,1 */ { 12, 2, 1, 12, 1, 9, 12, 9, 4, 12, 4, 7, 12, 7, 11, 12, 11, 6, 12, 6, 5, 12, 5, 10, 12, 10, 2 }, - /* 1,1 */ { 2, 1, 12, 11, 2, 12, 7, 11, 12, 4, 7, 12, 9, 4, 12, 5, 9, 12, 6, 5, 12, 10, 6, 12, 1, 10, 12 } - }, - /* 173: 0, 2, 3, 5, 7, */ { - /* 1,0 */ { 12, 6, 10, 12, 10, 1, 12, 1, 0, 12, 0, 8, 12, 8, 7, 12, 7, 4, 12, 4, 9, 12, 9, 5, 12, 5, 6 }, - /* 0,1 */ { 12, 1, 0, 12, 0, 8, 12, 8, 7, 12, 7, 6, 12, 6, 10, 12, 10, 5, 12, 5, 4, 12, 4, 9, 12, 9, 1 }, - /* 1,1 */ { 1, 0, 12, 10, 1, 12, 6, 10, 12, 7, 6, 12, 8, 7, 12, 4, 8, 12, 5, 4, 12, 9, 5, 12, 0, 9, 12 } - }, - /* 181: 0, 2, 4, 5, 7, */ { - /* 1,0 */ { 11, 3, 12, 6, 11, 12, 5, 6, 12, 9, 5, 12, 0, 9, 12, 1, 0, 12, 10, 1, 12, 2, 10, 12, 3, 2, 12 }, - /* 0,1 */ { 5, 6, 12, 9, 5, 12, 0, 9, 12, 3, 0, 12, 11, 3, 12, 2, 11, 12, 1, 2, 12, 10, 1, 12, 6, 10, 12 }, - /* 1,1 */ { 12, 5, 6, 12, 6, 11, 12, 11, 3, 12, 3, 0, 12, 0, 9, 12, 9, 1, 12, 1, 2, 12, 2, 10, 12, 10, 5 } - }, - /* 229: 0, 2, 5, 6, 7, */ { - /* 1,0 */ { 9, 1, 12, 4, 9, 12, 7, 4, 12, 11, 7, 12, 2, 11, 12, 3, 2, 12, 8, 3, 12, 0, 8, 12, 1, 0, 12 }, - /* 0,1 */ { 7, 4, 12, 11, 7, 12, 2, 11, 12, 1, 2, 12, 9, 1, 12, 0, 9, 12, 3, 0, 12, 8, 3, 12, 4, 8, 12 }, - /* 1,1 */ { 12, 7, 4, 12, 4, 9, 12, 9, 1, 12, 1, 2, 12, 2, 11, 12, 11, 3, 12, 3, 0, 12, 0, 8, 12, 8, 7 } - }, - /* 94: 1, 2, 3, 4, 6, */ { - /* 1,0 */ { 12, 5, 9, 12, 9, 0, 12, 0, 3, 12, 3, 11, 12, 11, 6, 12, 6, 7, 12, 7, 8, 12, 8, 4, 12, 4, 5 }, - /* 0,1 */ { 12, 0, 3, 12, 3, 11, 12, 11, 6, 12, 6, 5, 12, 5, 9, 12, 9, 4, 12, 4, 7, 12, 7, 8, 12, 8, 0 }, - /* 1,1 */ { 0, 3, 12, 9, 0, 12, 5, 9, 12, 6, 5, 12, 11, 6, 12, 7, 11, 12, 4, 7, 12, 8, 4, 12, 3, 8, 12 } - }, - /* 122: 1, 3, 4, 5, 6, */ { - /* 1,0 */ { 8, 0, 12, 7, 8, 12, 6, 7, 12, 10, 6, 12, 1, 10, 12, 2, 1, 12, 11, 2, 12, 3, 11, 12, 0, 3, 12 }, - /* 0,1 */ { 6, 7, 12, 10, 6, 12, 1, 10, 12, 0, 1, 12, 8, 0, 12, 3, 8, 12, 2, 3, 12, 11, 2, 12, 7, 11, 12 }, - /* 1,1 */ { 12, 6, 7, 12, 7, 8, 12, 8, 0, 12, 0, 1, 12, 1, 10, 12, 10, 2, 12, 2, 3, 12, 3, 11, 12, 11, 6 } - }, - /* 218: 1, 3, 4, 6, 7, */ { - /* 1,0 */ { 10, 2, 12, 5, 10, 12, 4, 5, 12, 8, 4, 12, 3, 8, 12, 0, 3, 12, 9, 0, 12, 1, 9, 12, 2, 1, 12 }, - /* 0,1 */ { 4, 5, 12, 8, 4, 12, 3, 8, 12, 2, 3, 12, 10, 2, 12, 1, 10, 12, 0, 1, 12, 9, 0, 12, 5, 9, 12 }, - /* 1,1 */ { 12, 4, 5, 12, 5, 10, 12, 10, 2, 12, 2, 3, 12, 3, 8, 12, 8, 0, 12, 0, 1, 12, 1, 9, 12, 9, 4 } } - }; - return &tiling7_3[config][u][0]; - }; // end of Tiling7_3 - - - //_____________________________________________________________________________ - /** - * \brief tiling table for case 7.4.1 - * For each of the case above, the specific triangulation of the edge - * intersection points is given. - * When a case is ambiguous, there is an auxiliary table that contains - * the face number to test and the tiling table contains the specific - * triangulations depending on the results - * A minus sign means to invert the result of the test. - */ - //----------------------------------------------------------------------------- - static const char* Tiling7_4_1(unsigned char config) - { - static const char tiling7_4_1[16][15] = { - /* 37: 0, 2, 5, */ { 3, 4, 8, 4, 3, 10, 2, 10, 3, 4, 10, 5, 9, 1, 0 }, - /* 133: 0, 2, 7, */ { 1, 6, 10, 6, 1, 8, 0, 8, 1, 6, 8, 7, 11, 3, 2 }, - /* 161: 0, 5, 7, */ { 11, 3, 6, 9, 6, 3, 6, 9, 5, 0, 9, 3, 7, 4, 8 }, - /* 26: 1, 3, 4, */ { 2, 7, 11, 7, 2, 9, 1, 9, 2, 7, 9, 4, 8, 0, 3 }, - /* 74: 1, 3, 6, */ { 0, 5, 9, 5, 0, 11, 3, 11, 0, 5, 11, 6, 10, 2, 1 }, - /* 82: 1, 4, 6, */ { 8, 0, 7, 10, 7, 0, 7, 10, 6, 1, 10, 0, 4, 5, 9 }, - /* 164: 2, 5, 7, */ { 9, 1, 4, 11, 4, 1, 4, 11, 7, 2, 11, 1, 5, 6, 10 }, - /* 88: 3, 4, 6, */ { 10, 2, 5, 8, 5, 2, 5, 8, 4, 3, 8, 2, 6, 7, 11 }, - /* 167: 0, 1, 2, 5, 7, */ { 5, 2, 10, 2, 5, 8, 4, 8, 5, 2, 8, 3, 11, 7, 6 }, - /* 91: 0, 1, 3, 4, 6, */ { 4, 1, 9, 1, 4, 11, 7, 11, 4, 1, 11, 2, 10, 6, 5 }, - /* 173: 0, 2, 3, 5, 7, */ { 7, 0, 8, 0, 7, 10, 6, 10, 7, 0, 10, 1, 9, 5, 4 }, - /* 181: 0, 2, 4, 5, 7, */ { 9, 5, 0, 11, 0, 5, 0, 11, 3, 6, 11, 5, 1, 2, 10 }, - /* 229: 0, 2, 5, 6, 7, */ { 11, 7, 2, 9, 2, 7, 2, 9, 1, 4, 9, 7, 3, 0, 8 }, - /* 94: 1, 2, 3, 4, 6, */ { 6, 3, 11, 3, 6, 9, 5, 9, 6, 3, 9, 0, 8, 4, 7 }, - /* 122: 1, 3, 4, 5, 6, */ { 10, 6, 1, 8, 1, 6, 1, 8, 0, 7, 8, 6, 2, 3, 11 }, - /* 218: 1, 3, 4, 6, 7, */ { 8, 4, 3, 10, 3, 4, 3, 10, 2, 5, 10, 4, 0, 1, 9 } - }; - return &tiling7_4_1[config][0]; - }; // end of Tiling7_4_1 - - //_____________________________________________________________________________ - /** - * \brief tiling table for case 7.4.2 - * For each of the case above, the specific triangulation of the edge - * intersection points is given. - * When a case is ambiguous, there is an auxiliary table that contains - * the face number to test and the tiling table contains the specific - * triangulations depending on the results - * A minus sign means to invert the result of the test. - */ - //----------------------------------------------------------------------------- - static const char* Tiling7_4_2(unsigned char config) - { - static const char tiling7_4_2[16][27] = { - /* 37: 0, 2, 5, */ { 9, 4, 8, 4, 9, 5, 10, 5, 9, 1, 10, 9, 10, 1, 2, 0, 2, 1, 2, 0, 3, 8, 3, 0, 9, 8, 0 }, - /* 133: 0, 2, 7, */ { 11, 6, 10, 6, 11, 7, 8, 7, 11, 3, 8, 11, 8, 3, 0, 2, 0, 3, 0, 2, 1, 10, 1, 2, 11, 10, 2 }, - /* 161: 0, 5, 7, */ { 11, 3, 8, 0, 8, 3, 8, 0, 9, 8, 9, 4, 5, 4, 9, 4, 5, 7, 6, 7, 5, 7, 6, 11, 7, 11, 8 }, - /* 26: 1, 3, 4, */ { 8, 7, 11, 7, 8, 4, 9, 4, 8, 0, 9, 8, 9, 0, 1, 3, 1, 0, 1, 3, 2, 11, 2, 3, 8, 11, 3 }, - /* 74: 1, 3, 6, */ { 10, 5, 9, 5, 10, 6, 11, 6, 10, 2, 11, 10, 11, 2, 3, 1, 3, 2, 3, 1, 0, 9, 0, 1, 10, 9, 1 }, - /* 82: 1, 4, 6, */ { 8, 0, 9, 1, 9, 0, 9, 1, 10, 9, 10, 5, 6, 5, 10, 5, 6, 4, 7, 4, 6, 4, 7, 8, 4, 8, 9 }, - /* 164: 2, 5, 7, */ { 9, 1, 10, 2, 10, 1, 10, 2, 11, 10, 11, 6, 7, 6, 11, 6, 7, 5, 4, 5, 7, 5, 4, 9, 5, 9, 10 }, - /* 88: 3, 4, 6, */ { 10, 2, 11, 3, 11, 2, 11, 3, 8, 11, 8, 7, 4, 7, 8, 7, 4, 6, 5, 6, 4, 6, 5, 10, 6, 10, 11 }, - /* 167: 0, 1, 2, 5, 7, */ { 11, 2, 10, 2, 11, 3, 8, 3, 11, 7, 8, 11, 8, 7, 4, 6, 4, 7, 4, 6, 5, 10, 5, 6, 11, 10, 6 }, - /* 91: 0, 1, 3, 4, 6, */ { 10, 1, 9, 1, 10, 2, 11, 2, 10, 6, 11, 10, 11, 6, 7, 5, 7, 6, 7, 5, 4, 9, 4, 5, 10, 9, 5 }, - /* 173: 0, 2, 3, 5, 7, */ { 9, 0, 8, 0, 9, 1, 10, 1, 9, 5, 10, 9, 10, 5, 6, 4, 6, 5, 6, 4, 7, 8, 7, 4, 9, 8, 4 }, - /* 181: 0, 2, 4, 5, 7, */ { 9, 5, 10, 6, 10, 5, 10, 6, 11, 10, 11, 2, 3, 2, 11, 2, 3, 1, 0, 1, 3, 1, 0, 9, 1, 9, 10 }, - /* 229: 0, 2, 5, 6, 7, */ { 11, 7, 8, 4, 8, 7, 8, 4, 9, 8, 9, 0, 1, 0, 9, 0, 1, 3, 2, 3, 1, 3, 2, 11, 3, 11, 8 }, - /* 94: 1, 2, 3, 4, 6, */ { 8, 3, 11, 3, 8, 0, 9, 0, 8, 4, 9, 8, 9, 4, 5, 7, 5, 4, 5, 7, 6, 11, 6, 7, 8, 11, 7 }, - /* 122: 1, 3, 4, 5, 6, */ { 10, 6, 11, 7, 11, 6, 11, 7, 8, 11, 8, 3, 0, 3, 8, 3, 0, 2, 1, 2, 0, 2, 1, 10, 2, 10, 11 }, - /* 218: 1, 3, 4, 6, 7, */ { 8, 4, 9, 5, 9, 4, 9, 5, 10, 9, 10, 1, 2, 1, 10, 1, 2, 0, 3, 0, 2, 0, 3, 8, 0, 8, 9 } - }; - return &tiling7_4_2[config][0]; - }; // end of Tiling7_4_2 - //_____________________________________________________________________________ - - - //_____________________________________________________________________________ - /** - * \brief tiling table for case 8 - * For each of the case above, the specific triangulation of the edge - * intersection points is given. - * When a case is ambiguous, there is an auxiliary table that contains - * the face number to test and the tiling table contains the specific - * triangulations depending on the results - * A minus sign means to invert the result of the test. - */ - //----------------------------------------------------------------------------- - static const char* Tiling8(unsigned char config) - { - static const char tiling8[6][6] = { - /* 15: 0, 1, 2, 3, */ { 9, 8, 10, 10, 8, 11 }, - /* 51: 0, 1, 4, 5, */ { 1, 5, 3, 3, 5, 7 }, - /* 153: 0, 3, 4, 7, */ { 0, 4, 2, 4, 6, 2 }, - /* 102: 1, 2, 5, 6, */ { 0, 2, 4, 4, 2, 6 }, - /* 204: 2, 3, 6, 7, */ { 1, 3, 5, 3, 7, 5 }, - /* 240: 4, 5, 6, 7, */ { 9, 10, 8, 10, 11, 8 } - }; - return &tiling8[config][0]; - }; // end of Tiling8 - //_____________________________________________________________________________ - - //_____________________________________________________________________________ - /** - * \brief tiling table for case 9 - * For each of the case above, the specific triangulation of the edge - * intersection points is given. - * When a case is ambiguous, there is an auxiliary table that contains - * the face number to test and the tiling table contains the specific - * triangulations depending on the results - * A minus sign means to invert the result of the test. - */ - //----------------------------------------------------------------------------- - static const char* Tiling9(unsigned char config) - { - static const char tiling9[8][12] = { - /* 39: 0, 1, 2, 5, */ { 2, 10, 5, 3, 2, 5, 3, 5, 4, 3, 4, 8 }, - /* 27: 0, 1, 3, 4, */ { 4, 7, 11, 9, 4, 11, 9, 11, 2, 9, 2, 1 }, - /* 141: 0, 2, 3, 7, */ { 10, 7, 6, 1, 7, 10, 1, 8, 7, 1, 0, 8 }, - /* 177: 0, 4, 5, 7, */ { 3, 6, 11, 0, 6, 3, 0, 5, 6, 0, 9, 5 }, - /* 78: 1, 2, 3, 6, */ { 3, 11, 6, 0, 3, 6, 0, 6, 5, 0, 5, 9 }, - /* 114: 1, 4, 5, 6, */ { 10, 6, 7, 1, 10, 7, 1, 7, 8, 1, 8, 0 }, - /* 228: 2, 5, 6, 7, */ { 4, 11, 7, 9, 11, 4, 9, 2, 11, 9, 1, 2 }, - /* 216: 3, 4, 6, 7, */ { 2, 5, 10, 3, 5, 2, 3, 4, 5, 3, 8, 4 } - }; - return &tiling9[config][0]; - }; - //_____________________________________________________________________________ - - - //_____________________________________________________________________________ - /** - * \brief test table for case 10 - * 2 faces to test + eventually the interior - * When the tests on both specified faces are positive : 4 middle triangles (1) - * When the test on the first specified face is positive : 8 first triangles - * When the test on the second specified face is positive : 8 next triangles - * When the tests on both specified faces are negative : - * - if the test on the interior is negative : 4 middle triangles - * - if the test on the interior is positive : 8 last triangles - * - * For each of the case above, the specific triangulation of the edge - * intersection points is given. - * When a case is ambiguous, there is an auxiliary table that contains - * the face number to test and the tiling table contains the specific - * triangulations depending on the results - * A minus sign means to invert the result of the test. - */ - //----------------------------------------------------------------------------- - static char Test10(unsigned char config, int u) - { - static const char test10[6][3] = { - /* 195: 0, 1, 6, 7, */ { 2, 4, 7 }, - /* 85: 0, 2, 4, 6, */ { 5, 6, 7 }, - /* 105: 0, 3, 5, 6, */ { 1, 3, 7 }, - /* 150: 1, 2, 4, 7, */ { 1, 3, 7 }, - /* 170: 1, 3, 5, 7, */ { 5, 6, 7 }, - /* 60: 2, 3, 4, 5, */ { 2, 4, 7 } - }; - return test10[config][u]; - }; // end of Test10 - - - //_____________________________________________________________________________ - /** - * \brief tiling table for case 10.1.1 - * For each of the case above, the specific triangulation of the edge - * intersection points is given. - * When a case is ambiguous, there is an auxiliary table that contains - * the face number to test and the tiling table contains the specific - * triangulations depending on the results - * A minus sign means to invert the result of the test. - */ - //----------------------------------------------------------------------------- - static const char* Tiling10_1_1(unsigned char config) - { - static const char tiling10_1_1[6][12] = { - /* 195: 0, 1, 6, 7, */ { 5, 10, 7, 11, 7, 10, 8, 1, 9, 1, 8, 3 }, - /* 85: 0, 2, 4, 6, */ { 1, 2, 5, 6, 5, 2, 4, 3, 0, 3, 4, 7 }, - /* 105: 0, 3, 5, 6, */ { 11, 0, 8, 0, 11, 2, 4, 9, 6, 10, 6, 9 }, - /* 150: 1, 2, 4, 7, */ { 9, 0, 10, 2, 10, 0, 6, 8, 4, 8, 6, 11 }, - /* 170: 1, 3, 5, 7, */ { 7, 2, 3, 2, 7, 6, 0, 1, 4, 5, 4, 1 }, - /* 60: 2, 3, 4, 5, */ { 7, 9, 5, 9, 7, 8, 10, 1, 11, 3, 11, 1 } - }; - return &tiling10_1_1[config][0]; - }; // end of Tiling10_1_1 - - - //_____________________________________________________________________________ - /** - * \brief tiling table for case 10.1.1 inverted - * For each of the case above, the specific triangulation of the edge - * intersection points is given. - * When a case is ambiguous, there is an auxiliary table that contains - * the face number to test and the tiling table contains the specific - * triangulations depending on the results - * A minus sign means to invert the result of the test. - */ - //----------------------------------------------------------------------------- - static const char* Tiling10_1_1_(unsigned char config) - { - static const char tiling10_1_1_[6][12] = { - /* 195: 0, 1, 6, 7, */ { 5, 9, 7, 8, 7, 9, 11, 1, 10, 1, 11, 3 }, - /* 85: 0, 2, 4, 6, */ { 3, 2, 7, 6, 7, 2, 4, 1, 0, 1, 4, 5 }, - /* 105: 0, 3, 5, 6, */ { 10, 0, 9, 0, 10, 2, 4, 8, 6, 11, 6, 8 }, - /* 150: 1, 2, 4, 7, */ { 8, 0, 11, 2, 11, 0, 6, 9, 4, 9, 6, 10 }, - /* 170: 1, 3, 5, 7, */ { 5, 2, 1, 2, 5, 6, 0, 3, 4, 7, 4, 3 }, - /* 60: 2, 3, 4, 5, */ { 7, 10, 5, 10, 7, 11, 9, 1, 8, 3, 8, 1 } - }; - return &tiling10_1_1_[config][0]; - }; // end of Tiling10_1_1_ - - - //_____________________________________________________________________________ - /** - * \brief tiling table for case 10.1.2 - * For each of the case above, the specific triangulation of the edge - * intersection points is given. - * When a case is ambiguous, there is an auxiliary table that contains - * the face number to test and the tiling table contains the specific - * triangulations depending on the results - * A minus sign means to invert the result of the test. - */ - //----------------------------------------------------------------------------- - static const char* Tiling10_1_2(unsigned char config) - { - static const char tiling10_1_2[6][24] = { - /* 195: 0, 1, 6, 7, */ { 3, 11, 7, 3, 7, 8, 9, 8, 7, 5, 9, 7, 9, 5, 10, 9, 10, 1, 3, 1, 10, 11, 3, 10 }, - /* 85: 0, 2, 4, 6, */ { 7, 6, 5, 7, 5, 4, 0, 4, 5, 1, 0, 5, 0, 1, 2, 0, 2, 3, 7, 3, 2, 6, 7, 2 }, - /* 105: 0, 3, 5, 6, */ { 11, 2, 10, 6, 11, 10, 11, 6, 4, 11, 4, 8, 0, 8, 4, 9, 0, 4, 0, 9, 10, 0, 10, 2 }, - /* 150: 1, 2, 4, 7, */ { 11, 2, 10, 11, 10, 6, 4, 6, 10, 9, 4, 10, 4, 9, 0, 4, 0, 8, 11, 8, 0, 2, 11, 0 }, - /* 170: 1, 3, 5, 7, */ { 7, 6, 5, 4, 7, 5, 7, 4, 0, 7, 0, 3, 2, 3, 0, 1, 2, 0, 2, 1, 5, 2, 5, 6 }, - /* 60: 2, 3, 4, 5, */ { 7, 8, 3, 11, 7, 3, 7, 11, 10, 7, 10, 5, 9, 5, 10, 1, 9, 10, 9, 1, 3, 9, 3, 8 } - }; - return &tiling10_1_2[config][0]; - }; // end of Tiling10_1_2 - - //_____________________________________________________________________________ - /** - * \brief tiling table for case 10.2 - * For each of the case above, the specific triangulation of the edge - * intersection points is given. - * When a case is ambiguous, there is an auxiliary table that contains - * the face number to test and the tiling table contains the specific - * triangulations depending on the results - * A minus sign means to invert the result of the test. - */ - //----------------------------------------------------------------------------- - static const char* Tiling10_2(unsigned char config) - { - static const char tiling10_2[6][24] = { - /* 195: 0, 1, 6, 7, */ { 12, 5, 9, 12, 9, 8, 12, 8, 3, 12, 3, 1, 12, 1, 10, 12, 10, 11, 12, 11, 7, 12, 7, 5 }, - /* 85: 0, 2, 4, 6, */ { 12, 1, 0, 12, 0, 4, 12, 4, 7, 12, 7, 3, 12, 3, 2, 12, 2, 6, 12, 6, 5, 12, 5, 1 }, - /* 105: 0, 3, 5, 6, */ { 4, 8, 12, 6, 4, 12, 10, 6, 12, 9, 10, 12, 0, 9, 12, 2, 0, 12, 11, 2, 12, 8, 11, 12 }, - /* 150: 1, 2, 4, 7, */ { 12, 9, 4, 12, 4, 6, 12, 6, 11, 12, 11, 8, 12, 8, 0, 12, 0, 2, 12, 2, 10, 12, 10, 9 }, - /* 170: 1, 3, 5, 7, */ { 0, 3, 12, 4, 0, 12, 5, 4, 12, 1, 5, 12, 2, 1, 12, 6, 2, 12, 7, 6, 12, 3, 7, 12 }, - /* 60: 2, 3, 4, 5, */ { 10, 5, 12, 11, 10, 12, 3, 11, 12, 1, 3, 12, 9, 1, 12, 8, 9, 12, 7, 8, 12, 5, 7, 12 } - }; - return &tiling10_2[config][0]; - }; // end of Tiling10_2 - - - - //_____________________________________________________________________________ - /** - * \brief tiling table for case 10.2 inverted - * For each of the case above, the specific triangulation of the edge - * intersection points is given. - * When a case is ambiguous, there is an auxiliary table that contains - * the face number to test and the tiling table contains the specific - * triangulations depending on the results - * A minus sign means to invert the result of the test. - */ - //----------------------------------------------------------------------------- - static const char* Tiling10_2_(unsigned char config) - { - static const char tiling10_2_[6][24] = { - /* 195: 0, 1, 6, 7, */ { 8, 7, 12, 9, 8, 12, 1, 9, 12, 3, 1, 12, 11, 3, 12, 10, 11, 12, 5, 10, 12, 7, 5, 12 }, - /* 85: 0, 2, 4, 6, */ { 4, 5, 12, 0, 4, 12, 3, 0, 12, 7, 3, 12, 6, 7, 12, 2, 6, 12, 1, 2, 12, 5, 1, 12 }, - /* 105: 0, 3, 5, 6, */ { 12, 11, 6, 12, 6, 4, 12, 4, 9, 12, 9, 10, 12, 10, 2, 12, 2, 0, 12, 0, 8, 12, 8, 11 }, - /* 150: 1, 2, 4, 7, */ { 6, 10, 12, 4, 6, 12, 8, 4, 12, 11, 8, 12, 2, 11, 12, 0, 2, 12, 9, 0, 12, 10, 9, 12 }, - /* 170: 1, 3, 5, 7, */ { 12, 7, 4, 12, 4, 0, 12, 0, 1, 12, 1, 5, 12, 5, 6, 12, 6, 2, 12, 2, 3, 12, 3, 7 }, - /* 60: 2, 3, 4, 5, */ { 12, 7, 11, 12, 11, 10, 12, 10, 1, 12, 1, 3, 12, 3, 8, 12, 8, 9, 12, 9, 5, 12, 5, 7 } - }; - return &tiling10_2_[config][0]; - }; // end of Tiling10_2_ - //_____________________________________________________________________________ - - - //_____________________________________________________________________________ - /** - * \brief tiling table for case 11 - * For each of the case above, the specific triangulation of the edge - * intersection points is given. - * When a case is ambiguous, there is an auxiliary table that contains - * the face number to test and the tiling table contains the specific - * triangulations depending on the results - * A minus sign means to invert the result of the test. - */ - //----------------------------------------------------------------------------- - static const char* Tiling11(unsigned char config) - { - static const char tiling11[12][12] = { - /* 23: 0, 1, 2, 4, */ { 2, 10, 9, 2, 9, 7, 2, 7, 3, 7, 9, 4 }, - /* 139: 0, 1, 3, 7, */ { 1, 6, 2, 1, 8, 6, 1, 9, 8, 8, 7, 6 }, - /* 99: 0, 1, 5, 6, */ { 8, 3, 1, 8, 1, 6, 8, 6, 4, 6, 1, 10 }, - /* 77: 0, 2, 3, 6, */ { 0, 8, 11, 0, 11, 5, 0, 5, 1, 5, 11, 6 }, - /* 57: 0, 3, 4, 5, */ { 9, 5, 7, 9, 7, 2, 9, 2, 0, 2, 7, 11 }, - /* 209: 0, 4, 6, 7, */ { 5, 0, 4, 5, 11, 0, 5, 10, 11, 11, 3, 0 }, - /* 46: 1, 2, 3, 5, */ { 5, 4, 0, 5, 0, 11, 5, 11, 10, 11, 0, 3 }, - /* 198: 1, 2, 6, 7, */ { 9, 7, 5, 9, 2, 7, 9, 0, 2, 2, 11, 7 }, - /* 178: 1, 4, 5, 7, */ { 0, 11, 8, 0, 5, 11, 0, 1, 5, 5, 6, 11 }, - /* 156: 2, 3, 4, 7, */ { 8, 1, 3, 8, 6, 1, 8, 4, 6, 6, 10, 1 }, - /* 116: 2, 4, 5, 6, */ { 1, 2, 6, 1, 6, 8, 1, 8, 9, 8, 6, 7 }, - /* 232: 3, 5, 6, 7, */ { 2, 9, 10, 2, 7, 9, 2, 3, 7, 7, 4, 9 } - }; - return &tiling11[config][0]; - }; // end of tiling11 - //_____________________________________________________________________________ - - - - //_____________________________________________________________________________ - /** - * \brief test table for case 12 - * 2 faces to test + eventually the interior - * When the tests on both specified faces are positive : 4 middle triangles (1) - * When the test on the first specified face is positive : 8 first triangles - * When the test on the second specified face is positive : 8 next triangles - * When the tests on both specified faces are negative : - * - if the test on the interior is negative : 4 middle triangles - * - if the test on the interior is positive : 8 last triangles - * The support edge for the interior test is marked as the 4th column. - * - * For each of the case above, the specific triangulation of the edge - * intersection points is given. - * When a case is ambiguous, there is an auxiliary table that contains - * the face number to test and the tiling table contains the specific - * triangulations depending on the results - * A minus sign means to invert the result of the test. - */ - //----------------------------------------------------------------------------- - static char Test12(unsigned char config, int u) - { - static const char test12[24][4] = { - /* 135: 0, 1, 2, 7, */ { 4, 3, 7, 11 }, - /* 75: 0, 1, 3, 6, */ { 3, 2, 7, 10 }, - /* 83: 0, 1, 4, 6, */ { 2, 6, 7, 5 }, - /* 163: 0, 1, 5, 7, */ { 6, 4, 7, 7 }, - /* 45: 0, 2, 3, 5, */ { 2, 1, 7, 9 }, - /* 53: 0, 2, 4, 5, */ { 5, 2, 7, 1 }, - /* 149: 0, 2, 4, 7, */ { 5, 3, 7, 2 }, - /* 101: 0, 2, 5, 6, */ { 5, 1, 7, 0 }, - /* 197: 0, 2, 6, 7, */ { 5, 4, 7, 3 }, - /* 89: 0, 3, 4, 6, */ { 6, 3, 7, 6 }, - /* 169: 0, 3, 5, 7, */ { 1, 6, 7, 4 }, - /* 225: 0, 5, 6, 7, */ { 1, 4, 7, 8 }, - /* 30: 1, 2, 3, 4, */ { 4, 1, 7, 8 }, - /* 86: 1, 2, 4, 6, */ { 6, 1, 7, 4 }, - /* 166: 1, 2, 5, 7, */ { 3, 6, 7, 6 }, - /* 58: 1, 3, 4, 5, */ { 4, 5, 7, 3 }, - /* 154: 1, 3, 4, 7, */ { 1, 5, 7, 0 }, - /* 106: 1, 3, 5, 6, */ { 3, 5, 7, 2 }, - /* 202: 1, 3, 6, 7, */ { 2, 5, 7, 1 }, - /* 210: 1, 4, 6, 7, */ { 1, 2, 7, 9 }, - /* 92: 2, 3, 4, 6, */ { 4, 6, 7, 7 }, - /* 172: 2, 3, 5, 7, */ { 6, 2, 7, 5 }, - /* 180: 2, 4, 5, 7, */ { 2, 3, 7, 10 }, - /* 120: 3, 4, 5, 6, */ { 3, 4, 7, 11 } - }; - return test12[config][u]; - }; - - - //_____________________________________________________________________________ - /** - * \brief tiling table for case 12.1.1 - * For each of the case above, the specific triangulation of the edge - * intersection points is given. - * When a case is ambiguous, there is an auxiliary table that contains - * the face number to test and the tiling table contains the specific - * triangulations depending on the results - * A minus sign means to invert the result of the test. - */ - //----------------------------------------------------------------------------- - static const char* Tiling12_1_1(unsigned char config) - { - static const char tiling12_1_1[24][12] = { - /* 135: 0, 1, 2, 7, */ { 7, 6, 11, 10, 3, 2, 3, 10, 8, 9, 8, 10 }, - /* 75: 0, 1, 3, 6, */ { 6, 5, 10, 9, 2, 1, 2, 9, 11, 8, 11, 9 }, - /* 83: 0, 1, 4, 6, */ { 10, 6, 5, 7, 9, 4, 9, 7, 1, 3, 1, 7 }, - /* 163: 0, 1, 5, 7, */ { 7, 6, 11, 4, 8, 5, 3, 5, 8, 5, 3, 1 }, - /* 45: 0, 2, 3, 5, */ { 5, 4, 9, 8, 1, 0, 1, 8, 10, 11, 10, 8 }, - /* 53: 0, 2, 4, 5, */ { 1, 2, 10, 0, 9, 3, 5, 3, 9, 3, 5, 7 }, - /* 149: 0, 2, 4, 7, */ { 10, 1, 2, 0, 11, 3, 11, 0, 6, 4, 6, 0 }, - /* 101: 0, 2, 5, 6, */ { 8, 3, 0, 2, 9, 1, 9, 2, 4, 6, 4, 2 }, - /* 197: 0, 2, 6, 7, */ { 3, 0, 8, 2, 11, 1, 7, 1, 11, 1, 7, 5 }, - /* 89: 0, 3, 4, 6, */ { 6, 5, 10, 7, 11, 4, 2, 4, 11, 4, 2, 0 }, - /* 169: 0, 3, 5, 7, */ { 9, 5, 4, 6, 8, 7, 8, 6, 0, 2, 0, 6 }, - /* 225: 0, 5, 6, 7, */ { 8, 3, 0, 7, 4, 11, 9, 11, 4, 11, 9, 10 }, - /* 30: 1, 2, 3, 4, */ { 4, 7, 8, 11, 0, 3, 0, 11, 9, 10, 9, 11 }, - /* 86: 1, 2, 4, 6, */ { 4, 7, 8, 5, 9, 6, 0, 6, 9, 6, 0, 2 }, - /* 166: 1, 2, 5, 7, */ { 11, 7, 6, 4, 10, 5, 10, 4, 2, 0, 2, 4 }, - /* 58: 1, 3, 4, 5, */ { 11, 2, 3, 1, 8, 0, 8, 1, 7, 5, 7, 1 }, - /* 154: 1, 3, 4, 7, */ { 0, 1, 9, 3, 8, 2, 4, 2, 8, 2, 4, 6 }, - /* 106: 1, 3, 5, 6, */ { 2, 3, 11, 1, 10, 0, 6, 0, 10, 0, 6, 4 }, - /* 202: 1, 3, 6, 7, */ { 9, 0, 1, 3, 10, 2, 10, 3, 5, 7, 5, 3 }, - /* 210: 1, 4, 6, 7, */ { 9, 0, 1, 4, 5, 8, 10, 8, 5, 8, 10, 11 }, - /* 92: 2, 3, 4, 6, */ { 8, 4, 7, 5, 11, 6, 11, 5, 3, 1, 3, 5 }, - /* 172: 2, 3, 5, 7, */ { 5, 4, 9, 6, 10, 7, 1, 7, 10, 7, 1, 3 }, - /* 180: 2, 4, 5, 7, */ { 10, 1, 2, 5, 6, 9, 11, 9, 6, 9, 11, 8 }, - /* 120: 3, 4, 5, 6, */ { 11, 2, 3, 6, 7, 10, 8, 10, 7, 10, 8, 9 } - }; - return &tiling12_1_1[config][0]; - }; // end of Tiling12_1_1 - - - //_____________________________________________________________________________ - /** - * \brief tiling table for case 12.1.1 inverted - * For each of the case above, the specific triangulation of the edge - * intersection points is given. - * When a case is ambiguous, there is an auxiliary table that contains - * the face number to test and the tiling table contains the specific - * triangulations depending on the results - * A minus sign means to invert the result of the test. - */ - //----------------------------------------------------------------------------- - static const char* Tiling12_1_1_(unsigned char config) - { - static const char tiling12_1_1_[24][12] = { - /* 135: 0, 1, 2, 7, */ { 3, 2, 11, 10, 7, 6, 7, 10, 8, 9, 8, 10 }, - /* 75: 0, 1, 3, 6, */ { 2, 1, 10, 9, 6, 5, 6, 9, 11, 8, 11, 9 }, - /* 83: 0, 1, 4, 6, */ { 9, 4, 5, 7, 10, 6, 10, 7, 1, 3, 1, 7 }, - /* 163: 0, 1, 5, 7, */ { 7, 4, 8, 6, 11, 5, 3, 5, 11, 5, 3, 1 }, - /* 45: 0, 2, 3, 5, */ { 1, 0, 9, 8, 5, 4, 5, 8, 10, 11, 10, 8 }, - /* 53: 0, 2, 4, 5, */ { 1, 0, 9, 2, 10, 3, 5, 3, 10, 3, 5, 7 }, - /* 149: 0, 2, 4, 7, */ { 11, 3, 2, 0, 10, 1, 10, 0, 6, 4, 6, 0 }, - /* 101: 0, 2, 5, 6, */ { 9, 1, 0, 2, 8, 3, 8, 2, 4, 6, 4, 2 }, - /* 197: 0, 2, 6, 7, */ { 3, 2, 11, 0, 8, 1, 7, 1, 8, 1, 7, 5 }, - /* 89: 0, 3, 4, 6, */ { 6, 7, 11, 5, 10, 4, 2, 4, 10, 4, 2, 0 }, - /* 169: 0, 3, 5, 7, */ { 8, 7, 4, 6, 9, 5, 9, 6, 0, 2, 0, 6 }, - /* 225: 0, 5, 6, 7, */ { 8, 7, 4, 3, 0, 11, 9, 11, 0, 11, 9, 10 }, - /* 30: 1, 2, 3, 4, */ { 0, 3, 8, 11, 4, 7, 4, 11, 9, 10, 9, 11 }, - /* 86: 1, 2, 4, 6, */ { 4, 5, 9, 7, 8, 6, 0, 6, 8, 6, 0, 2 }, - /* 166: 1, 2, 5, 7, */ { 10, 5, 6, 4, 11, 7, 11, 4, 2, 0, 2, 4 }, - /* 58: 1, 3, 4, 5, */ { 8, 0, 3, 1, 11, 2, 11, 1, 7, 5, 7, 1 }, - /* 154: 1, 3, 4, 7, */ { 0, 3, 8, 1, 9, 2, 4, 2, 9, 2, 4, 6 }, - /* 106: 1, 3, 5, 6, */ { 2, 1, 10, 3, 11, 0, 6, 0, 11, 0, 6, 4 }, - /* 202: 1, 3, 6, 7, */ { 10, 2, 1, 3, 9, 0, 9, 3, 5, 7, 5, 3 }, - /* 210: 1, 4, 6, 7, */ { 9, 4, 5, 0, 1, 8, 10, 8, 1, 8, 10, 11 }, - /* 92: 2, 3, 4, 6, */ { 11, 6, 7, 5, 8, 4, 8, 5, 3, 1, 3, 5 }, - /* 172: 2, 3, 5, 7, */ { 5, 6, 10, 4, 9, 7, 1, 7, 9, 7, 1, 3 }, - /* 180: 2, 4, 5, 7, */ { 10, 5, 6, 1, 2, 9, 11, 9, 2, 9, 11, 8 }, - /* 120: 3, 4, 5, 6, */ { 11, 6, 7, 2, 3, 10, 8, 10, 3, 10, 8, 9 } - }; - return &tiling12_1_1_[config][0]; - }; // end of Tiling12_1_1_ - - - //_____________________________________________________________________________ - /** - * \brief tiling table for case 12.1.2 - * For each of the case above, the specific triangulation of the edge - * intersection points is given. - * When a case is ambiguous, there is an auxiliary table that contains - * the face number to test and the tiling table contains the specific - * triangulations depending on the results - * A minus sign means to invert the result of the test. - */ - //----------------------------------------------------------------------------- - static const char* Tiling12_1_2(unsigned char config) - { - static const char tiling12_1_2[24][24] = { - /* 135: 0, 1, 2, 7, */ { 7, 3, 11, 3, 7, 8, 9, 8, 7, 6, 9, 7, 9, 6, 10, 2, 10, 6, 11, 2, 6, 2, 11, 3 }, - /* 75: 0, 1, 3, 6, */ { 6, 2, 10, 2, 6, 11, 8, 11, 6, 5, 8, 6, 8, 5, 9, 1, 9, 5, 10, 1, 5, 1, 10, 2 }, - /* 83: 0, 1, 4, 6, */ { 10, 9, 5, 9, 10, 1, 3, 1, 10, 6, 3, 10, 3, 6, 7, 4, 7, 6, 5, 4, 6, 4, 5, 9 }, - /* 163: 0, 1, 5, 7, */ { 7, 8, 11, 3, 11, 8, 11, 3, 1, 11, 1, 6, 5, 6, 1, 6, 5, 4, 6, 4, 7, 8, 7, 4 }, - /* 45: 0, 2, 3, 5, */ { 5, 1, 9, 1, 5, 10, 11, 10, 5, 4, 11, 5, 11, 4, 8, 0, 8, 4, 9, 0, 4, 0, 9, 1 }, - /* 53: 0, 2, 4, 5, */ { 1, 9, 10, 5, 10, 9, 10, 5, 7, 10, 7, 2, 3, 2, 7, 2, 3, 0, 2, 0, 1, 9, 1, 0 }, - /* 149: 0, 2, 4, 7, */ { 10, 11, 2, 11, 10, 6, 4, 6, 10, 1, 4, 10, 4, 1, 0, 3, 0, 1, 2, 3, 1, 3, 2, 11 }, - /* 101: 0, 2, 5, 6, */ { 8, 9, 0, 9, 8, 4, 6, 4, 8, 3, 6, 8, 6, 3, 2, 1, 2, 3, 0, 1, 3, 1, 0, 9 }, - /* 197: 0, 2, 6, 7, */ { 3, 11, 8, 7, 8, 11, 8, 7, 5, 8, 5, 0, 1, 0, 5, 0, 1, 2, 0, 2, 3, 11, 3, 2 }, - /* 89: 0, 3, 4, 6, */ { 6, 11, 10, 2, 10, 11, 10, 2, 0, 10, 0, 5, 4, 5, 0, 5, 4, 7, 5, 7, 6, 11, 6, 7 }, - /* 169: 0, 3, 5, 7, */ { 9, 8, 4, 8, 9, 0, 2, 0, 9, 5, 2, 9, 2, 5, 6, 7, 6, 5, 4, 7, 5, 7, 4, 8 }, - /* 225: 0, 5, 6, 7, */ { 8, 4, 0, 9, 0, 4, 0, 9, 10, 0, 10, 3, 11, 3, 10, 3, 11, 7, 3, 7, 8, 4, 8, 7 }, - /* 30: 1, 2, 3, 4, */ { 4, 0, 8, 0, 4, 9, 10, 9, 4, 7, 10, 4, 10, 7, 11, 3, 11, 7, 8, 3, 7, 3, 8, 0 }, - /* 86: 1, 2, 4, 6, */ { 4, 9, 8, 0, 8, 9, 8, 0, 2, 8, 2, 7, 6, 7, 2, 7, 6, 5, 7, 5, 4, 9, 4, 5 }, - /* 166: 1, 2, 5, 7, */ { 11, 10, 6, 10, 11, 2, 0, 2, 11, 7, 0, 11, 0, 7, 4, 5, 4, 7, 6, 5, 7, 5, 6, 10 }, - /* 58: 1, 3, 4, 5, */ { 11, 8, 3, 8, 11, 7, 5, 7, 11, 2, 5, 11, 5, 2, 1, 0, 1, 2, 3, 0, 2, 0, 3, 8 }, - /* 154: 1, 3, 4, 7, */ { 0, 8, 9, 4, 9, 8, 9, 4, 6, 9, 6, 1, 2, 1, 6, 1, 2, 3, 1, 3, 0, 8, 0, 3 }, - /* 106: 1, 3, 5, 6, */ { 2, 10, 11, 6, 11, 10, 11, 6, 4, 11, 4, 3, 0, 3, 4, 3, 0, 1, 3, 1, 2, 10, 2, 1 }, - /* 202: 1, 3, 6, 7, */ { 9, 10, 1, 10, 9, 5, 7, 5, 9, 0, 7, 9, 7, 0, 3, 2, 3, 0, 1, 2, 0, 2, 1, 10 }, - /* 210: 1, 4, 6, 7, */ { 9, 5, 1, 10, 1, 5, 1, 10, 11, 1, 11, 0, 8, 0, 11, 0, 8, 4, 0, 4, 9, 5, 9, 4 }, - /* 92: 2, 3, 4, 6, */ { 8, 11, 7, 11, 8, 3, 1, 3, 8, 4, 1, 8, 1, 4, 5, 6, 5, 4, 7, 6, 4, 6, 7, 11 }, - /* 172: 2, 3, 5, 7, */ { 5, 10, 9, 1, 9, 10, 9, 1, 3, 9, 3, 4, 7, 4, 3, 4, 7, 6, 4, 6, 5, 10, 5, 6 }, - /* 180: 2, 4, 5, 7, */ { 10, 6, 2, 11, 2, 6, 2, 11, 8, 2, 8, 1, 9, 1, 8, 1, 9, 5, 1, 5, 10, 6, 10, 5 }, - /* 120: 3, 4, 5, 6, */ { 11, 7, 3, 8, 3, 7, 3, 8, 9, 3, 9, 2, 10, 2, 9, 2, 10, 6, 2, 6, 11, 7, 11, 6 } - }; - return &tiling12_1_2[config][0]; - }; // end of Tiling12_1_2 - - - //_____________________________________________________________________________ - /** - * \brief tiling table for case 12.2 - * For each of the case above, the specific triangulation of the edge - * intersection points is given. - * When a case is ambiguous, there is an auxiliary table that contains - * the face number to test and the tiling table contains the specific - * triangulations depending on the results - * A minus sign means to invert the result of the test. - */ - //----------------------------------------------------------------------------- - static const char* Tiling12_2(unsigned char config) - { - static const char tiling12_2[24][24] = { - /* 135: 0, 1, 2, 7, */ { 9, 8, 12, 10, 9, 12, 2, 10, 12, 3, 2, 12, 11, 3, 12, 6, 11, 12, 7, 6, 12, 8, 7, 12 }, - /* 75: 0, 1, 3, 6, */ { 8, 11, 12, 9, 8, 12, 1, 9, 12, 2, 1, 12, 10, 2, 12, 5, 10, 12, 6, 5, 12, 11, 6, 12 }, - /* 83: 0, 1, 4, 6, */ { 3, 1, 12, 7, 3, 12, 4, 7, 12, 9, 4, 12, 5, 9, 12, 6, 5, 12, 10, 6, 12, 1, 10, 12 }, - /* 163: 0, 1, 5, 7, */ { 12, 3, 1, 12, 1, 5, 12, 5, 6, 12, 6, 11, 12, 11, 7, 12, 7, 4, 12, 4, 8, 12, 8, 3 }, - /* 45: 0, 2, 3, 5, */ { 11, 10, 12, 8, 11, 12, 0, 8, 12, 1, 0, 12, 9, 1, 12, 4, 9, 12, 5, 4, 12, 10, 5, 12 }, - /* 53: 0, 2, 4, 5, */ { 12, 5, 7, 12, 7, 3, 12, 3, 2, 12, 2, 10, 12, 10, 1, 12, 1, 0, 12, 0, 9, 12, 9, 5 }, - /* 149: 0, 2, 4, 7, */ { 4, 6, 12, 0, 4, 12, 1, 0, 12, 10, 1, 12, 2, 10, 12, 3, 2, 12, 11, 3, 12, 6, 11, 12 }, - /* 101: 0, 2, 5, 6, */ { 6, 4, 12, 2, 6, 12, 3, 2, 12, 8, 3, 12, 0, 8, 12, 1, 0, 12, 9, 1, 12, 4, 9, 12 }, - /* 197: 0, 2, 6, 7, */ { 12, 7, 5, 12, 5, 1, 12, 1, 0, 12, 0, 8, 12, 8, 3, 12, 3, 2, 12, 2, 11, 12, 11, 7 }, - /* 89: 0, 3, 4, 6, */ { 12, 2, 0, 12, 0, 4, 12, 4, 5, 12, 5, 10, 12, 10, 6, 12, 6, 7, 12, 7, 11, 12, 11, 2 }, - /* 169: 0, 3, 5, 7, */ { 2, 0, 12, 6, 2, 12, 7, 6, 12, 8, 7, 12, 4, 8, 12, 5, 4, 12, 9, 5, 12, 0, 9, 12 }, - /* 225: 0, 5, 6, 7, */ { 12, 9, 10, 12, 10, 11, 12, 11, 7, 12, 7, 4, 12, 4, 8, 12, 8, 3, 12, 3, 0, 12, 0, 9 }, - /* 30: 1, 2, 3, 4, */ { 10, 9, 12, 11, 10, 12, 7, 11, 12, 4, 7, 12, 8, 4, 12, 3, 8, 12, 0, 3, 12, 9, 0, 12 }, - /* 86: 1, 2, 4, 6, */ { 12, 0, 2, 12, 2, 6, 12, 6, 7, 12, 7, 8, 12, 8, 4, 12, 4, 5, 12, 5, 9, 12, 9, 0 }, - /* 166: 1, 2, 5, 7, */ { 0, 2, 12, 4, 0, 12, 5, 4, 12, 10, 5, 12, 6, 10, 12, 7, 6, 12, 11, 7, 12, 2, 11, 12 }, - /* 58: 1, 3, 4, 5, */ { 5, 7, 12, 1, 5, 12, 0, 1, 12, 8, 0, 12, 3, 8, 12, 2, 3, 12, 11, 2, 12, 7, 11, 12 }, - /* 154: 1, 3, 4, 7, */ { 12, 4, 6, 12, 6, 2, 12, 2, 3, 12, 3, 8, 12, 8, 0, 12, 0, 1, 12, 1, 9, 12, 9, 4 }, - /* 106: 1, 3, 5, 6, */ { 12, 6, 4, 12, 4, 0, 12, 0, 1, 12, 1, 10, 12, 10, 2, 12, 2, 3, 12, 3, 11, 12, 11, 6 }, - /* 202: 1, 3, 6, 7, */ { 7, 5, 12, 3, 7, 12, 2, 3, 12, 10, 2, 12, 1, 10, 12, 0, 1, 12, 9, 0, 12, 5, 9, 12 }, - /* 210: 1, 4, 6, 7, */ { 12, 10, 11, 12, 11, 8, 12, 8, 0, 12, 0, 1, 12, 1, 9, 12, 9, 4, 12, 4, 5, 12, 5, 10 }, - /* 92: 2, 3, 4, 6, */ { 1, 3, 12, 5, 1, 12, 6, 5, 12, 11, 6, 12, 7, 11, 12, 4, 7, 12, 8, 4, 12, 3, 8, 12 }, - /* 172: 2, 3, 5, 7, */ { 12, 1, 3, 12, 3, 7, 12, 7, 4, 12, 4, 9, 12, 9, 5, 12, 5, 6, 12, 6, 10, 12, 10, 1 }, - /* 180: 2, 4, 5, 7, */ { 12, 11, 8, 12, 8, 9, 12, 9, 1, 12, 1, 2, 12, 2, 10, 12, 10, 5, 12, 5, 6, 12, 6, 11 }, - /* 120: 3, 4, 5, 6, */ { 12, 8, 9, 12, 9, 10, 12, 10, 2, 12, 2, 3, 12, 3, 11, 12, 11, 6, 12, 6, 7, 12, 7, 8 } - }; - return &tiling12_2[config][0]; - }; // end of Tiling12_2 - - - //_____________________________________________________________________________ - /** - * \brief tiling table for case 12.2 inverted - * For each of the case above, the specific triangulation of the edge - * intersection points is given. - * When a case is ambiguous, there is an auxiliary table that contains - * the face number to test and the tiling table contains the specific - * triangulations depending on the results - * A minus sign means to invert the result of the test. - */ - //----------------------------------------------------------------------------- - static const char* Tiling12_2_(unsigned char config) - { - static const char tiling12_2_[24][24] = { - /* 135: 0, 1, 2, 7, */ { 12, 2, 11, 12, 11, 7, 12, 7, 6, 12, 6, 10, 12, 10, 9, 12, 9, 8, 12, 8, 3, 12, 3, 2 }, - /* 75: 0, 1, 3, 6, */ { 12, 1, 10, 12, 10, 6, 12, 6, 5, 12, 5, 9, 12, 9, 8, 12, 8, 11, 12, 11, 2, 12, 2, 1 }, - /* 83: 0, 1, 4, 6, */ { 12, 4, 5, 12, 5, 10, 12, 10, 6, 12, 6, 7, 12, 7, 3, 12, 3, 1, 12, 1, 9, 12, 9, 4 }, - /* 163: 0, 1, 5, 7, */ { 7, 6, 12, 8, 7, 12, 4, 8, 12, 5, 4, 12, 1, 5, 12, 3, 1, 12, 11, 3, 12, 6, 11, 12 }, - /* 45: 0, 2, 3, 5, */ { 12, 0, 9, 12, 9, 5, 12, 5, 4, 12, 4, 8, 12, 8, 11, 12, 11, 10, 12, 10, 1, 12, 1, 0 }, - /* 53: 0, 2, 4, 5, */ { 1, 2, 12, 9, 1, 12, 0, 9, 12, 3, 0, 12, 7, 3, 12, 5, 7, 12, 10, 5, 12, 2, 10, 12 }, - /* 149: 0, 2, 4, 7, */ { 12, 1, 2, 12, 2, 11, 12, 11, 3, 12, 3, 0, 12, 0, 4, 12, 4, 6, 12, 6, 10, 12, 10, 1 }, - /* 101: 0, 2, 5, 6, */ { 12, 3, 0, 12, 0, 9, 12, 9, 1, 12, 1, 2, 12, 2, 6, 12, 6, 4, 12, 4, 8, 12, 8, 3 }, - /* 197: 0, 2, 6, 7, */ { 3, 0, 12, 11, 3, 12, 2, 11, 12, 1, 2, 12, 5, 1, 12, 7, 5, 12, 8, 7, 12, 0, 8, 12 }, - /* 89: 0, 3, 4, 6, */ { 6, 5, 12, 11, 6, 12, 7, 11, 12, 4, 7, 12, 0, 4, 12, 2, 0, 12, 10, 2, 12, 5, 10, 12 }, - /* 169: 0, 3, 5, 7, */ { 12, 7, 4, 12, 4, 9, 12, 9, 5, 12, 5, 6, 12, 6, 2, 12, 2, 0, 12, 0, 8, 12, 8, 7 }, - /* 225: 0, 5, 6, 7, */ { 8, 7, 12, 0, 8, 12, 3, 0, 12, 11, 3, 12, 10, 11, 12, 9, 10, 12, 4, 9, 12, 7, 4, 12 }, - /* 30: 1, 2, 3, 4, */ { 12, 7, 8, 12, 8, 0, 12, 0, 3, 12, 3, 11, 12, 11, 10, 12, 10, 9, 12, 9, 4, 12, 4, 7 }, - /* 86: 1, 2, 4, 6, */ { 4, 7, 12, 9, 4, 12, 5, 9, 12, 6, 5, 12, 2, 6, 12, 0, 2, 12, 8, 0, 12, 7, 8, 12 }, - /* 166: 1, 2, 5, 7, */ { 12, 5, 6, 12, 6, 11, 12, 11, 7, 12, 7, 4, 12, 4, 0, 12, 0, 2, 12, 2, 10, 12, 10, 5 }, - /* 58: 1, 3, 4, 5, */ { 12, 0, 3, 12, 3, 11, 12, 11, 2, 12, 2, 1, 12, 1, 5, 12, 5, 7, 12, 7, 8, 12, 8, 0 }, - /* 154: 1, 3, 4, 7, */ { 0, 3, 12, 9, 0, 12, 1, 9, 12, 2, 1, 12, 6, 2, 12, 4, 6, 12, 8, 4, 12, 3, 8, 12 }, - /* 106: 1, 3, 5, 6, */ { 2, 1, 12, 11, 2, 12, 3, 11, 12, 0, 3, 12, 4, 0, 12, 6, 4, 12, 10, 6, 12, 1, 10, 12 }, - /* 202: 1, 3, 6, 7, */ { 12, 2, 1, 12, 1, 9, 12, 9, 0, 12, 0, 3, 12, 3, 7, 12, 7, 5, 12, 5, 10, 12, 10, 2 }, - /* 210: 1, 4, 6, 7, */ { 9, 0, 12, 5, 9, 12, 4, 5, 12, 8, 4, 12, 11, 8, 12, 10, 11, 12, 1, 10, 12, 0, 1, 12 }, - /* 92: 2, 3, 4, 6, */ { 12, 6, 7, 12, 7, 8, 12, 8, 4, 12, 4, 5, 12, 5, 1, 12, 1, 3, 12, 3, 11, 12, 11, 6 }, - /* 172: 2, 3, 5, 7, */ { 5, 4, 12, 10, 5, 12, 6, 10, 12, 7, 6, 12, 3, 7, 12, 1, 3, 12, 9, 1, 12, 4, 9, 12 }, - /* 180: 2, 4, 5, 7, */ { 10, 1, 12, 6, 10, 12, 5, 6, 12, 9, 5, 12, 8, 9, 12, 11, 8, 12, 2, 11, 12, 1, 2, 12 }, - /* 120: 3, 4, 5, 6, */ { 11, 2, 12, 7, 11, 12, 6, 7, 12, 10, 6, 12, 9, 10, 12, 8, 9, 12, 3, 8, 12, 2, 3, 12 } - }; - return &tiling12_2_[config][0]; - }; // end of Tiling12_2_ - //_____________________________________________________________________________ - - - //_____________________________________________________________________________ - /** - * \brief test table for case 13 - * All faces are to be tested - * - * For each of the case above, the specific triangulation of the edge - * intersection points is given. - * When a case is ambiguous, there is an auxiliary table that contains - * the face number to test and the tiling table contains the specific - * triangulations depending on the results - * A minus sign means to invert the result of the test. - */ - //----------------------------------------------------------------------------- - /* 13: face test */ - static char Test13(unsigned char config, int u) - { - static const char test13[2][7] = { - /* 165: 0, 2, 5, 7, */ { 1,2,3,4,5,6,7 }, - /* 90: 1, 3, 4, 6, */ { 2,3,4,1,5,6,7 }, - }; - return test13[config][u]; - }; // end of Test13 - - //_____________________________________________________________________________ - /** - * \brief subconfiguration table for case 13 - * Hard-coded tests for the subconfiguration determination - * - * For each of the case above, the specific triangulation of the edge - * intersection points is given. - * When a case is ambiguous, there is an auxiliary table that contains - * the face number to test and the tiling table contains the specific - * triangulations depending on the results - * A minus sign means to invert the result of the test. - */ - //----------------------------------------------------------------------------- - /* 13: sub configs */ - static char Subconfig13(unsigned char config) - { - static const char subconfig13[64] = { - /* 0: 0,0,0,0,0,0 */ 0, - /* 1: 1,0,0,0,0,0 */ 1, - /* 2: 0,1,0,0,0,0 */ 2, - /* 3: 1,1,0,0,0,0 */ 7, - /* 4: 0,0,1,0,0,0 */ 3, - /* 5: 1,0,1,0,0,0 */ -1, - /* 6: 0,1,1,0,0,0 */ 11, - /* 7: 1,1,1,0,0,0 */ -1, - /* 8: 0,0,0,1,0,0 */ 4, - /* 9: 1,0,0,1,0,0 */ 8, - /* 10: 0,1,0,1,0,0 */ -1, - /* 11: 1,1,0,1,0,0 */ -1, - /* 12: 0,0,1,1,0,0 */ 14, - /* 13: 1,0,1,1,0,0 */ -1, - /* 14: 0,1,1,1,0,0 */ -1, - /* 15: 1,1,1,1,0,0 */ -1, - /* 16: 0,0,0,0,1,0 */ 5, - /* 17: 1,0,0,0,1,0 */ 9, - /* 18: 0,1,0,0,1,0 */ 12, - /* 19: 1,1,0,0,1,0 */ 23, - /* 20: 0,0,1,0,1,0 */ 15, - /* 21: 1,0,1,0,1,0 */ -1, - /* 22: 0,1,1,0,1,0 */ 21, - /* 23: 1,1,1,0,1,0 */ 38, - /* 24: 0,0,0,1,1,0 */ 17, - /* 25: 1,0,0,1,1,0 */ 20, - /* 26: 0,1,0,1,1,0 */ -1, - /* 27: 1,1,0,1,1,0 */ 36, - /* 28: 0,0,1,1,1,0 */ 26, - /* 29: 1,0,1,1,1,0 */ 33, - /* 30: 0,1,1,1,1,0 */ 30, - /* 31: 1,1,1,1,1,0 */ 44, - /* 32: 0,0,0,0,0,1 */ 6, - /* 33: 1,0,0,0,0,1 */ 10, - /* 34: 0,1,0,0,0,1 */ 13, - /* 35: 1,1,0,0,0,1 */ 19, - /* 36: 0,0,1,0,0,1 */ 16, - /* 37: 1,0,1,0,0,1 */ -1, - /* 38: 0,1,1,0,0,1 */ 25, - /* 39: 1,1,1,0,0,1 */ 37, - /* 40: 0,0,0,1,0,1 */ 18, - /* 41: 1,0,0,1,0,1 */ 24, - /* 42: 0,1,0,1,0,1 */ -1, - /* 43: 1,1,0,1,0,1 */ 35, - /* 44: 0,0,1,1,0,1 */ 22, - /* 45: 1,0,1,1,0,1 */ 32, - /* 46: 0,1,1,1,0,1 */ 29, - /* 47: 1,1,1,1,0,1 */ 43, - /* 48: 0,0,0,0,1,1 */ -1, - /* 49: 1,0,0,0,1,1 */ -1, - /* 50: 0,1,0,0,1,1 */ -1, - /* 51: 1,1,0,0,1,1 */ 34, - /* 52: 0,0,1,0,1,1 */ -1, - /* 53: 1,0,1,0,1,1 */ -1, - /* 54: 0,1,1,0,1,1 */ 28, - /* 55: 1,1,1,0,1,1 */ 42, - /* 56: 0,0,0,1,1,1 */ -1, - /* 57: 1,0,0,1,1,1 */ 31, - /* 58: 0,1,0,1,1,1 */ -1, - /* 59: 1,1,0,1,1,1 */ 41, - /* 60: 0,0,1,1,1,1 */ 27, - /* 61: 1,0,1,1,1,1 */ 40, - /* 62: 0,1,1,1,1,1 */ 39, - /* 63: 1,1,1,1,1,1 */ 45, - }; - return subconfig13[config]; - }; // end of Subconfig13 - - //_____________________________________________________________________________ - /** - * \brief tiling table for case 13.1 - * For each of the case above, the specific triangulation of the edge - * intersection points is given. - * When a case is ambiguous, there is an auxiliary table that contains - * the face number to test and the tiling table contains the specific - * triangulations depending on the results - * A minus sign means to invert the result of the test. - */ - //----------------------------------------------------------------------------- - /* 13.1 */ - static const char* Tiling13_1(unsigned char config) - { - static const char tiling13_1[2][12] = { - /* 165: 0, 2, 5, 7, */ { 11, 7, 6, 1, 2, 10, 8, 3, 0, 9, 5, 4 }, - /* 90: 1, 3, 4, 6, */ { 8, 4, 7, 2, 3, 11, 9, 0, 1, 10, 6, 5 } - }; - return &tiling13_1[config][0]; - }; // end of Tiling13_1 - - - //_____________________________________________________________________________ - /** - * \brief tiling table for case 13.1 inverted - * For each of the case above, the specific triangulation of the edge - * intersection points is given. - * When a case is ambiguous, there is an auxiliary table that contains - * the face number to test and the tiling table contains the specific - * triangulations depending on the results - * A minus sign means to invert the result of the test. - */ - //----------------------------------------------------------------------------- - /* 13.1 */ - static const char* Tiling13_1_(unsigned char config) - { - static const char tiling13_1_[2][12] = { - /* 165: 0, 2, 5, 7, */ { 7, 4, 8, 11, 3, 2, 1, 0, 9, 5, 6, 10 }, - /* 90: 1, 3, 4, 6, */ { 6, 7, 11, 10, 2, 1, 0, 3, 8, 4, 5, 9 } - }; - return &tiling13_1_[config][0]; - }; // end of Tiling13_1_ - - - - //_____________________________________________________________________________ - /** - * \brief tiling table for case 13.2 - * For each of the case above, the specific triangulation of the edge - * intersection points is given. - * When a case is ambiguous, there is an auxiliary table that contains - * the face number to test and the tiling table contains the specific - * triangulations depending on the results - * A minus sign means to invert the result of the test. - */ - //----------------------------------------------------------------------------- - /* 13.2 */ - static const char* Tiling13_2(unsigned char config, unsigned char u) - { - static const char tiling13_2[2][6][18] = { - /* 165: 0, 2, 5, 7, */ { - /* 1 */ { 1, 2, 10, 11, 7, 6, 3, 4, 8, 4, 3, 5, 0, 5, 3, 5, 0, 9 }, - /* 2 */ { 8, 3, 0, 11, 7, 6, 9, 1, 4, 2, 4, 1, 4, 2, 5, 10, 5, 2 }, - /* 3 */ { 9, 5, 4, 8, 3, 0, 1, 6, 10, 6, 1, 7, 2, 7, 1, 7, 2, 11 }, - /* 4 */ { 9, 5, 4, 1, 2, 10, 11, 3, 6, 0, 6, 3, 6, 0, 7, 8, 7, 0 }, - /* 5 */ { 9, 5, 4, 11, 7, 6, 0, 10, 1, 10, 0, 8, 10, 8, 2, 3, 2, 8 }, - /* 6 */ { 1, 2, 10, 3, 0, 8, 4, 9, 7, 11, 7, 9, 5, 11, 9, 11, 5, 6 } - }, - /* 90: 1, 3, 4, 6, */ { - /* 1 */ { 2, 3, 11, 8, 4, 7, 0, 5, 9, 5, 0, 6, 1, 6, 0, 6, 1, 10 }, - /* 2 */ { 9, 0, 1, 8, 4, 7, 10, 2, 5, 3, 5, 2, 5, 3, 6, 11, 6, 3 }, - /* 3 */ { 6, 5, 10, 9, 0, 1, 2, 7, 11, 7, 2, 4, 3, 4, 2, 4, 3, 8 }, - /* 4 */ { 6, 5, 10, 2, 3, 11, 8, 0, 7, 1, 7, 0, 7, 1, 4, 9, 4, 1 }, - /* 5 */ { 6, 5, 10, 8, 4, 7, 1, 11, 2, 11, 1, 9, 11, 9, 3, 0, 3, 9 }, - /* 6 */ { 2, 3, 11, 0, 1, 9, 5, 10, 4, 8, 4, 10, 6, 8, 10, 8, 6, 7 } - } }; - return &tiling13_2[config][u][0]; - }; // end of Tiling13_2 - - - //_____________________________________________________________________________ - /** - * \brief tiling table for case 13.2 inverted - * For each of the case above, the specific triangulation of the edge - * intersection points is given. - * When a case is ambiguous, there is an auxiliary table that contains - * the face number to test and the tiling table contains the specific - * triangulations depending on the results - * A minus sign means to invert the result of the test. - */ - //----------------------------------------------------------------------------- - /* 13.2 */ - static const char* Tiling13_2_(unsigned char config, unsigned char u) - { - static const char tiling13_2_[2][6][18] = { - /* 165: 0, 2, 5, 7, */ { - /* 1 */ { 10, 5, 6, 11, 3, 2, 7, 0, 8, 0, 7, 1, 4, 1, 7, 1, 4, 9 }, - /* 2 */ { 11, 3, 2, 7, 4, 8, 9, 5, 0, 6, 0, 5, 0, 6, 1, 10, 1, 6 }, - /* 3 */ { 1, 0, 9, 7, 4, 8, 5, 2, 10, 2, 5, 3, 6, 3, 5, 3, 6, 11 }, - /* 4 */ { 10, 5, 6, 1, 0, 9, 11, 7, 2, 4, 2, 7, 2, 4, 3, 8, 3, 4 }, - /* 5 */ { 10, 5, 6, 7, 4, 8, 2, 11, 1, 9, 1, 11, 3, 9, 11, 9, 3, 0 }, - /* 6 */ { 11, 3, 2, 9, 1, 0, 4, 10, 5, 10, 4, 8, 10, 8, 6, 7, 6, 8 } - }, - /* 90: 1, 3, 4, 6, */ { - /* 1 */ { 6, 7, 11, 8, 0, 3, 4, 1, 9, 1, 4, 2, 5, 2, 4, 2, 5, 10 }, - /* 2 */ { 8, 0, 3, 4, 5, 9, 10, 6, 1, 7, 1, 6, 1, 7, 2, 11, 2, 7 }, - /* 3 */ { 2, 1, 10, 4, 5, 9, 6, 3, 11, 3, 6, 0, 7, 0, 6, 0, 7, 8 }, - /* 4 */ { 6, 7, 11, 2, 1, 10, 8, 4, 3, 5, 3, 4, 3, 5, 0, 9, 0, 5 }, - /* 5 */ { 6, 7, 11, 4, 5, 9, 3, 8, 2, 10, 2, 8, 0, 10, 8, 10, 0, 1 }, - /* 6 */ { 8, 0, 3, 10, 2, 1, 5, 11, 6, 11, 5, 9, 11, 9, 7, 4, 7, 9 } - } }; - return &tiling13_2_[config][u][0]; - }; // end of Tiling13_2_ - - - - //_____________________________________________________________________________ - /** - * \brief tiling table for case 13.3 - * For each of the case above, the specific triangulation of the edge - * intersection points is given. - * When a case is ambiguous, there is an auxiliary table that contains - * the face number to test and the tiling table contains the specific - * triangulations depending on the results - * A minus sign means to invert the result of the test. - */ - //----------------------------------------------------------------------------- - /* 13.3 */ - static const char* Tiling13_3(unsigned char config, unsigned int u) - { - static const char tiling13_3[2][12][30] = { - /* 165: 0, 2, 5, 7, */ { - /* 1,2 */ { 11, 7, 6, 12, 2, 10, 12, 10, 5, 12, 5, 4, 12, 4, 8, 12, 8, 3, 12, 3, 0, 12, 0, 9, 12, 9, 1, 12, 1, 2 }, - /* 1,4 */ { 1, 2, 10, 9, 5, 12, 0, 9, 12, 3, 0, 12, 11, 3, 12, 6, 11, 12, 7, 6, 12, 8, 7, 12, 4, 8, 12, 5, 4, 12 }, - /* 1,5 */ { 11, 7, 6, 12, 5, 4, 12, 4, 8, 12, 8, 3, 12, 3, 2, 12, 2, 10, 12, 10, 1, 12, 1, 0, 12, 0, 9, 12, 9, 5 }, - /* 1,6 */ { 1, 2, 10, 12, 3, 0, 12, 0, 9, 12, 9, 5, 12, 5, 6, 12, 6, 11, 12, 11, 7, 12, 7, 4, 12, 4, 8, 12, 8, 3 }, - /* 2,3 */ { 8, 3, 0, 11, 7, 12, 2, 11, 12, 1, 2, 12, 9, 1, 12, 4, 9, 12, 5, 4, 12, 10, 5, 12, 6, 10, 12, 7, 6, 12 }, - /* 2,5 */ { 11, 7, 6, 5, 4, 12, 10, 5, 12, 2, 10, 12, 3, 2, 12, 8, 3, 12, 0, 8, 12, 1, 0, 12, 9, 1, 12, 4, 9, 12 }, - /* 2,6 */ { 8, 3, 0, 1, 2, 12, 9, 1, 12, 4, 9, 12, 7, 4, 12, 11, 7, 12, 6, 11, 12, 5, 6, 12, 10, 5, 12, 2, 10, 12 }, - /* 3,4 */ { 9, 5, 4, 12, 0, 8, 12, 8, 7, 12, 7, 6, 12, 6, 10, 12, 10, 1, 12, 1, 2, 12, 2, 11, 12, 11, 3, 12, 3, 0 }, - /* 3,5 */ { 9, 5, 4, 12, 7, 6, 12, 6, 10, 12, 10, 1, 12, 1, 0, 12, 0, 8, 12, 8, 3, 12, 3, 2, 12, 2, 11, 12, 11, 7 }, - /* 3,6 */ { 8, 3, 0, 12, 1, 2, 12, 2, 11, 12, 11, 7, 12, 7, 4, 12, 4, 9, 12, 9, 5, 12, 5, 6, 12, 6, 10, 12, 10, 1 }, - /* 4,5 */ { 9, 5, 4, 7, 6, 12, 8, 7, 12, 0, 8, 12, 1, 0, 12, 10, 1, 12, 2, 10, 12, 3, 2, 12, 11, 3, 12, 6, 11, 12 }, - /* 4,6 */ { 1, 2, 10, 3, 0, 12, 11, 3, 12, 6, 11, 12, 5, 6, 12, 9, 5, 12, 4, 9, 12, 7, 4, 12, 8, 7, 12, 0, 8, 12 } - }, - /* 90: 1, 3, 4, 6, */ { - /* 1,2 */ { 8, 4, 7, 12, 3, 11, 12, 11, 6, 12, 6, 5, 12, 5, 9, 12, 9, 0, 12, 0, 1, 12, 1, 10, 12, 10, 2, 12, 2, 3 }, - /* 1,4 */ { 2, 3, 11, 10, 6, 12, 1, 10, 12, 0, 1, 12, 8, 0, 12, 7, 8, 12, 4, 7, 12, 9, 4, 12, 5, 9, 12, 6, 5, 12 }, - /* 1,5 */ { 8, 4, 7, 12, 6, 5, 12, 5, 9, 12, 9, 0, 12, 0, 3, 12, 3, 11, 12, 11, 2, 12, 2, 1, 12, 1, 10, 12, 10, 6 }, - /* 1,6 */ { 2, 3, 11, 12, 0, 1, 12, 1, 10, 12, 10, 6, 12, 6, 7, 12, 7, 8, 12, 8, 4, 12, 4, 5, 12, 5, 9, 12, 9, 0 }, - /* 2,3 */ { 0, 1, 9, 8, 4, 12, 3, 8, 12, 2, 3, 12, 10, 2, 12, 5, 10, 12, 6, 5, 12, 11, 6, 12, 7, 11, 12, 4, 7, 12 }, - /* 2,5 */ { 8, 4, 7, 6, 5, 12, 11, 6, 12, 3, 11, 12, 0, 3, 12, 9, 0, 12, 1, 9, 12, 2, 1, 12, 10, 2, 12, 5, 10, 12 }, - /* 2,6 */ { 9, 0, 1, 2, 3, 12, 10, 2, 12, 5, 10, 12, 4, 5, 12, 8, 4, 12, 7, 8, 12, 6, 7, 12, 11, 6, 12, 3, 11, 12 }, - /* 3,4 */ { 6, 5, 10, 12, 1, 9, 12, 9, 4, 12, 4, 7, 12, 7, 11, 12, 11, 2, 12, 2, 3, 12, 3, 8, 12, 8, 0, 12, 0, 1 }, - /* 3,5 */ { 6, 5, 10, 12, 4, 7, 12, 7, 11, 12, 11, 2, 12, 2, 1, 12, 1, 9, 12, 9, 0, 12, 0, 3, 12, 3, 8, 12, 8, 4 }, - /* 3,6 */ { 9, 0, 1, 12, 2, 3, 12, 3, 8, 12, 8, 4, 12, 4, 5, 12, 5, 10, 12, 10, 6, 12, 6, 7, 12, 7, 11, 12, 11, 2 }, - /* 4,5 */ { 6, 5, 10, 4, 7, 12, 9, 4, 12, 1, 9, 12, 2, 1, 12, 11, 2, 12, 3, 11, 12, 0, 3, 12, 8, 0, 12, 7, 8, 12 }, - /* 4,6 */ { 2, 3, 11, 0, 1, 12, 8, 0, 12, 7, 8, 12, 6, 7, 12, 10, 6, 12, 5, 10, 12, 4, 5, 12, 9, 4, 12, 1, 9, 12 } - } }; - return &tiling13_3[config][u][0]; - }; // end of Tiling13_3 - - - //_____________________________________________________________________________ - /** - * \brief tiling table for case 13.3, inverted - * For each of the case above, the specific triangulation of the edge - * intersection points is given. - * When a case is ambiguous, there is an auxiliary table that contains - * the face number to test and the tiling table contains the specific - * triangulations depending on the results - * A minus sign means to invert the result of the test. - */ - //----------------------------------------------------------------------------- - /* 13.3 */ - static const char* Tiling13_3_(unsigned char config, unsigned char u) - { - static const char tiling13_3_[2][12][30] = { - /* 165: 0, 2, 5, 7, */ { - /* 1,2 */ { 3, 2, 11, 8, 7, 12, 0, 8, 12, 1, 0, 12, 10, 1, 12, 6, 10, 12, 5, 6, 12, 9, 5, 12, 4, 9, 12, 7, 4, 12 }, - /* 1,4 */ { 5, 6, 10, 12, 2, 11, 12, 11, 7, 12, 7, 4, 12, 4, 9, 12, 9, 1, 12, 1, 0, 12, 0, 8, 12, 8, 3, 12, 3, 2 }, - /* 1,5 */ { 10, 5, 6, 12, 7, 4, 12, 4, 9, 12, 9, 1, 12, 1, 2, 12, 2, 11, 12, 11, 3, 12, 3, 0, 12, 0, 8, 12, 8, 7 }, - /* 1,6 */ { 11, 3, 2, 12, 1, 0, 12, 0, 8, 12, 8, 7, 12, 7, 6, 12, 6, 10, 12, 10, 5, 12, 5, 4, 12, 4, 9, 12, 9, 1 }, - /* 2,3 */ { 7, 4, 8, 11, 3, 12, 6, 11, 12, 5, 6, 12, 9, 5, 12, 0, 9, 12, 1, 0, 12, 10, 1, 12, 2, 10, 12, 3, 2, 12 }, - /* 2,5 */ { 7, 4, 8, 5, 6, 12, 9, 5, 12, 0, 9, 12, 3, 0, 12, 11, 3, 12, 2, 11, 12, 1, 2, 12, 10, 1, 12, 6, 10, 12 }, - /* 2,6 */ { 11, 3, 2, 1, 0, 12, 10, 1, 12, 6, 10, 12, 7, 6, 12, 8, 7, 12, 4, 8, 12, 5, 4, 12, 9, 5, 12, 0, 9, 12 }, - /* 3,4 */ { 1, 0, 9, 12, 4, 8, 12, 8, 3, 12, 3, 2, 12, 2, 10, 12, 10, 5, 12, 5, 6, 12, 6, 11, 12, 11, 7, 12, 7, 4 }, - /* 3,5 */ { 7, 4, 8, 12, 5, 6, 12, 6, 11, 12, 11, 3, 12, 3, 0, 12, 0, 9, 12, 9, 1, 12, 1, 2, 12, 2, 10, 12, 10, 5 }, - /* 3,6 */ { 1, 0, 9, 12, 3, 2, 12, 2, 10, 12, 10, 5, 12, 5, 4, 12, 4, 8, 12, 8, 7, 12, 7, 6, 12, 6, 11, 12, 11, 3 }, - /* 4,5 */ { 10, 5, 6, 7, 4, 12, 11, 7, 12, 2, 11, 12, 1, 2, 12, 9, 1, 12, 0, 9, 12, 3, 0, 12, 8, 3, 12, 4, 8, 12 }, - /* 4,6 */ { 9, 1, 0, 3, 2, 12, 8, 3, 12, 4, 8, 12, 5, 4, 12, 10, 5, 12, 6, 10, 12, 7, 6, 12, 11, 7, 12, 2, 11, 12 } - }, - /* 90: 1, 3, 4, 6, */ { - /* 1,2 */ { 0, 3, 8, 9, 4, 12, 1, 9, 12, 2, 1, 12, 11, 2, 12, 7, 11, 12, 6, 7, 12, 10, 6, 12, 5, 10, 12, 4, 5, 12 }, - /* 1,4 */ { 11, 6, 7, 12, 3, 8, 12, 8, 4, 12, 4, 5, 12, 5, 10, 12, 10, 2, 12, 2, 1, 12, 1, 9, 12, 9, 0, 12, 0, 3 }, - /* 1,5 */ { 6, 7, 11, 12, 4, 5, 12, 5, 10, 12, 10, 2, 12, 2, 3, 12, 3, 8, 12, 8, 0, 12, 0, 1, 12, 1, 9, 12, 9, 4 }, - /* 1,6 */ { 8, 0, 3, 12, 2, 1, 12, 1, 9, 12, 9, 4, 12, 4, 7, 12, 7, 11, 12, 11, 6, 12, 6, 5, 12, 5, 10, 12, 10, 2 }, - /* 2,3 */ { 4, 5, 9, 8, 0, 12, 7, 8, 12, 6, 7, 12, 10, 6, 12, 1, 10, 12, 2, 1, 12, 11, 2, 12, 3, 11, 12, 0, 3, 12 }, - /* 2,5 */ { 4, 5, 9, 6, 7, 12, 10, 6, 12, 1, 10, 12, 0, 1, 12, 8, 0, 12, 3, 8, 12, 2, 3, 12, 11, 2, 12, 7, 11, 12 }, - /* 2,6 */ { 8, 0, 3, 2, 1, 12, 11, 2, 12, 7, 11, 12, 4, 7, 12, 9, 4, 12, 5, 9, 12, 6, 5, 12, 10, 6, 12, 1, 10, 12 }, - /* 3,4 */ { 2, 1, 10, 12, 5, 9, 12, 9, 0, 12, 0, 3, 12, 3, 11, 12, 11, 6, 12, 6, 7, 12, 7, 8, 12, 8, 4, 12, 4, 5 }, - /* 3,5 */ { 4, 5, 9, 12, 6, 7, 12, 7, 8, 12, 8, 0, 12, 0, 1, 12, 1, 10, 12, 10, 2, 12, 2, 3, 12, 3, 11, 12, 11, 6 }, - /* 3,6 */ { 2, 1, 10, 12, 0, 3, 12, 3, 11, 12, 11, 6, 12, 6, 5, 12, 5, 9, 12, 9, 4, 12, 4, 7, 12, 7, 8, 12, 8, 0 }, - /* 4,5 */ { 6, 7, 11, 4, 5, 12, 8, 4, 12, 3, 8, 12, 2, 3, 12, 10, 2, 12, 1, 10, 12, 0, 1, 12, 9, 0, 12, 5, 9, 12 }, - /* 4,6 */ { 10, 2, 1, 0, 3, 12, 9, 0, 12, 5, 9, 12, 6, 5, 12, 11, 6, 12, 7, 11, 12, 4, 7, 12, 8, 4, 12, 3, 8, 12 } - } }; - return &tiling13_3_[config][u][0]; - }; // end of Tiling13_3_ - - - //_____________________________________________________________________________ - /** - * \brief tiling table for case 13.4 - * For each of the case above, the specific triangulation of the edge - * intersection points is given. - * When a case is ambiguous, there is an auxiliary table that contains - * the face number to test and the tiling table contains the specific - * triangulations depending on the results - * A minus sign means to invert the result of the test. - */ - //----------------------------------------------------------------------------- - /* 13.4 */ - static const char* Tiling13_4(unsigned char config, unsigned int u) - { - static const char tiling13_4[2][4][36] = { - /* 165: 0, 2, 5, 7, */ { - /* 1,2,6 */ { 12, 2, 10, 12, 10, 5, 12, 5, 6, 12, 6, 11, 12, 11, 7, 12, 7, 4, 12, 4, 8, 12, 8, 3, 12, 3, 0, 12, 0, 9, 12, 9, 1, 12, 1, 2 }, - /* 1,4,5 */ { 11, 3, 12, 6, 11, 12, 7, 6, 12, 8, 7, 12, 4, 8, 12, 5, 4, 12, 9, 5, 12, 0, 9, 12, 1, 0, 12, 10, 1, 12, 2, 10, 12, 3, 2, 12 }, - /* 2,3,5 */ { 9, 1, 12, 4, 9, 12, 5, 4, 12, 10, 5, 12, 6, 10, 12, 7, 6, 12, 11, 7, 12, 2, 11, 12, 3, 2, 12, 8, 3, 12, 0, 8, 12, 1, 0, 12 }, - /* 3,4,6 */ { 12, 0, 8, 12, 8, 7, 12, 7, 4, 12, 4, 9, 12, 9, 5, 12, 5, 6, 12, 6, 10, 12, 10, 1, 12, 1, 2, 12, 2, 11, 12, 11, 3, 12, 3, 0 } - }, - /* 90: 1, 3, 4, 6, */ { - /* 1,2,6 */ { 12, 3, 11, 12, 11, 6, 12, 6, 7, 12, 7, 8, 12, 8, 4, 12, 4, 5, 12, 5, 9, 12, 9, 0, 12, 0, 1, 12, 1, 10, 12, 10, 2, 12, 2, 3 }, - /* 1,4,5 */ { 8, 0, 12, 7, 8, 12, 4, 7, 12, 9, 4, 12, 5, 9, 12, 6, 5, 12, 10, 6, 12, 1, 10, 12, 2, 1, 12, 11, 2, 12, 3, 11, 12, 0, 3, 12 }, - /* 2,3,5 */ { 10, 2, 12, 5, 10, 12, 6, 5, 12, 11, 6, 12, 7, 11, 12, 4, 7, 12, 8, 4, 12, 3, 8, 12, 0, 3, 12, 9, 0, 12, 1, 9, 12, 2, 1, 12 }, - /* 3,4,6 */ { 12, 1, 9, 12, 9, 4, 12, 4, 5, 12, 5, 10, 12, 10, 6, 12, 6, 7, 12, 7, 11, 12, 11, 2, 12, 2, 3, 12, 3, 8, 12, 8, 0, 12, 0, 1 } - } }; - return &tiling13_4[config][u][0]; - }; // end of Tiling13_4 - - - //_____________________________________________________________________________ - /** - * \brief tiling table for case 13.5.1 - * The support edge for the interior test is marked as the 1st column. - * For each of the case above, the specific triangulation of the edge - * intersection points is given. - * When a case is ambiguous, there is an auxiliary table that contains - * the face number to test and the tiling table contains the specific - * triangulations depending on the results - * A minus sign means to invert the result of the test. - */ - //----------------------------------------------------------------------------- - /* 13.5.1 */ - static const char* Tiling13_5_1(unsigned char config, int u) - { - static const char tiling13_5_1[2][4][18] = { - /* 165: 0, 2, 5, 7, */ { - /* 1,2,5 */ { 7, 6, 11, 1, 0, 9, 10, 3, 2, 3, 10, 5, 3, 5, 8, 4, 8, 5 }, - /* 1,4,6 */ { 1, 2, 10, 7, 4, 8, 3, 0, 11, 6, 11, 0, 9, 6, 0, 6, 9, 5 }, - /* 2,3,6 */ { 3, 0, 8, 5, 6, 10, 1, 2, 9, 4, 9, 2, 11, 4, 2, 4, 11, 7 }, - /* 3,4,5 */ { 5, 4, 9, 3, 2, 11, 8, 1, 0, 1, 8, 7, 1, 7, 10, 6, 10, 7 } - }, - /* 90: 1, 3, 4, 6, */ { - /* 1,2,5 */ { 4, 7, 8, 2, 1, 10, 11, 0, 3, 0, 11, 6, 0, 6, 9, 5, 9, 6 }, - /* 1,4,6 */ { 2, 3, 11, 4, 5, 9, 0, 1, 8, 7, 8, 1, 10, 7, 1, 7, 10, 6 }, - /* 2,3,6 */ { 0, 1, 9, 6, 7, 11, 2, 3, 10, 5, 10, 3, 8, 5, 3, 5, 8, 4 }, - /* 3,4,5 */ { 6, 5, 10, 0, 3, 8, 9, 2, 1, 2, 9, 4, 2, 4, 11, 7, 11, 4 } - } }; - return &tiling13_5_1[config][u][0]; - }; // end of Tiling13_5_1 - - //_____________________________________________________________________________ - /** - * \brief tiling table for case 13.5.2 - * For each of the case above, the specific triangulation of the edge - * intersection points is given. - * When a case is ambiguous, there is an auxiliary table that contains - * the face number to test and the tiling table contains the specific - * triangulations depending on the results - * A minus sign means to invert the result of the test. - */ - //----------------------------------------------------------------------------- - /* 13.5.2 */ - static const char* Tiling13_5_2(unsigned char config, int u) - { - static const char tiling13_5_2[2][4][30] = { - /* 165: 0, 2, 5, 7, */ { - /* 1,2,5 */ { 1, 0, 9, 7, 4, 8, 7, 8, 3, 7, 3, 11, 2, 11, 3, 11, 2, 10, 11, 10, 6, 5, 6, 10, 6, 5, 7, 4, 7, 5 }, - /* 1,4,6 */ { 7, 4, 8, 11, 3, 2, 6, 11, 2, 10, 6, 2, 6, 10, 5, 9, 5, 10, 1, 9, 10, 9, 1, 0, 2, 0, 1, 0, 2, 3 }, - /* 2,3,6 */ { 5, 6, 10, 9, 1, 0, 4, 9, 0, 8, 4, 0, 4, 8, 7, 11, 7, 8, 3, 11, 8, 11, 3, 2, 0, 2, 3, 2, 0, 1 }, - /* 3,4,5 */ { 3, 2, 11, 5, 6, 10, 5, 10, 1, 5, 1, 9, 0, 9, 1, 9, 0, 8, 9, 8, 4, 4, 8, 7, 4, 7, 5, 6, 5, 7 } - }, - /* 90: 1, 3, 4, 6, */ { - /* 1,2,5 */ { 2, 1, 10, 4, 5, 9, 4, 9, 0, 4, 0, 8, 3, 8, 0, 8, 3, 11, 8, 11, 7, 6, 7, 11, 7, 6, 4, 5, 4, 6 }, - /* 1,4,6 */ { 4, 5, 9, 8, 0, 3, 7, 8, 3, 11, 7, 3, 7, 11, 6, 10, 6, 11, 2, 10, 11, 10, 2, 1, 3, 1, 2, 1, 3, 0 }, - /* 2,3,6 */ { 6, 7, 11, 10, 2, 1, 5, 10, 1, 9, 5, 1, 5, 9, 4, 8, 4, 9, 0, 8, 9, 8, 0, 3, 1, 3, 0, 3, 1, 2 }, - /* 3,4,5 */ { 0, 3, 8, 6, 7, 11, 6, 11, 2, 6, 2, 10, 1, 10, 2, 10, 1, 9, 10, 9, 5, 5, 9, 4, 5, 4, 6, 7, 6, 4 } - } }; - return &tiling13_5_2[config][u][0]; - }; // end of Tiling13_5_2 - //_____________________________________________________________________________ - - - //_____________________________________________________________________________ - /** - * \brief tiling table for case 14 - * For each of the case above, the specific triangulation of the edge - * intersection points is given. - * When a case is ambiguous, there is an auxiliary table that contains - * the face number to test and the tiling table contains the specific - * triangulations depending on the results - * A minus sign means to invert the result of the test. - */ - //----------------------------------------------------------------------------- - static const char* Tiling14(unsigned char config) - { - static const char tiling14[12][12] = { - /* 71: 0, 1, 2, 6, */ { 5, 9, 8, 5, 8, 2, 5, 2, 6, 3, 2, 8 }, - /* 43: 0, 1, 3, 5, */ { 2, 1, 5, 2, 5, 8, 2, 8, 11, 4, 8, 5 }, - /* 147: 0, 1, 4, 7, */ { 9, 4, 6, 9, 6, 3, 9, 3, 1, 11, 3, 6 }, - /* 29: 0, 2, 3, 4, */ { 1, 11, 10, 1, 4, 11, 1, 0, 4, 7, 11, 4 }, - /* 201: 0, 3, 6, 7, */ { 8, 2, 0, 8, 5, 2, 8, 7, 5, 10, 2, 5 }, - /* 113: 0, 4, 5, 6, */ { 0, 7, 3, 0, 10, 7, 0, 9, 10, 6, 7, 10 }, - /* 142: 1, 2, 3, 7, */ { 0, 3, 7, 0, 7, 10, 0, 10, 9, 6, 10, 7 }, - /* 54: 1, 2, 4, 5, */ { 8, 0, 2, 8, 2, 5, 8, 5, 7, 10, 5, 2 }, - /* 226: 1, 5, 6, 7, */ { 1, 10, 11, 1, 11, 4, 1, 4, 0, 7, 4, 11 }, - /* 108: 2, 3, 5, 6, */ { 9, 6, 4, 9, 3, 6, 9, 1, 3, 11, 6, 3 }, - /* 212: 2, 4, 6, 7, */ { 2, 5, 1, 2, 8, 5, 2, 11, 8, 4, 5, 8 }, - /* 184: 3, 4, 5, 7, */ { 5, 8, 9, 5, 2, 8, 5, 6, 2, 3, 8, 2 } - }; - return &tiling14[config][0]; - }; // end of Tiling14 - //_____________________________________________________________________________ - - - - //_____________________________________________________________________________ - /** - * \brief original Marching Cubes implementation - * For each of the possible vertex states listed in this table there is a - * specific triangulation of the edge intersection points. The table lists - * all of them in the form of 0-5 edge triples with the list terminated by - * the invalid value -1. For example: casesClassic[3] list the 2 triangles - * formed when cube[0] and cube[1] are inside of the surface, but the rest of - * the cube is not. - */ - //----------------------------------------------------------------------------- - static char CasesClassic(unsigned char u, unsigned char w) - { - static const char casesClassic[256][16] = { - /* 0: */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 1: 0, */ { 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 2: 1, */ { 0, 1, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 3: 0, 1, */ { 1, 8, 3, 9, 8, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 4: 2, */ { 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 5: 0, 2, */ { 0, 8, 3, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 6: 1, 2, */ { 9, 2, 10, 0, 2, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 7: 0, 1, 2, */ { 2, 8, 3, 2, 10, 8, 10, 9, 8, -1, -1, -1, -1, -1, -1, -1 }, - /* 8: 3, */ { 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 9: 0, 3, */ { 0, 11, 2, 8, 11, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 10: 1, 3, */ { 1, 9, 0, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 11: 0, 1, 3, */ { 1, 11, 2, 1, 9, 11, 9, 8, 11, -1, -1, -1, -1, -1, -1, -1 }, - /* 12: 2, 3, */ { 3, 10, 1, 11, 10, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 13: 0, 2, 3, */ { 0, 10, 1, 0, 8, 10, 8, 11, 10, -1, -1, -1, -1, -1, -1, -1 }, - /* 14: 1, 2, 3, */ { 3, 9, 0, 3, 11, 9, 11, 10, 9, -1, -1, -1, -1, -1, -1, -1 }, - /* 15: 0, 1, 2, 3, */ { 9, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 16: 4, */ { 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 17: 0, 4, */ { 4, 3, 0, 7, 3, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 18: 1, 4, */ { 0, 1, 9, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 19: 0, 1, 4, */ { 4, 1, 9, 4, 7, 1, 7, 3, 1, -1, -1, -1, -1, -1, -1, -1 }, - /* 20: 2, 4, */ { 1, 2, 10, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 21: 0, 2, 4, */ { 3, 4, 7, 3, 0, 4, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1 }, - /* 22: 1, 2, 4, */ { 9, 2, 10, 9, 0, 2, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1 }, - /* 23: 0, 1, 2, 4, */ { 2, 10, 9, 2, 9, 7, 2, 7, 3, 7, 9, 4, -1, -1, -1, -1 }, - /* 24: 3, 4, */ { 8, 4, 7, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 25: 0, 3, 4, */ { 11, 4, 7, 11, 2, 4, 2, 0, 4, -1, -1, -1, -1, -1, -1, -1 }, - /* 26: 1, 3, 4, */ { 9, 0, 1, 8, 4, 7, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1 }, - /* 27: 0, 1, 3, 4, */ { 4, 7, 11, 9, 4, 11, 9, 11, 2, 9, 2, 1, -1, -1, -1, -1 }, - /* 28: 2, 3, 4, */ { 3, 10, 1, 3, 11, 10, 7, 8, 4, -1, -1, -1, -1, -1, -1, -1 }, - /* 29: 0, 2, 3, 4, */ { 1, 11, 10, 1, 4, 11, 1, 0, 4, 7, 11, 4, -1, -1, -1, -1 }, - /* 30: 1, 2, 3, 4, */ { 4, 7, 8, 9, 0, 11, 9, 11, 10, 11, 0, 3, -1, -1, -1, -1 }, - /* 31: 0, 1, 2, 3, 4, */ { 4, 7, 11, 4, 11, 9, 9, 11, 10, -1, -1, -1, -1, -1, -1, -1 }, - /* 32: 5, */ { 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 33: 0, 5, */ { 9, 5, 4, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 34: 1, 5, */ { 0, 5, 4, 1, 5, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 35: 0, 1, 5, */ { 8, 5, 4, 8, 3, 5, 3, 1, 5, -1, -1, -1, -1, -1, -1, -1 }, - /* 36: 2, 5, */ { 1, 2, 10, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 37: 0, 2, 5, */ { 3, 0, 8, 1, 2, 10, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1 }, - /* 38: 1, 2, 5, */ { 5, 2, 10, 5, 4, 2, 4, 0, 2, -1, -1, -1, -1, -1, -1, -1 }, - /* 39: 0, 1, 2, 5, */ { 2, 10, 5, 3, 2, 5, 3, 5, 4, 3, 4, 8, -1, -1, -1, -1 }, - /* 40: 3, 5, */ { 9, 5, 4, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 41: 0, 3, 5, */ { 0, 11, 2, 0, 8, 11, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1 }, - /* 42: 1, 3, 5, */ { 0, 5, 4, 0, 1, 5, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1 }, - /* 43: 0, 1, 3, 5, */ { 2, 1, 5, 2, 5, 8, 2, 8, 11, 4, 8, 5, -1, -1, -1, -1 }, - /* 44: 2, 3, 5, */ { 10, 3, 11, 10, 1, 3, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1 }, - /* 45: 0, 2, 3, 5, */ { 4, 9, 5, 0, 8, 1, 8, 10, 1, 8, 11, 10, -1, -1, -1, -1 }, - /* 46: 1, 2, 3, 5, */ { 5, 4, 0, 5, 0, 11, 5, 11, 10, 11, 0, 3, -1, -1, -1, -1 }, - /* 47: 0, 1, 2, 3, 5, */ { 5, 4, 8, 5, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1 }, - /* 48: 4, 5, */ { 9, 7, 8, 5, 7, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 49: 0, 4, 5, */ { 9, 3, 0, 9, 5, 3, 5, 7, 3, -1, -1, -1, -1, -1, -1, -1 }, - /* 50: 1, 4, 5, */ { 0, 7, 8, 0, 1, 7, 1, 5, 7, -1, -1, -1, -1, -1, -1, -1 }, - /* 51: 0, 1, 4, 5, */ { 1, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 52: 2, 4, 5, */ { 9, 7, 8, 9, 5, 7, 10, 1, 2, -1, -1, -1, -1, -1, -1, -1 }, - /* 53: 0, 2, 4, 5, */ { 10, 1, 2, 9, 5, 0, 5, 3, 0, 5, 7, 3, -1, -1, -1, -1 }, - /* 54: 1, 2, 4, 5, */ { 8, 0, 2, 8, 2, 5, 8, 5, 7, 10, 5, 2, -1, -1, -1, -1 }, - /* 55: 0, 1, 2, 4, 5, */ { 2, 10, 5, 2, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1 }, - /* 56: 3, 4, 5, */ { 7, 9, 5, 7, 8, 9, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1 }, - /* 57: 0, 3, 4, 5, */ { 9, 5, 7, 9, 7, 2, 9, 2, 0, 2, 7, 11, -1, -1, -1, -1 }, - /* 58: 1, 3, 4, 5, */ { 2, 3, 11, 0, 1, 8, 1, 7, 8, 1, 5, 7, -1, -1, -1, -1 }, - /* 59: 0, 1, 3, 4, 5, */ { 11, 2, 1, 11, 1, 7, 7, 1, 5, -1, -1, -1, -1, -1, -1, -1 }, - /* 60: 2, 3, 4, 5, */ { 9, 5, 8, 8, 5, 7, 10, 1, 3, 10, 3, 11, -1, -1, -1, -1 }, - /* 61: 0, 2, 3, 4, 5, */ { 5, 7, 0, 5, 0, 9, 7, 11, 0, 1, 0, 10, 11, 10, 0, -1 }, - /* 62: 1, 2, 3, 4, 5, */ { 11, 10, 0, 11, 0, 3, 10, 5, 0, 8, 0, 7, 5, 7, 0, -1 }, - /* 63: 0, 1, 2, 3, 4, 5, */ { 11, 10, 5, 7, 11, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 64: 6, */ { 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 65: 0, 6, */ { 0, 8, 3, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 66: 1, 6, */ { 9, 0, 1, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 67: 0, 1, 6, */ { 1, 8, 3, 1, 9, 8, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1 }, - /* 68: 2, 6, */ { 1, 6, 5, 2, 6, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 69: 0, 2, 6, */ { 1, 6, 5, 1, 2, 6, 3, 0, 8, -1, -1, -1, -1, -1, -1, -1 }, - /* 70: 1, 2, 6, */ { 9, 6, 5, 9, 0, 6, 0, 2, 6, -1, -1, -1, -1, -1, -1, -1 }, - /* 71: 0, 1, 2, 6, */ { 5, 9, 8, 5, 8, 2, 5, 2, 6, 3, 2, 8, -1, -1, -1, -1 }, - /* 72: 3, 6, */ { 2, 3, 11, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 73: 0, 3, 6, */ { 11, 0, 8, 11, 2, 0, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1 }, - /* 74: 1, 3, 6, */ { 0, 1, 9, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1 }, - /* 75: 0, 1, 3, 6, */ { 5, 10, 6, 1, 9, 2, 9, 11, 2, 9, 8, 11, -1, -1, -1, -1 }, - /* 76: 2, 3, 6, */ { 6, 3, 11, 6, 5, 3, 5, 1, 3, -1, -1, -1, -1, -1, -1, -1 }, - /* 77: 0, 2, 3, 6, */ { 0, 8, 11, 0, 11, 5, 0, 5, 1, 5, 11, 6, -1, -1, -1, -1 }, - /* 78: 1, 2, 3, 6, */ { 3, 11, 6, 0, 3, 6, 0, 6, 5, 0, 5, 9, -1, -1, -1, -1 }, - /* 79: 0, 1, 2, 3, 6, */ { 6, 5, 9, 6, 9, 11, 11, 9, 8, -1, -1, -1, -1, -1, -1, -1 }, - /* 80: 4, 6, */ { 5, 10, 6, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 81: 0, 4, 6, */ { 4, 3, 0, 4, 7, 3, 6, 5, 10, -1, -1, -1, -1, -1, -1, -1 }, - /* 82: 1, 4, 6, */ { 1, 9, 0, 5, 10, 6, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1 }, - /* 83: 0, 1, 4, 6, */ { 10, 6, 5, 1, 9, 7, 1, 7, 3, 7, 9, 4, -1, -1, -1, -1 }, - /* 84: 2, 4, 6, */ { 6, 1, 2, 6, 5, 1, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1 }, - /* 85: 0, 2, 4, 6, */ { 1, 2, 5, 5, 2, 6, 3, 0, 4, 3, 4, 7, -1, -1, -1, -1 }, - /* 86: 1, 2, 4, 6, */ { 8, 4, 7, 9, 0, 5, 0, 6, 5, 0, 2, 6, -1, -1, -1, -1 }, - /* 87: 0, 1, 2, 4, 6, */ { 7, 3, 9, 7, 9, 4, 3, 2, 9, 5, 9, 6, 2, 6, 9, -1 }, - /* 88: 3, 4, 6, */ { 3, 11, 2, 7, 8, 4, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1 }, - /* 89: 0, 3, 4, 6, */ { 5, 10, 6, 4, 7, 2, 4, 2, 0, 2, 7, 11, -1, -1, -1, -1 }, - /* 90: 1, 3, 4, 6, */ { 0, 1, 9, 4, 7, 8, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1 }, - /* 91: 0, 1, 3, 4, 6, */ { 9, 2, 1, 9, 11, 2, 9, 4, 11, 7, 11, 4, 5, 10, 6, -1 }, - /* 92: 2, 3, 4, 6, */ { 8, 4, 7, 3, 11, 5, 3, 5, 1, 5, 11, 6, -1, -1, -1, -1 }, - /* 93: 0, 2, 3, 4, 6, */ { 5, 1, 11, 5, 11, 6, 1, 0, 11, 7, 11, 4, 0, 4, 11, -1 }, - /* 94: 1, 2, 3, 4, 6, */ { 0, 5, 9, 0, 6, 5, 0, 3, 6, 11, 6, 3, 8, 4, 7, -1 }, - /* 95: 0, 1, 2, 3, 4, 6, */ { 6, 5, 9, 6, 9, 11, 4, 7, 9, 7, 11, 9, -1, -1, -1, -1 }, - /* 96: 5, 6, */ { 10, 4, 9, 6, 4, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 97: 0, 5, 6, */ { 4, 10, 6, 4, 9, 10, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1 }, - /* 98: 1, 5, 6, */ { 10, 0, 1, 10, 6, 0, 6, 4, 0, -1, -1, -1, -1, -1, -1, -1 }, - /* 99: 0, 1, 5, 6, */ { 8, 3, 1, 8, 1, 6, 8, 6, 4, 6, 1, 10, -1, -1, -1, -1 }, - /* 100: 2, 5, 6, */ { 1, 4, 9, 1, 2, 4, 2, 6, 4, -1, -1, -1, -1, -1, -1, -1 }, - /* 101: 0, 2, 5, 6, */ { 3, 0, 8, 1, 2, 9, 2, 4, 9, 2, 6, 4, -1, -1, -1, -1 }, - /* 102: 1, 2, 5, 6, */ { 0, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 103: 0, 1, 2, 5, 6, */ { 8, 3, 2, 8, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1 }, - /* 104: 3, 5, 6, */ { 10, 4, 9, 10, 6, 4, 11, 2, 3, -1, -1, -1, -1, -1, -1, -1 }, - /* 105: 0, 3, 5, 6, */ { 0, 8, 2, 2, 8, 11, 4, 9, 10, 4, 10, 6, -1, -1, -1, -1 }, - /* 106: 1, 3, 5, 6, */ { 3, 11, 2, 0, 1, 6, 0, 6, 4, 6, 1, 10, -1, -1, -1, -1 }, - /* 107: 0, 1, 3, 5, 6, */ { 6, 4, 1, 6, 1, 10, 4, 8, 1, 2, 1, 11, 8, 11, 1, -1 }, - /* 108: 2, 3, 5, 6, */ { 9, 6, 4, 9, 3, 6, 9, 1, 3, 11, 6, 3, -1, -1, -1, -1 }, - /* 109: 0, 2, 3, 5, 6, */ { 8, 11, 1, 8, 1, 0, 11, 6, 1, 9, 1, 4, 6, 4, 1, -1 }, - /* 110: 1, 2, 3, 5, 6, */ { 3, 11, 6, 3, 6, 0, 0, 6, 4, -1, -1, -1, -1, -1, -1, -1 }, - /* 111: 0, 1, 2, 3, 5, 6, */ { 6, 4, 8, 11, 6, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 112: 4, 5, 6, */ { 7, 10, 6, 7, 8, 10, 8, 9, 10, -1, -1, -1, -1, -1, -1, -1 }, - /* 113: 0, 4, 5, 6, */ { 0, 7, 3, 0, 10, 7, 0, 9, 10, 6, 7, 10, -1, -1, -1, -1 }, - /* 114: 1, 4, 5, 6, */ { 10, 6, 7, 1, 10, 7, 1, 7, 8, 1, 8, 0, -1, -1, -1, -1 }, - /* 115: 0, 1, 4, 5, 6, */ { 10, 6, 7, 10, 7, 1, 1, 7, 3, -1, -1, -1, -1, -1, -1, -1 }, - /* 116: 2, 4, 5, 6, */ { 1, 2, 6, 1, 6, 8, 1, 8, 9, 8, 6, 7, -1, -1, -1, -1 }, - /* 117: 0, 2, 4, 5, 6, */ { 2, 6, 9, 2, 9, 1, 6, 7, 9, 0, 9, 3, 7, 3, 9, -1 }, - /* 118: 1, 2, 4, 5, 6, */ { 7, 8, 0, 7, 0, 6, 6, 0, 2, -1, -1, -1, -1, -1, -1, -1 }, - /* 119: 0, 1, 2, 4, 5, 6, */ { 7, 3, 2, 6, 7, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 120: 3, 4, 5, 6, */ { 2, 3, 11, 10, 6, 8, 10, 8, 9, 8, 6, 7, -1, -1, -1, -1 }, - /* 121: 0, 3, 4, 5, 6, */ { 2, 0, 7, 2, 7, 11, 0, 9, 7, 6, 7, 10, 9, 10, 7, -1 }, - /* 122: 1, 3, 4, 5, 6, */ { 1, 8, 0, 1, 7, 8, 1, 10, 7, 6, 7, 10, 2, 3, 11, -1 }, - /* 123: 0, 1, 3, 4, 5, 6, */ { 11, 2, 1, 11, 1, 7, 10, 6, 1, 6, 7, 1, -1, -1, -1, -1 }, - /* 124: 2, 3, 4, 5, 6, */ { 8, 9, 6, 8, 6, 7, 9, 1, 6, 11, 6, 3, 1, 3, 6, -1 }, - /* 125: 0, 2, 3, 4, 5, 6, */ { 0, 9, 1, 11, 6, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 126: 1, 2, 3, 4, 5, 6, */ { 7, 8, 0, 7, 0, 6, 3, 11, 0, 11, 6, 0, -1, -1, -1, -1 }, - /* 127: 0, 1, 2, 3, 4, 5, 6, */ { 7, 11, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 128: 7, */ { 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 129: 0, 7, */ { 3, 0, 8, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 130: 1, 7, */ { 0, 1, 9, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 131: 0, 1, 7, */ { 8, 1, 9, 8, 3, 1, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1 }, - /* 132: 2, 7, */ { 10, 1, 2, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 133: 0, 2, 7, */ { 1, 2, 10, 3, 0, 8, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1 }, - /* 134: 1, 2, 7, */ { 2, 9, 0, 2, 10, 9, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1 }, - /* 135: 0, 1, 2, 7, */ { 6, 11, 7, 2, 10, 3, 10, 8, 3, 10, 9, 8, -1, -1, -1, -1 }, - /* 136: 3, 7, */ { 7, 2, 3, 6, 2, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 137: 0, 3, 7, */ { 7, 0, 8, 7, 6, 0, 6, 2, 0, -1, -1, -1, -1, -1, -1, -1 }, - /* 138: 1, 3, 7, */ { 2, 7, 6, 2, 3, 7, 0, 1, 9, -1, -1, -1, -1, -1, -1, -1 }, - /* 139: 0, 1, 3, 7, */ { 1, 6, 2, 1, 8, 6, 1, 9, 8, 8, 7, 6, -1, -1, -1, -1 }, - /* 140: 2, 3, 7, */ { 10, 7, 6, 10, 1, 7, 1, 3, 7, -1, -1, -1, -1, -1, -1, -1 }, - /* 141: 0, 2, 3, 7, */ { 10, 7, 6, 1, 7, 10, 1, 8, 7, 1, 0, 8, -1, -1, -1, -1 }, - /* 142: 1, 2, 3, 7, */ { 0, 3, 7, 0, 7, 10, 0, 10, 9, 6, 10, 7, -1, -1, -1, -1 }, - /* 143: 0, 1, 2, 3, 7, */ { 7, 6, 10, 7, 10, 8, 8, 10, 9, -1, -1, -1, -1, -1, -1, -1 }, - /* 144: 4, 7, */ { 6, 8, 4, 11, 8, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 145: 0, 4, 7, */ { 3, 6, 11, 3, 0, 6, 0, 4, 6, -1, -1, -1, -1, -1, -1, -1 }, - /* 146: 1, 4, 7, */ { 8, 6, 11, 8, 4, 6, 9, 0, 1, -1, -1, -1, -1, -1, -1, -1 }, - /* 147: 0, 1, 4, 7, */ { 9, 4, 6, 9, 6, 3, 9, 3, 1, 11, 3, 6, -1, -1, -1, -1 }, - /* 148: 2, 4, 7, */ { 6, 8, 4, 6, 11, 8, 2, 10, 1, -1, -1, -1, -1, -1, -1, -1 }, - /* 149: 0, 2, 4, 7, */ { 1, 2, 10, 3, 0, 11, 0, 6, 11, 0, 4, 6, -1, -1, -1, -1 }, - /* 150: 1, 2, 4, 7, */ { 4, 11, 8, 4, 6, 11, 0, 2, 9, 2, 10, 9, -1, -1, -1, -1 }, - /* 151: 0, 1, 2, 4, 7, */ { 10, 9, 3, 10, 3, 2, 9, 4, 3, 11, 3, 6, 4, 6, 3, -1 }, - /* 152: 3, 4, 7, */ { 8, 2, 3, 8, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1 }, - /* 153: 0, 3, 4, 7, */ { 0, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 154: 1, 3, 4, 7, */ { 1, 9, 0, 2, 3, 4, 2, 4, 6, 4, 3, 8, -1, -1, -1, -1 }, - /* 155: 0, 1, 3, 4, 7, */ { 1, 9, 4, 1, 4, 2, 2, 4, 6, -1, -1, -1, -1, -1, -1, -1 }, - /* 156: 2, 3, 4, 7, */ { 8, 1, 3, 8, 6, 1, 8, 4, 6, 6, 10, 1, -1, -1, -1, -1 }, - /* 157: 0, 2, 3, 4, 7, */ { 10, 1, 0, 10, 0, 6, 6, 0, 4, -1, -1, -1, -1, -1, -1, -1 }, - /* 158: 1, 2, 3, 4, 7, */ { 4, 6, 3, 4, 3, 8, 6, 10, 3, 0, 3, 9, 10, 9, 3, -1 }, - /* 159: 0, 1, 2, 3, 4, 7, */ { 10, 9, 4, 6, 10, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 160: 5, 7, */ { 4, 9, 5, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 161: 0, 5, 7, */ { 0, 8, 3, 4, 9, 5, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1 }, - /* 162: 1, 5, 7, */ { 5, 0, 1, 5, 4, 0, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1 }, - /* 163: 0, 1, 5, 7, */ { 11, 7, 6, 8, 3, 4, 3, 5, 4, 3, 1, 5, -1, -1, -1, -1 }, - /* 164: 2, 5, 7, */ { 9, 5, 4, 10, 1, 2, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1 }, - /* 165: 0, 2, 5, 7, */ { 6, 11, 7, 1, 2, 10, 0, 8, 3, 4, 9, 5, -1, -1, -1, -1 }, - /* 166: 1, 2, 5, 7, */ { 7, 6, 11, 5, 4, 10, 4, 2, 10, 4, 0, 2, -1, -1, -1, -1 }, - /* 167: 0, 1, 2, 5, 7, */ { 3, 4, 8, 3, 5, 4, 3, 2, 5, 10, 5, 2, 11, 7, 6, -1 }, - /* 168: 3, 5, 7, */ { 7, 2, 3, 7, 6, 2, 5, 4, 9, -1, -1, -1, -1, -1, -1, -1 }, - /* 169: 0, 3, 5, 7, */ { 9, 5, 4, 0, 8, 6, 0, 6, 2, 6, 8, 7, -1, -1, -1, -1 }, - /* 170: 1, 3, 5, 7, */ { 3, 6, 2, 3, 7, 6, 1, 5, 0, 5, 4, 0, -1, -1, -1, -1 }, - /* 171: 0, 1, 3, 5, 7, */ { 6, 2, 8, 6, 8, 7, 2, 1, 8, 4, 8, 5, 1, 5, 8, -1 }, - /* 172: 2, 3, 5, 7, */ { 9, 5, 4, 10, 1, 6, 1, 7, 6, 1, 3, 7, -1, -1, -1, -1 }, - /* 173: 0, 2, 3, 5, 7, */ { 1, 6, 10, 1, 7, 6, 1, 0, 7, 8, 7, 0, 9, 5, 4, -1 }, - /* 174: 1, 2, 3, 5, 7, */ { 4, 0, 10, 4, 10, 5, 0, 3, 10, 6, 10, 7, 3, 7, 10, -1 }, - /* 175: 0, 1, 2, 3, 5, 7, */ { 7, 6, 10, 7, 10, 8, 5, 4, 10, 4, 8, 10, -1, -1, -1, -1 }, - /* 176: 4, 5, 7, */ { 6, 9, 5, 6, 11, 9, 11, 8, 9, -1, -1, -1, -1, -1, -1, -1 }, - /* 177: 0, 4, 5, 7, */ { 3, 6, 11, 0, 6, 3, 0, 5, 6, 0, 9, 5, -1, -1, -1, -1 }, - /* 178: 1, 4, 5, 7, */ { 0, 11, 8, 0, 5, 11, 0, 1, 5, 5, 6, 11, -1, -1, -1, -1 }, - /* 179: 0, 1, 4, 5, 7, */ { 6, 11, 3, 6, 3, 5, 5, 3, 1, -1, -1, -1, -1, -1, -1, -1 }, - /* 180: 2, 4, 5, 7, */ { 1, 2, 10, 9, 5, 11, 9, 11, 8, 11, 5, 6, -1, -1, -1, -1 }, - /* 181: 0, 2, 4, 5, 7, */ { 0, 11, 3, 0, 6, 11, 0, 9, 6, 5, 6, 9, 1, 2, 10, -1 }, - /* 182: 1, 2, 4, 5, 7, */ { 11, 8, 5, 11, 5, 6, 8, 0, 5, 10, 5, 2, 0, 2, 5, -1 }, - /* 183: 0, 1, 2, 4, 5, 7, */ { 6, 11, 3, 6, 3, 5, 2, 10, 3, 10, 5, 3, -1, -1, -1, -1 }, - /* 184: 3, 4, 5, 7, */ { 5, 8, 9, 5, 2, 8, 5, 6, 2, 3, 8, 2, -1, -1, -1, -1 }, - /* 185: 0, 3, 4, 5, 7, */ { 9, 5, 6, 9, 6, 0, 0, 6, 2, -1, -1, -1, -1, -1, -1, -1 }, - /* 186: 1, 3, 4, 5, 7, */ { 1, 5, 8, 1, 8, 0, 5, 6, 8, 3, 8, 2, 6, 2, 8, -1 }, - /* 187: 0, 1, 3, 4, 5, 7, */ { 1, 5, 6, 2, 1, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 188: 2, 3, 4, 5, 7, */ { 1, 3, 6, 1, 6, 10, 3, 8, 6, 5, 6, 9, 8, 9, 6, -1 }, - /* 189: 0, 2, 3, 4, 5, 7, */ { 10, 1, 0, 10, 0, 6, 9, 5, 0, 5, 6, 0, -1, -1, -1, -1 }, - /* 190: 1, 2, 3, 4, 5, 7, */ { 0, 3, 8, 5, 6, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 191: 0, 1, 2, 3, 4, 5, 7, */ { 10, 5, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 192: 6, 7, */ { 11, 5, 10, 7, 5, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 193: 0, 6, 7, */ { 11, 5, 10, 11, 7, 5, 8, 3, 0, -1, -1, -1, -1, -1, -1, -1 }, - /* 194: 1, 6, 7, */ { 5, 11, 7, 5, 10, 11, 1, 9, 0, -1, -1, -1, -1, -1, -1, -1 }, - /* 195: 0, 1, 6, 7, */ { 10, 7, 5, 10, 11, 7, 9, 8, 1, 8, 3, 1, -1, -1, -1, -1 }, - /* 196: 2, 6, 7, */ { 11, 1, 2, 11, 7, 1, 7, 5, 1, -1, -1, -1, -1, -1, -1, -1 }, - /* 197: 0, 2, 6, 7, */ { 0, 8, 3, 1, 2, 7, 1, 7, 5, 7, 2, 11, -1, -1, -1, -1 }, - /* 198: 1, 2, 6, 7, */ { 9, 7, 5, 9, 2, 7, 9, 0, 2, 2, 11, 7, -1, -1, -1, -1 }, - /* 199: 0, 1, 2, 6, 7, */ { 7, 5, 2, 7, 2, 11, 5, 9, 2, 3, 2, 8, 9, 8, 2, -1 }, - /* 200: 3, 6, 7, */ { 2, 5, 10, 2, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1 }, - /* 201: 0, 3, 6, 7, */ { 8, 2, 0, 8, 5, 2, 8, 7, 5, 10, 2, 5, -1, -1, -1, -1 }, - /* 202: 1, 3, 6, 7, */ { 9, 0, 1, 5, 10, 3, 5, 3, 7, 3, 10, 2, -1, -1, -1, -1 }, - /* 203: 0, 1, 3, 6, 7, */ { 9, 8, 2, 9, 2, 1, 8, 7, 2, 10, 2, 5, 7, 5, 2, -1 }, - /* 204: 2, 3, 6, 7, */ { 1, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 205: 0, 2, 3, 6, 7, */ { 0, 8, 7, 0, 7, 1, 1, 7, 5, -1, -1, -1, -1, -1, -1, -1 }, - /* 206: 1, 2, 3, 6, 7, */ { 9, 0, 3, 9, 3, 5, 5, 3, 7, -1, -1, -1, -1, -1, -1, -1 }, - /* 207: 0, 1, 2, 3, 6, 7, */ { 9, 8, 7, 5, 9, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 208: 4, 6, 7, */ { 5, 8, 4, 5, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1 }, - /* 209: 0, 4, 6, 7, */ { 5, 0, 4, 5, 11, 0, 5, 10, 11, 11, 3, 0, -1, -1, -1, -1 }, - /* 210: 1, 4, 6, 7, */ { 0, 1, 9, 8, 4, 10, 8, 10, 11, 10, 4, 5, -1, -1, -1, -1 }, - /* 211: 0, 1, 4, 6, 7, */ { 10, 11, 4, 10, 4, 5, 11, 3, 4, 9, 4, 1, 3, 1, 4, -1 }, - /* 212: 2, 4, 6, 7, */ { 2, 5, 1, 2, 8, 5, 2, 11, 8, 4, 5, 8, -1, -1, -1, -1 }, - /* 213: 0, 2, 4, 6, 7, */ { 0, 4, 11, 0, 11, 3, 4, 5, 11, 2, 11, 1, 5, 1, 11, -1 }, - /* 214: 1, 2, 4, 6, 7, */ { 0, 2, 5, 0, 5, 9, 2, 11, 5, 4, 5, 8, 11, 8, 5, -1 }, - /* 215: 0, 1, 2, 4, 6, 7, */ { 9, 4, 5, 2, 11, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 216: 3, 4, 6, 7, */ { 2, 5, 10, 3, 5, 2, 3, 4, 5, 3, 8, 4, -1, -1, -1, -1 }, - /* 217: 0, 3, 4, 6, 7, */ { 5, 10, 2, 5, 2, 4, 4, 2, 0, -1, -1, -1, -1, -1, -1, -1 }, - /* 218: 1, 3, 4, 6, 7, */ { 3, 10, 2, 3, 5, 10, 3, 8, 5, 4, 5, 8, 0, 1, 9, -1 }, - /* 219: 0, 1, 3, 4, 6, 7, */ { 5, 10, 2, 5, 2, 4, 1, 9, 2, 9, 4, 2, -1, -1, -1, -1 }, - /* 220: 2, 3, 4, 6, 7, */ { 8, 4, 5, 8, 5, 3, 3, 5, 1, -1, -1, -1, -1, -1, -1, -1 }, - /* 221: 0, 2, 3, 4, 6, 7, */ { 0, 4, 5, 1, 0, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 222: 1, 2, 3, 4, 6, 7, */ { 8, 4, 5, 8, 5, 3, 9, 0, 5, 0, 3, 5, -1, -1, -1, -1 }, - /* 223: 0, 1, 2, 3, 4, 6, 7, */ { 9, 4, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 224: 5, 6, 7, */ { 4, 11, 7, 4, 9, 11, 9, 10, 11, -1, -1, -1, -1, -1, -1, -1 }, - /* 225: 0, 5, 6, 7, */ { 0, 8, 3, 4, 9, 7, 9, 11, 7, 9, 10, 11, -1, -1, -1, -1 }, - /* 226: 1, 5, 6, 7, */ { 1, 10, 11, 1, 11, 4, 1, 4, 0, 7, 4, 11, -1, -1, -1, -1 }, - /* 227: 0, 1, 5, 6, 7, */ { 3, 1, 4, 3, 4, 8, 1, 10, 4, 7, 4, 11, 10, 11, 4, -1 }, - /* 228: 2, 5, 6, 7, */ { 4, 11, 7, 9, 11, 4, 9, 2, 11, 9, 1, 2, -1, -1, -1, -1 }, - /* 229: 0, 2, 5, 6, 7, */ { 9, 7, 4, 9, 11, 7, 9, 1, 11, 2, 11, 1, 0, 8, 3, -1 }, - /* 230: 1, 2, 5, 6, 7, */ { 11, 7, 4, 11, 4, 2, 2, 4, 0, -1, -1, -1, -1, -1, -1, -1 }, - /* 231: 0, 1, 2, 5, 6, 7, */ { 11, 7, 4, 11, 4, 2, 8, 3, 4, 3, 2, 4, -1, -1, -1, -1 }, - /* 232: 3, 5, 6, 7, */ { 2, 9, 10, 2, 7, 9, 2, 3, 7, 7, 4, 9, -1, -1, -1, -1 }, - /* 233: 0, 3, 5, 6, 7, */ { 9, 10, 7, 9, 7, 4, 10, 2, 7, 8, 7, 0, 2, 0, 7, -1 }, - /* 234: 1, 3, 5, 6, 7, */ { 3, 7, 10, 3, 10, 2, 7, 4, 10, 1, 10, 0, 4, 0, 10, -1 }, - /* 235: 0, 1, 3, 5, 6, 7, */ { 1, 10, 2, 8, 7, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 236: 2, 3, 5, 6, 7, */ { 4, 9, 1, 4, 1, 7, 7, 1, 3, -1, -1, -1, -1, -1, -1, -1 }, - /* 237: 0, 2, 3, 5, 6, 7, */ { 4, 9, 1, 4, 1, 7, 0, 8, 1, 8, 7, 1, -1, -1, -1, -1 }, - /* 238: 1, 2, 3, 5, 6, 7, */ { 4, 0, 3, 7, 4, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 239: 0, 1, 2, 3, 5, 6, 7, */ { 4, 8, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 240: 4, 5, 6, 7, */ { 9, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 241: 0, 4, 5, 6, 7, */ { 3, 0, 9, 3, 9, 11, 11, 9, 10, -1, -1, -1, -1, -1, -1, -1 }, - /* 242: 1, 4, 5, 6, 7, */ { 0, 1, 10, 0, 10, 8, 8, 10, 11, -1, -1, -1, -1, -1, -1, -1 }, - /* 243: 0, 1, 4, 5, 6, 7, */ { 3, 1, 10, 11, 3, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 244: 2, 4, 5, 6, 7, */ { 1, 2, 11, 1, 11, 9, 9, 11, 8, -1, -1, -1, -1, -1, -1, -1 }, - /* 245: 0, 2, 4, 5, 6, 7, */ { 3, 0, 9, 3, 9, 11, 1, 2, 9, 2, 11, 9, -1, -1, -1, -1 }, - /* 246: 1, 2, 4, 5, 6, 7, */ { 0, 2, 11, 8, 0, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 247: 0, 1, 2, 4, 5, 6, 7, */ { 3, 2, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 248: 3, 4, 5, 6, 7, */ { 2, 3, 8, 2, 8, 10, 10, 8, 9, -1, -1, -1, -1, -1, -1, -1 }, - /* 249: 0, 3, 4, 5, 6, 7, */ { 9, 10, 2, 0, 9, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 250: 1, 3, 4, 5, 6, 7, */ { 2, 3, 8, 2, 8, 10, 0, 1, 8, 1, 10, 8, -1, -1, -1, -1 }, - /* 251: 0, 1, 3, 4, 5, 6, 7, */ { 1, 10, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 252: 2, 3, 4, 5, 6, 7, */ { 1, 3, 8, 9, 1, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 253: 0, 2, 3, 4, 5, 6, 7, */ { 0, 9, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 254: 1, 2, 3, 4, 5, 6, 7, */ { 0, 3, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, - /* 255: 0, 1, 2, 3, 4, 5, 6, 7, */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } - }; - return casesClassic[u][w]; - }; // end of CasesClassic - //_____________________________________________________________________________ - - }; // end of class EMCLookUpTable - }; // end of namespace tri -}; //end of namespace vcg - - - -#endif // __VCG_MC_LOOK_UP_TABLE diff --git a/vcg/complex/trimesh/create/mc_trivial_walker.h b/vcg/complex/trimesh/create/mc_trivial_walker.h deleted file mode 100644 index d721f6d5..00000000 --- a/vcg/complex/trimesh/create/mc_trivial_walker.h +++ /dev/null @@ -1,346 +0,0 @@ -/**************************************************************************** -* VCGLib o o * -* Visual and Computer Graphics Library o o * -* _ O _ * -* Copyright(C) 2004-2009 \/)\/ * -* Visual Computing Lab /\/| * -* ISTI - Italian National Research Council | * -* \ * -* All rights reserved. * -* * -* This program is free software; you can redistribute it and/or modify * -* it under the terms of the GNU General Public License as published by * -* the Free Software Foundation; either version 2 of the License, or * -* (at your option) any later version. * -* * -* This program is distributed in the hope that it will be useful, * -* but WITHOUT ANY WARRANTY; without even the implied warranty of * -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * -* for more details. * -* * -****************************************************************************/ -#ifndef __VCG_TRIVIAL_WALKER -#define __VCG_TRIVIAL_WALKER -#include - -namespace vcg { - -// Very simple volume class. -// just an example of the interface that the trivial walker expects - -template -class SimpleVolume -{ -public: - typedef VOX_TYPE VoxelType; - std::vector Vol; - - Point3i sz; /// Dimensioni griglia come numero di celle per lato - - const Point3i &ISize() {return sz;}; /// Dimensioni griglia come numero di celle per lato - - void Init(Point3i _sz) - { - sz=_sz; - Vol.resize(sz[0]*sz[1]*sz[2]); - } - - float Val(const int &x,const int &y,const int &z) const { - return cV(x,y,z).V(); - //else return numeric_limits::quiet_NaN( ); - } - - float &Val(const int &x,const int &y,const int &z) { - return V(x,y,z).V(); - //else return numeric_limits::quiet_NaN( ); - } - - VOX_TYPE &V(const int &x,const int &y,const int &z) { - return Vol[x+y*sz[0]+z*sz[0]*sz[1]]; - } - - const VOX_TYPE &cV(const int &x,const int &y,const int &z) const { - return Vol[x+y*sz[0]+z*sz[0]*sz[1]]; - } - - -typedef enum { XAxis=0,YAxis=1,ZAxis=2} VolumeAxis; - -template < class VertexPointerType, VolumeAxis AxisVal > - void GetIntercept(const vcg::Point3i &p1, const vcg::Point3i &p2, VertexPointerType &v, const float thr) -{ - float f1 = Val(p1.X(), p1.Y(), p1.Z())-thr; - float f2 = Val(p2.X(), p2.Y(), p2.Z())-thr; - float u = (float) f1/(f1-f2); - if(AxisVal==XAxis) v->P().X() = (float) p1.X()*(1-u) + u*p2.X(); - else v->P().X() = (float) p1.X(); - if(AxisVal==YAxis) v->P().Y() = (float) p1.Y()*(1-u) + u*p2.Y(); - else v->P().Y() = (float) p1.Y(); - if(AxisVal==ZAxis) v->P().Z() = (float) p1.Z()*(1-u) + u*p2.Z(); - else v->P().Z() = (float) p1.Z(); -} - -template < class VertexPointerType > - void GetXIntercept(const vcg::Point3i &p1, const vcg::Point3i &p2, VertexPointerType &v, const float thr) -{ GetIntercept(p1,p2,v,thr); } - -template < class VertexPointerType > - void GetYIntercept(const vcg::Point3i &p1, const vcg::Point3i &p2, VertexPointerType &v, const float thr) -{ GetIntercept(p1,p2,v,thr); } - -template < class VertexPointerType > - void GetZIntercept(const vcg::Point3i &p1, const vcg::Point3i &p2, VertexPointerType &v, const float thr) -{ GetIntercept(p1,p2,v,thr); } -}; -template -class RawVolumeImporter -{ -public: - enum DataType -{ - // Funzioni superiori - UNDEF=0, - BYTE=1, - SHORT=2, - FLOAT=3 -}; - -static bool Open(const char *filename, VolumeType &V, Point3i sz, DataType d) -{ -return true; -} -}; - -class SimpleVoxel -{ -private: - float _v; -public: - float &V() {return _v;}; - float V() const {return _v;}; -}; - - -namespace tri { - - -// La classe Walker implementa la politica di visita del volume; conoscendo l'ordine di visita del volume -// Ë conveniente che il Walker stesso si faccia carico del caching dei dati utilizzati durante l'esecuzione -// degli algoritmi MarchingCubes ed ExtendedMarchingCubes, in particolare il calcolo del volume ai vertici -// delle celle e delle intersezioni della superficie con le celle. In questo esempio il volume da processare -// viene suddiviso in fette; in questo modo se il volume ha dimensione h*l*w (rispettivamente altezza, -// larghezza e profondit‡), lo spazio richiesto per il caching dei vertici gi‡ allocati passa da O(h*l*w) -// a O(h*l). - -template -class TrivialWalker -{ -private: - typedef int VertexIndex; - typedef typename MeshType::ScalarType ScalarType; - typedef typename MeshType::VertexPointer VertexPointer; - public: - - // bbox is the portion of the volume to be computed - // resolution determine the sampling step: - // should be a divisor of bbox size (e.g. if bbox size is 256^3 resolution could be 128,64, etc) - - - void Init(VolumeType &volume) - { - _bbox = Box3i(Point3i(0,0,0),volume.ISize()); - _slice_dimension = _bbox.DimX()*_bbox.DimZ(); - - _x_cs = new VertexIndex[ _slice_dimension ]; - _y_cs = new VertexIndex[ _slice_dimension ]; - _z_cs = new VertexIndex[ _slice_dimension ]; - _x_ns = new VertexIndex[ _slice_dimension ]; - _z_ns = new VertexIndex[ _slice_dimension ]; - - }; - - ~TrivialWalker() - {_thr=0;} - - template - void BuildMesh(MeshType &mesh, VolumeType &volume, EXTRACTOR_TYPE &extractor, const float threshold, vcg::CallBackPos * cb=0) - { - Init(volume); - _volume = &volume; - _mesh = &mesh; - _mesh->Clear(); - _thr=threshold; - vcg::Point3i p1, p2; - - Begin(); - extractor.Initialize(); - for (int j=_bbox.min.Y(); j<(_bbox.max.Y()-1)-1; j+=1) - { - - if(cb && ((j%10)==0) ) cb(j*_bbox.DimY()/100.0,"Marching volume"); - - for (int i=_bbox.min.X(); i<(_bbox.max.X()-1)-1; i+=1) - { - for (int k=_bbox.min.Z(); k<(_bbox.max.Z()-1)-1; k+=1) - { - p1.X()=i; p1.Y()=j; p1.Z()=k; - p2.X()=i+1; p2.Y()=j+1; p2.Z()=k+1; - extractor.ProcessCell(p1, p2); - } - } - NextSlice(); - } - extractor.Finalize(); - _volume = NULL; - _mesh = NULL; - }; - - float V(int pi, int pj, int pk) - { - return _volume->Val(pi, pj, pk)-_thr; - } - - bool Exist(const vcg::Point3i &p0, const vcg::Point3i &p1, VertexPointer &v) - { - int pos = p0.X()+p0.Z()*_bbox.max.X(); - int vidx; - - if (p0.X()!=p1.X()) // punti allineati lungo l'asse X - vidx = (p0.Y()==_current_slice) ? _x_cs[pos] : _x_ns[pos]; - else if (p0.Y()!=p1.Y()) // punti allineati lungo l'asse Y - vidx = _y_cs[pos]; - else if (p0.Z()!=p1.Z()) // punti allineati lungo l'asse Z - vidx = (p0.Y()==_current_slice)? _z_cs[pos] : _z_ns[pos]; - else - assert(false); - - v = (vidx!=-1)? &_mesh->vert[vidx] : NULL; - return v!=NULL; - } - - void GetXIntercept(const vcg::Point3i &p1, const vcg::Point3i &p2, VertexPointer &v) - { - int i = p1.X() - _bbox.min.X(); - int z = p1.Z() - _bbox.min.Z(); - VertexIndex index = i+z*_bbox.max.X(); - VertexIndex pos; - if (p1.Y()==_current_slice) - { - if ((pos=_x_cs[index])==-1) - { - _x_cs[index] = (VertexIndex) _mesh->vert.size(); - pos = _x_cs[index]; - Allocator::AddVertices( *_mesh, 1 ); - v = &_mesh->vert[pos]; - _volume->GetXIntercept(p1, p2, v, _thr); - return; - } - } - if (p1.Y()==_current_slice+1) - { - if ((pos=_x_ns[index])==-1) - { - _x_ns[index] = (VertexIndex) _mesh->vert.size(); - pos = _x_ns[index]; - Allocator::AddVertices( *_mesh, 1 ); - v = &_mesh->vert[pos]; - _volume->GetXIntercept(p1, p2, v,_thr); - return; - } - } - assert(pos >=0 && size_t(pos)< _mesh->vert.size()); - v = &_mesh->vert[pos]; - } - void GetYIntercept(const vcg::Point3i &p1, const vcg::Point3i &p2, VertexPointer &v) - { - int i = p1.X() - _bbox.min.X(); - int z = p1.Z() - _bbox.min.Z(); - VertexIndex index = i+z*_bbox.max.X(); - VertexIndex pos; - if ((pos=_y_cs[index])==-1) - { - _y_cs[index] = (VertexIndex) _mesh->vert.size(); - pos = _y_cs[index]; - Allocator::AddVertices( *_mesh, 1); - v = &_mesh->vert[ pos ]; - _volume->GetYIntercept(p1, p2, v,_thr); - } - v = &_mesh->vert[pos]; - } - void GetZIntercept(const vcg::Point3i &p1, const vcg::Point3i &p2, VertexPointer &v) - { - int i = p1.X() - _bbox.min.X(); - int z = p1.Z() - _bbox.min.Z(); - VertexIndex index = i+z*_bbox.max.X(); - VertexIndex pos; - if (p1.Y()==_current_slice) - { - if ((pos=_z_cs[index])==-1) - { - _z_cs[index] = (VertexIndex) _mesh->vert.size(); - pos = _z_cs[index]; - Allocator::AddVertices( *_mesh, 1 ); - v = &_mesh->vert[pos]; - _volume->GetZIntercept(p1, p2, v,_thr); - return; - } - } - if (p1.Y()==_current_slice+1) - { - if ((pos=_z_ns[index])==-1) - { - _z_ns[index] = (VertexIndex) _mesh->vert.size(); - pos = _z_ns[index]; - Allocator::AddVertices( *_mesh, 1 ); - v = &_mesh->vert[pos]; - _volume->GetZIntercept(p1, p2, v,_thr); - return; - } - } - v = &_mesh->vert[pos]; - } - -protected: - Box3i _bbox; - - int _slice_dimension; - int _current_slice; - - VertexIndex *_x_cs; // indici dell'intersezioni della superficie lungo gli Xedge della fetta corrente - VertexIndex *_y_cs; // indici dell'intersezioni della superficie lungo gli Yedge della fetta corrente - VertexIndex *_z_cs; // indici dell'intersezioni della superficie lungo gli Zedge della fetta corrente - VertexIndex *_x_ns; // indici dell'intersezioni della superficie lungo gli Xedge della prossima fetta - VertexIndex *_z_ns; // indici dell'intersezioni della superficie lungo gli Zedge della prossima fetta - - MeshType *_mesh; - VolumeType *_volume; - - float _thr; - void NextSlice() - { - memset(_x_cs, -1, _slice_dimension*sizeof(VertexIndex)); - memset(_y_cs, -1, _slice_dimension*sizeof(VertexIndex)); - memset(_z_cs, -1, _slice_dimension*sizeof(VertexIndex)); - - std::swap(_x_cs, _x_ns); - std::swap(_z_cs, _z_ns); - - _current_slice += 1; - } - - void Begin() - { - _current_slice = _bbox.min.Y(); - - memset(_x_cs, -1, _slice_dimension*sizeof(VertexIndex)); - memset(_y_cs, -1, _slice_dimension*sizeof(VertexIndex)); - memset(_z_cs, -1, _slice_dimension*sizeof(VertexIndex)); - memset(_x_ns, -1, _slice_dimension*sizeof(VertexIndex)); - memset(_z_ns, -1, _slice_dimension*sizeof(VertexIndex)); - - } -}; -} // end namespace -} // end namespace -#endif // __VCGTEST_WALKER diff --git a/vcg/complex/trimesh/create/platonic.h b/vcg/complex/trimesh/create/platonic.h deleted file mode 100644 index 3030dc5e..00000000 --- a/vcg/complex/trimesh/create/platonic.h +++ /dev/null @@ -1,829 +0,0 @@ -/**************************************************************************** -* VCGLib o o * -* Visual and Computer Graphics Library o o * -* _ O _ * -* Copyright(C) 2004 \/)\/ * -* Visual Computing Lab /\/| * -* ISTI - Italian National Research Council | * -* \ * -* All rights reserved. * -* * -* This program is free software; you can redistribute it and/or modify * -* it under the terms of the GNU General Public License as published by * -* the Free Software Foundation; either version 2 of the License, or * -* (at your option) any later version. * -* * -* This program is distributed in the hope that it will be useful, * -* but WITHOUT ANY WARRANTY; without even the implied warranty of * -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * -* for more details. * -* * -****************************************************************************/ - -#ifndef __VCGLIB_PLATONIC -#define __VCGLIB_PLATONIC - -#include -#include -#include -#include - -namespace vcg { -namespace tri { -/** \addtogroup trimesh */ -//@{ - /** - A set of functions that builds meshes - that represent surfaces of platonic solids, - and other simple shapes. - - The 1st parameter is the mesh that will - be filled with the solid. - */ -template -void Tetrahedron(TetraMeshType &in) -{ - typedef TetraMeshType MeshType; - typedef typename TetraMeshType::CoordType CoordType; - typedef typename TetraMeshType::VertexPointer VertexPointer; - typedef typename TetraMeshType::VertexIterator VertexIterator; - typedef typename TetraMeshType::FaceIterator FaceIterator; - - in.Clear(); - Allocator::AddVertices(in,4); - Allocator::AddFaces(in,4); - - VertexPointer ivp[4]; - VertexIterator vi=in.vert.begin(); - ivp[0]=&*vi;(*vi).P()=CoordType ( 1.0, 1.0, 1.0); ++vi; - ivp[1]=&*vi;(*vi).P()=CoordType (-1.0, 1.0,-1.0); ++vi; - ivp[2]=&*vi;(*vi).P()=CoordType (-1.0,-1.0, 1.0); ++vi; - ivp[3]=&*vi;(*vi).P()=CoordType ( 1.0,-1.0,-1.0); - - FaceIterator fi=in.face.begin(); - (*fi).V(0)=ivp[0]; (*fi).V(1)=ivp[1]; (*fi).V(2)=ivp[2]; ++fi; - (*fi).V(0)=ivp[0]; (*fi).V(1)=ivp[2]; (*fi).V(2)=ivp[3]; ++fi; - (*fi).V(0)=ivp[0]; (*fi).V(1)=ivp[3]; (*fi).V(2)=ivp[1]; ++fi; - (*fi).V(0)=ivp[3]; (*fi).V(1)=ivp[2]; (*fi).V(2)=ivp[1]; -} - - -/// builds a Dodecahedron, -/// (each pentagon is composed of 5 triangles) -template -void Dodecahedron(DodMeshType & in) -{ - typedef DodMeshType MeshType; - typedef typename MeshType::CoordType CoordType; - typedef typename MeshType::VertexPointer VertexPointer; - typedef typename MeshType::VertexIterator VertexIterator; - typedef typename MeshType::FaceIterator FaceIterator; - typedef typename MeshType::ScalarType ScalarType; - const int N_penta=12; - const int N_points=62; - - int penta[N_penta*3*3]= - {20,11, 18, 18, 11, 8, 8, 11, 4, - 13,23, 4, 4, 23, 8, 8, 23, 16, - 13, 4, 30, 30, 4, 28, 28, 4, 11, - 16,34, 8, 8, 34, 18, 18, 34, 36, - 11,20, 28, 28, 20, 45, 45, 20, 38, - 13,30, 23, 23, 30, 41, 41, 30, 47, - 16,23, 34, 34, 23, 50, 50, 23, 41, - 20,18, 38, 38, 18, 52, 52, 18, 36, - 30,28, 47, 47, 28, 56, 56, 28, 45, - 50,60, 34, 34, 60, 36, 36, 60, 52, - 45,38, 56, 56, 38, 60, 60, 38, 52, - 50,41, 60, 60, 41, 56, 56, 41, 47 }; - //A B E D C - const ScalarType p=(1.0 + math::Sqrt(5.0)) / 2.0; - const ScalarType p2=p*p; - const ScalarType p3=p*p*p; - ScalarType vv[N_points*3]= - { - 0, 0, 2*p2, p2, 0, p3, p, p2, p3, - 0, p, p3, -p, p2, p3, -p2, 0, p3, - -p, -p2, p3, 0, -p, p3, p, -p2, p3, - p3, p, p2, p2, p2, p2, 0, p3, p2, - -p2, p2, p2, -p3, p, p2, -p3, -p, p2, - -p2, -p2, p2, 0, -p3, p2, p2, -p2, p2, - p3, -p, p2, p3, 0, p, p2, p3, p, - -p2, p3, p, -p3, 0, p, -p2, -p3, p, - p2, -p3, p, 2*p2, 0, 0, p3, p2, 0, - p, p3, 0, 0, 2*p2, 0, -p, p3, 0, - -p3, p2, 0, -2*p2, 0, 0, -p3, -p2, 0, - -p, -p3, 0, 0, -2*p2, 0, p, -p3, 0, - p3, -p2, 0, p3, 0, -p, p2, p3, -p, - -p2, p3, -p, -p3, 0, -p, -p2, -p3, -p, - p2, -p3, -p, p3, p, -p2, p2, p2, -p2, - 0, p3, -p2, -p2, p2, -p2, -p3, p, -p2, - -p3, -p, -p2, -p2, -p2, -p2, 0, -p3, -p2, - p2, -p2, -p2, p3, -p, -p2, p2, 0, -p3, - p, p2, -p3, 0, p, -p3, -p, p2, -p3, - -p2, 0, -p3, -p, -p2, -p3, 0, -p, -p3, - p, -p2, -p3, 0, 0, -2*p2 - }; - in.Clear(); - //in.face.clear(); - Allocator::AddVertices(in,20+12); - Allocator::AddFaces(in, 5*12); // five pentagons, each made by 5 tri - - int h,i,j,m=0; - - bool used[N_points]; - for (i=0; i index(in.vn); - - for(j=0,vi=in.vert.begin();j -void Octahedron(OctMeshType &in) -{ - typedef OctMeshType MeshType; - typedef typename MeshType::CoordType CoordType; - typedef typename MeshType::VertexPointer VertexPointer; - typedef typename MeshType::VertexIterator VertexIterator; - typedef typename MeshType::FaceIterator FaceIterator; - - in.Clear(); - Allocator::AddVertices(in,6); - Allocator::AddFaces(in,8); - - VertexPointer ivp[6]; - - VertexIterator vi=in.vert.begin(); - ivp[0]=&*vi;(*vi).P()=CoordType ( 1, 0, 0); ++vi; - ivp[1]=&*vi;(*vi).P()=CoordType ( 0, 1, 0); ++vi; - ivp[2]=&*vi;(*vi).P()=CoordType ( 0, 0, 1); ++vi; - ivp[3]=&*vi;(*vi).P()=CoordType (-1, 0, 0); ++vi; - ivp[4]=&*vi;(*vi).P()=CoordType ( 0,-1, 0); ++vi; - ivp[5]=&*vi;(*vi).P()=CoordType ( 0, 0,-1); - - FaceIterator fi=in.face.begin(); - (*fi).V(0)=ivp[0]; (*fi).V(1)=ivp[1]; (*fi).V(2)=ivp[2]; ++fi; - (*fi).V(0)=ivp[0]; (*fi).V(1)=ivp[2]; (*fi).V(2)=ivp[4]; ++fi; - (*fi).V(0)=ivp[0]; (*fi).V(1)=ivp[4]; (*fi).V(2)=ivp[5]; ++fi; - (*fi).V(0)=ivp[0]; (*fi).V(1)=ivp[5]; (*fi).V(2)=ivp[1]; ++fi; - (*fi).V(0)=ivp[3]; (*fi).V(1)=ivp[1]; (*fi).V(2)=ivp[5]; ++fi; - (*fi).V(0)=ivp[3]; (*fi).V(1)=ivp[5]; (*fi).V(2)=ivp[4]; ++fi; - (*fi).V(0)=ivp[3]; (*fi).V(1)=ivp[4]; (*fi).V(2)=ivp[2]; ++fi; - (*fi).V(0)=ivp[3]; (*fi).V(1)=ivp[2]; (*fi).V(2)=ivp[1]; -} - -template -void Icosahedron(IcoMeshType &in) -{ - typedef IcoMeshType MeshType; - typedef typename MeshType::ScalarType ScalarType; - typedef typename MeshType::CoordType CoordType; - typedef typename MeshType::VertexPointer VertexPointer; - typedef typename MeshType::VertexIterator VertexIterator; - typedef typename MeshType::FaceIterator FaceIterator; - - ScalarType L=ScalarType((math::Sqrt(5.0)+1.0)/2.0); - CoordType vv[12]={ - CoordType ( 0, L, 1), - CoordType ( 0, L,-1), - CoordType ( 0,-L, 1), - CoordType ( 0,-L,-1), - - CoordType ( L, 1, 0), - CoordType ( L,-1, 0), - CoordType (-L, 1, 0), - CoordType (-L,-1, 0), - - CoordType ( 1, 0, L), - CoordType (-1, 0, L), - CoordType ( 1, 0,-L), - CoordType (-1, 0,-L) - }; - - int ff[20][3]={ - {1,0,4},{0,1,6},{2,3,5},{3,2,7}, - {4,5,10},{5,4,8},{6,7,9},{7,6,11}, - {8,9,2},{9,8,0},{10,11,1},{11,10,3}, - {0,8,4},{0,6,9},{1,4,10},{1,11,6}, - {2,5,8},{2,9,7},{3,10,5},{3,7,11} - }; - - - in.Clear(); - Allocator::AddVertices(in,12); - Allocator::AddFaces(in,20); - VertexPointer ivp[12]; - - VertexIterator vi; - int i; - for(i=0,vi=in.vert.begin();vi!=in.vert.end();++i,++vi){ - (*vi).P()=vv[i]; - ivp[i]=&*vi; - } - - FaceIterator fi; - for(i=0,fi=in.face.begin();fi!=in.face.end();++i,++fi){ - (*fi).V(0)=ivp[ff[i][0]]; - (*fi).V(1)=ivp[ff[i][1]]; - (*fi).V(2)=ivp[ff[i][2]]; - } -} - -template -void Hexahedron(MeshType &in) -{ - typedef typename MeshType::ScalarType ScalarType; - typedef typename MeshType::CoordType CoordType; - typedef typename MeshType::VertexPointer VertexPointer; - typedef typename MeshType::VertexIterator VertexIterator; - typedef typename MeshType::FaceIterator FaceIterator; - - in.Clear(); - Allocator::AddVertices(in,8); - Allocator::AddFaces(in,12); - - VertexPointer ivp[8]; - - VertexIterator vi=in.vert.begin(); - - ivp[7]=&*vi;(*vi).P()=CoordType (-1,-1,-1); ++vi; - ivp[6]=&*vi;(*vi).P()=CoordType ( 1,-1,-1); ++vi; - ivp[5]=&*vi;(*vi).P()=CoordType (-1, 1,-1); ++vi; - ivp[4]=&*vi;(*vi).P()=CoordType ( 1, 1,-1); ++vi; - ivp[3]=&*vi;(*vi).P()=CoordType (-1,-1, 1); ++vi; - ivp[2]=&*vi;(*vi).P()=CoordType ( 1,-1, 1); ++vi; - ivp[1]=&*vi;(*vi).P()=CoordType (-1, 1, 1); ++vi; - ivp[0]=&*vi;(*vi).P()=CoordType ( 1, 1, 1); - - FaceIterator fi=in.face.begin(); - (*fi).V(0)=ivp[0]; (*fi).V(1)=ivp[1]; (*fi).V(2)=ivp[2]; ++fi; - (*fi).V(0)=ivp[3]; (*fi).V(1)=ivp[2]; (*fi).V(2)=ivp[1]; ++fi; - (*fi).V(0)=ivp[0]; (*fi).V(1)=ivp[2]; (*fi).V(2)=ivp[4]; ++fi; - (*fi).V(0)=ivp[6]; (*fi).V(1)=ivp[4]; (*fi).V(2)=ivp[2]; ++fi; - (*fi).V(0)=ivp[0]; (*fi).V(1)=ivp[4]; (*fi).V(2)=ivp[1]; ++fi; - (*fi).V(0)=ivp[5]; (*fi).V(1)=ivp[1]; (*fi).V(2)=ivp[4]; ++fi; - (*fi).V(0)=ivp[7]; (*fi).V(1)=ivp[5]; (*fi).V(2)=ivp[6]; ++fi; - (*fi).V(0)=ivp[4]; (*fi).V(1)=ivp[6]; (*fi).V(2)=ivp[5]; ++fi; - (*fi).V(0)=ivp[7]; (*fi).V(1)=ivp[6]; (*fi).V(2)=ivp[3]; ++fi; - (*fi).V(0)=ivp[2]; (*fi).V(1)=ivp[3]; (*fi).V(2)=ivp[6]; ++fi; - (*fi).V(0)=ivp[7]; (*fi).V(1)=ivp[3]; (*fi).V(2)=ivp[5]; ++fi; - (*fi).V(0)=ivp[1]; (*fi).V(1)=ivp[5]; (*fi).V(2)=ivp[3]; - - if (in.HasPerFaceFlags()) { - FaceIterator fi=in.face.begin(); - for (int k=0; k<12; k++) { - (*fi).SetF(1); fi++; - } - } - -} - -template -void Square(MeshType &in) -{ - typedef typename MeshType::ScalarType ScalarType; - typedef typename MeshType::CoordType CoordType; - typedef typename MeshType::VertexPointer VertexPointer; - typedef typename MeshType::VertexIterator VertexIterator; - typedef typename MeshType::FaceIterator FaceIterator; - - in.Clear(); - Allocator::AddVertices(in,4); - Allocator::AddFaces(in,2); - - VertexPointer ivp[4]; - - VertexIterator vi=in.vert.begin(); - ivp[0]=&*vi;(*vi).P()=CoordType ( 1, 0, 0); ++vi; - ivp[1]=&*vi;(*vi).P()=CoordType ( 0, 1, 0); ++vi; - ivp[2]=&*vi;(*vi).P()=CoordType (-1, 0, 0); ++vi; - ivp[3]=&*vi;(*vi).P()=CoordType ( 0,-1, 0); - - FaceIterator fi=in.face.begin(); - (*fi).V(0)=ivp[0]; (*fi).V(1)=ivp[1]; (*fi).V(2)=ivp[2]; ++fi; - (*fi).V(0)=ivp[2]; (*fi).V(1)=ivp[3]; (*fi).V(2)=ivp[0]; - - if (in.HasPerFaceFlags()) { - FaceIterator fi=in.face.begin(); - for (int k=0; k<2; k++) { - (*fi).SetF(2); fi++; - } - } -} - -// this function build a sphere starting from a eventually not empty mesh. -// If the mesh is not empty it is 'spherified' and used as base for the subdivision process. -// otherwise an icosahedron is used. -template -void Sphere(MeshType &in, const int subdiv = 3 ) -{ - typedef typename MeshType::ScalarType ScalarType; - typedef typename MeshType::CoordType CoordType; - typedef typename MeshType::VertexPointer VertexPointer; - typedef typename MeshType::VertexIterator VertexIterator; - typedef typename MeshType::FaceIterator FaceIterator; - if(in.vn==0 && in.fn==0) Icosahedron(in); - - VertexIterator vi; - for(vi = in.vert.begin(); vi!=in.vert.end();++vi) - vi->P().Normalize(); - - tri::UpdateFlags::FaceBorderFromNone(in); - tri::UpdateTopology::FaceFace(in); - - size_t lastsize = 0; - for(int i = 0 ; i < subdiv; ++i) - { - Refine< MeshType, MidPoint >(in, MidPoint(&in), 0); - - for(vi = in.vert.begin() + lastsize; vi != in.vert.end(); ++vi) - vi->P().Normalize(); - - lastsize = in.vert.size(); - } -} - - - /// r1 = raggio 1, r2 = raggio2, h = altezza (asse y) -template -void Cone( MeshType& in, - const typename MeshType::ScalarType r1, - const typename MeshType::ScalarType r2, - const typename MeshType::ScalarType h, - const int SubDiv = 36 ) -{ - typedef typename MeshType::ScalarType ScalarType; - typedef typename MeshType::CoordType CoordType; - typedef typename MeshType::VertexPointer VertexPointer; - typedef typename MeshType::VertexIterator VertexIterator; - typedef typename MeshType::FaceIterator FaceIterator; - - int i,b1,b2; - in.Clear(); - int VN,FN; - if(r1==0 || r2==0) { - VN=SubDiv+2; - FN=SubDiv*2; - } else { - VN=SubDiv*2+2; - FN=SubDiv*4; - } - - Allocator::AddVertices(in,VN); - Allocator::AddFaces(in,FN); - VertexPointer *ivp = new VertexPointer[VN]; - - VertexIterator vi=in.vert.begin(); - ivp[0]=&*vi;(*vi).P()=CoordType ( 0,-h/2.0,0 ); ++vi; - ivp[1]=&*vi;(*vi).P()=CoordType ( 0, h/2.0,0 ); ++vi; - - b1 = b2 = 2; - int cnt=2; - if(r1!=0) - { - for(i=0;i -void Box(MeshType &in, const typename MeshType::BoxType & bb ) -{ - typedef typename MeshType::ScalarType ScalarType; - typedef typename MeshType::CoordType CoordType; - typedef typename MeshType::VertexPointer VertexPointer; - typedef typename MeshType::VertexIterator VertexIterator; - typedef typename MeshType::FaceIterator FaceIterator; - - in.Clear(); - Allocator::AddVertices(in,8); - Allocator::AddFaces(in,12); - - VertexPointer ivp[8]; - - VertexIterator vi=in.vert.begin(); - ivp[0]=&*vi;(*vi).P()=CoordType (bb.min[0],bb.min[1],bb.min[2]); ++vi; - ivp[1]=&*vi;(*vi).P()=CoordType (bb.max[0],bb.min[1],bb.min[2]); ++vi; - ivp[2]=&*vi;(*vi).P()=CoordType (bb.min[0],bb.max[1],bb.min[2]); ++vi; - ivp[3]=&*vi;(*vi).P()=CoordType (bb.max[0],bb.max[1],bb.min[2]); ++vi; - ivp[4]=&*vi;(*vi).P()=CoordType (bb.min[0],bb.min[1],bb.max[2]); ++vi; - ivp[5]=&*vi;(*vi).P()=CoordType (bb.max[0],bb.min[1],bb.max[2]); ++vi; - ivp[6]=&*vi;(*vi).P()=CoordType (bb.min[0],bb.max[1],bb.max[2]); ++vi; - ivp[7]=&*vi;(*vi).P()=CoordType (bb.max[0],bb.max[1],bb.max[2]); - - FaceIterator fi=in.face.begin(); - (*fi).V(0)=ivp[0]; (*fi).V(1)=ivp[1]; (*fi).V(2)=ivp[2]; ++fi; - (*fi).V(0)=ivp[3]; (*fi).V(1)=ivp[2]; (*fi).V(2)=ivp[1]; ++fi; - (*fi).V(0)=ivp[0]; (*fi).V(1)=ivp[2]; (*fi).V(2)=ivp[4]; ++fi; - (*fi).V(0)=ivp[6]; (*fi).V(1)=ivp[4]; (*fi).V(2)=ivp[2]; ++fi; - (*fi).V(0)=ivp[0]; (*fi).V(1)=ivp[4]; (*fi).V(2)=ivp[1]; ++fi; - (*fi).V(0)=ivp[5]; (*fi).V(1)=ivp[1]; (*fi).V(2)=ivp[4]; ++fi; - (*fi).V(0)=ivp[7]; (*fi).V(1)=ivp[5]; (*fi).V(2)=ivp[6]; ++fi; - (*fi).V(0)=ivp[4]; (*fi).V(1)=ivp[6]; (*fi).V(2)=ivp[5]; ++fi; - (*fi).V(0)=ivp[7]; (*fi).V(1)=ivp[6]; (*fi).V(2)=ivp[3]; ++fi; - (*fi).V(0)=ivp[2]; (*fi).V(1)=ivp[3]; (*fi).V(2)=ivp[6]; ++fi; - (*fi).V(0)=ivp[7]; (*fi).V(1)=ivp[3]; (*fi).V(2)=ivp[5]; ++fi; - (*fi).V(0)=ivp[1]; (*fi).V(1)=ivp[5]; (*fi).V(2)=ivp[3]; - - if (in.HasPerFaceFlags()) { - FaceIterator fi=in.face.begin(); - for (int k=0; k<12; k++) { - (*fi).SetF(1); fi++; - } - } - -} - - -// this function build a mesh starting from a vector of generic coords (objects having a triple of float at their beginning) -// and a vector of faces (objects having a triple of ints at theri beginning). - - -template -void Build( MeshType & in, const V & v, const F & f) -{ - typedef typename MeshType::ScalarType ScalarType; - typedef typename MeshType::CoordType CoordType; - typedef typename MeshType::VertexPointer VertexPointer; - typedef typename MeshType::VertexIterator VertexIterator; - typedef typename MeshType::FaceIterator FaceIterator; - - Allocator::AddVertices(in,v.size()); - Allocator::AddFaces(in,f.size()); - - typename V::const_iterator vi; - - typename MeshType::VertexType tv; - - for(int i=0;i index(in.vn); - VertexIterator j; - int k; - for(k=0,j=in.vert.begin();j!=in.vert.end();++j,++k) - index[k] = &*j; - - typename F::const_iterator fi; - - typename MeshType::FaceType ft; - - for(int i=0;i=0 ); - assert( ff[1]>=0 ); - assert( ff[2]>=0 ); - assert( ff[0] array -// Once generated the vertex positions it uses the FaceGrid function to generate the faces; - -template -void Grid(MeshType & in, int w, int h, float wl, float hl, float *data) -{ - typedef typename MeshType::CoordType CoordType; - typedef typename MeshType::VertexPointer VertexPointer; - typedef typename MeshType::VertexIterator VertexIterator; - typedef typename MeshType::FaceIterator FaceIterator; - - in.Clear(); - Allocator::AddVertices(in,w*h); - - - float wld=wl/float(w); - float hld=hl/float(h); - - for(int i=0;i -void FaceGrid(MeshType & in, int w, int h) -{ - assert(in.vn == (int)in.vert.size()); // require a compact vertex vector - assert(in.vn >= w*h); // the number of vertices should match the number of expected grid vertices - - Allocator::AddFaces(in,(w-1)*(h-1)*2); - -// i+0,j+0 -- i+0,j+1 -// | \ | -// | \ | -// | \ | -// | \ | -// i+1,j+0 -- i+1,j+1 -// - for(int i=0;i -void FaceGrid(MeshType & in, const std::vector &grid, int w, int h) -{ - assert(in.vn == (int)in.vert.size()); // require a compact vertex vector - assert(in.vn <= w*h); // the number of vertices should match the number of expected grid vertices - -// V0 V1 -// i+0,j+0 -- i+0,j+1 -// | \ | -// | \ | -// | \ | -// | \ | -// i+1,j+0 -- i+1,j+1 -// V2 V3 - - - for(int i=0;i=0 && V1i>=0 && V2i>=0 && V3i>=0 ) && in.HasPerFaceFlags(); - - if(V0i>=0 && V2i>=0 && V3i>=0 ) - { - typename MeshType::FaceIterator f= Allocator::AddFaces(in,1); - f->V(0)=&(in.vert[V3i]); - f->V(1)=&(in.vert[V2i]); - f->V(2)=&(in.vert[V0i]); - if (quad) f->SetF(2); - ndone++; - } - if(V0i>=0 && V1i>=0 && V3i>=0 ) - { - typename MeshType::FaceIterator f= Allocator::AddFaces(in,1); - f->V(0)=&(in.vert[V0i]); - f->V(1)=&(in.vert[V1i]); - f->V(2)=&(in.vert[V3i]); - if (quad) f->SetF(2); - ndone++; - } - - if (ndone==0) { // try diag the other way - if(V2i>=0 && V0i>=0 && V1i>=0 ) - { - typename MeshType::FaceIterator f= Allocator::AddFaces(in,1); - f->V(0)=&(in.vert[V2i]); - f->V(1)=&(in.vert[V0i]); - f->V(2)=&(in.vert[V1i]); - ndone++; - } - if(V1i>=0 && V3i>=0 && V2i>=0 ) - { - typename MeshType::FaceIterator f= Allocator::AddFaces(in,1); - f->V(0)=&(in.vert[V1i]); - f->V(1)=&(in.vert[V3i]); - f->V(2)=&(in.vert[V2i]); - ndone++; - } - } - - - } -} - -template -void Cylinder(int slices, int stacks, MeshType & m){ - - typename MeshType::VertexIterator vi = vcg::tri::Allocator::AddVertices(m,slices*(stacks+1)); - for ( int i = 0; i < stacks+1; ++i) - for ( int j = 0; j < slices; ++j) - { - float x,y,h; - x = cos( 2.0 * M_PI / slices * j); - y = sin( 2.0 * M_PI / slices * j); - h = 2 * i / (float)(stacks) - 1; - - (*vi).P() = typename MeshType::CoordType(x,h,y); - ++vi; - } - - typename MeshType::FaceIterator fi ; - for ( int j = 0; j < stacks; ++j) - for ( int i = 0; i < slices; ++i) - { - int a,b,c,d; - a = (j+0)*slices + i; - b = (j+1)*slices + i; - c = (j+1)*slices + (i+1)%slices; - d = (j+0)*slices + (i+1)%slices; - if(((i+j)%2) == 0){ - fi = vcg::tri::Allocator::AddFaces(m,1); - (*fi).V(0) = &m.vert[ a ]; - (*fi).V(1) = &m.vert[ b ]; - (*fi).V(2) = &m.vert[ c ]; - - fi = vcg::tri::Allocator::AddFaces(m,1); - (*fi).V(0) = &m.vert[ c ]; - (*fi).V(1) = &m.vert[ d ]; - (*fi).V(2) = &m.vert[ a ]; - } - else{ - fi = vcg::tri::Allocator::AddFaces(m,1); - (*fi).V(0) = &m.vert[ b ]; - (*fi).V(1) = &m.vert[ c ]; - (*fi).V(2) = &m.vert[ d ]; - - fi = vcg::tri::Allocator::AddFaces(m,1); - (*fi).V(0) = &m.vert[ d ]; - (*fi).V(1) = &m.vert[ a ]; - (*fi).V(2) = &m.vert[ b ]; - - } - } - - if (m.HasPerFaceFlags()) { - for (typename MeshType::FaceIterator fi=m.face.begin(); fi!=m.face.end(); fi++) { - (*fi).SetF(2); - } - } - - -} - -template -void GenerateCameraMesh(MeshType &in){ - typedef typename MeshType::CoordType MV; - MV vv[52]={ - MV(-0.000122145 , -0.2 ,0.35), - MV(0.000122145 , -0.2 ,-0.35),MV(-0.000122145 , 0.2 ,0.35),MV(0.000122145 , 0.2 ,-0.35),MV(0.999878 , -0.2 ,0.350349),MV(1.00012 , -0.2 ,-0.349651),MV(0.999878 , 0.2 ,0.350349),MV(1.00012 , 0.2 ,-0.349651),MV(1.28255 , 0.1 ,0.754205),MV(1.16539 , 0.1 ,1.03705),MV(0.88255 , 0.1 ,1.15421), - MV(0.599707 , 0.1 ,1.03705),MV(0.48255 , 0.1 ,0.754205),MV(0.599707 , 0.1 ,0.471362),MV(0.88255 , 0.1 ,0.354205),MV(1.16539 , 0.1 ,0.471362),MV(1.28255 , -0.1 ,0.754205),MV(1.16539 , -0.1 ,1.03705),MV(0.88255 , -0.1 ,1.15421),MV(0.599707 , -0.1 ,1.03705),MV(0.48255 , -0.1 ,0.754205), - MV(0.599707 , -0.1 ,0.471362),MV(1.16539 , -0.1 ,0.471362),MV(0.88255 , -0.1 ,0.354205),MV(3.49164e-005 , 0 ,-0.1),MV(1.74582e-005 , -0.0866025 ,-0.05),MV(-1.74582e-005 , -0.0866025 ,0.05),MV(-3.49164e-005 , 8.74228e-009 ,0.1),MV(-1.74582e-005 , 0.0866025 ,0.05),MV(1.74582e-005 , 0.0866025 ,-0.05),MV(-0.399913 , 1.99408e-022 ,-0.25014), - MV(-0.399956 , -0.216506 ,-0.12514),MV(-0.400044 , -0.216506 ,0.12486),MV(-0.400087 , 2.18557e-008 ,0.24986),MV(-0.400044 , 0.216506 ,0.12486),MV(-0.399956 , 0.216506 ,-0.12514),MV(0.479764 , 0.1 ,0.754205),MV(0.362606 , 0.1 ,1.03705),MV(0.0797637 , 0.1 ,1.15421),MV(-0.203079 , 0.1 ,1.03705),MV(-0.320236 , 0.1 ,0.754205), - MV(-0.203079 , 0.1 ,0.471362),MV(0.0797637 , 0.1 ,0.354205),MV(0.362606 , 0.1 ,0.471362),MV(0.479764 , -0.1 ,0.754205),MV(0.362606 , -0.1 ,1.03705),MV(0.0797637 , -0.1 ,1.15421),MV(-0.203079 , -0.1 ,1.03705),MV(-0.320236 , -0.1 ,0.754205),MV(0.0797637 , -0.1 ,0.354205),MV(0.362606 , -0.1 ,0.471362), - MV(-0.203079 , -0.1 ,0.471362), }; - int ff[88][3]={ - {0,2,3}, - {3,1,0},{4,5,7},{7,6,4},{0,1,5},{5,4,0},{1,3,7},{7,5,1},{3,2,6},{6,7,3},{2,0,4}, - {4,6,2},{10,9,8},{10,12,11},{10,13,12},{10,14,13},{10,15,14},{10,8,15},{8,17,16},{8,9,17},{9,18,17}, - {9,10,18},{10,19,18},{10,11,19},{11,20,19},{11,12,20},{12,21,20},{12,13,21},{13,23,21},{13,14,23},{14,22,23}, - {14,15,22},{15,16,22},{15,8,16},{23,16,17},{23,17,18},{23,18,19},{23,19,20},{23,20,21},{23,22,16},{25,27,26}, - {25,28,27},{25,29,28},{25,24,29},{24,31,30},{24,25,31},{25,32,31},{25,26,32},{26,33,32},{26,27,33},{27,34,33}, - {27,28,34},{28,35,34},{28,29,35},{29,30,35},{29,24,30},{35,30,31},{35,31,32},{35,32,33},{35,33,34},{42,37,36}, - {42,38,37},{42,39,38},{42,40,39},{42,41,40},{42,36,43},{36,45,44},{36,37,45},{37,46,45},{37,38,46},{38,47,46}, - {38,39,47},{39,48,47},{39,40,48},{40,51,48},{40,41,51},{41,49,51},{41,42,49},{42,50,49},{42,43,50},{43,44,50}, - {43,36,44},{51,44,45},{51,45,46},{51,46,47},{51,47,48},{51,49,50},{51,50,44}, - }; - - in.Clear(); - Allocator::AddVertices(in,52); - Allocator::AddFaces(in,88); - - in.vn=52;in.fn=88; - int i,j; - for(i=0;i index(in.vn); - - typename MeshType::VertexIterator vi; - for(j=0,vi=in.vert.begin();j -#include -#include -#include -#include -#include -#include -#include - -namespace vcg { -namespace tri { - - -/** \addtogroup trimesh */ -/*@{*/ -/*@{*/ -/** Class Resampler. - This is class reasmpling a mesh using marching cubes methods - @param OLD_MESH_TYPE (Template Parameter) Specifies the type of mesh to be resampled - @param NEW_MESH_TYPE (Template Parameter) Specifies the type of output mesh. - */ - -template > - class Resampler : public BasicGrid -{ - typedef OLD_MESH_TYPE Old_Mesh; - typedef NEW_MESH_TYPE New_Mesh; - - //template - class Walker : BasicGrid - { - private: - typedef int VertexIndex; - typedef OLD_MESH_TYPE Old_Mesh; - typedef NEW_MESH_TYPE New_Mesh; - typedef typename New_Mesh::CoordType NewCoordType; - typedef typename New_Mesh::VertexType* VertexPointer; - typedef typename Old_Mesh::FaceContainer FaceCont; - typedef typename vcg::GridStaticPtr GridType; - - protected: - - int SliceSize; - int CurrentSlice; - typedef tri::FaceTmark MarkerFace; - MarkerFace markerFunctor; - - - VertexIndex *_x_cs; // indici dell'intersezioni della superficie lungo gli Xedge della fetta corrente - VertexIndex *_y_cs; // indici dell'intersezioni della superficie lungo gli Yedge della fetta corrente - VertexIndex *_z_cs; // indici dell'intersezioni della superficie lungo gli Zedge della fetta corrente - VertexIndex *_x_ns; // indici dell'intersezioni della superficie lungo gli Xedge della prossima fetta - VertexIndex *_z_ns; // indici dell'intersezioni della superficie lungo gli Zedge della prossima fetta - - //float *_v_cs;///values of distance fields for each direction in current slice - //float *_v_ns;///values of distance fields for each direction in next slice - - typedef typename std::pair field_value; - field_value* _v_cs; - field_value* _v_ns; - - New_Mesh *_newM; - Old_Mesh *_oldM; - GridType _g; - - public: - float max_dim; // the limit value of the search (that takes into account of the offset) - float offset; // an offset value that is always added to the returned value. Useful for extrarting isosurface at a different threshold - bool DiscretizeFlag; // if the extracted surface should be discretized or not. - bool MultiSampleFlag; - bool AbsDistFlag; // if true the Distance Field computed is no more a signed one. - Walker(const Box3f &_bbox, Point3i _siz ) - { - this->bbox= _bbox; - this->siz=_siz; - ComputeDimAndVoxel(); - - SliceSize = (this->siz.X()+1)*(this->siz.Z()+1); - CurrentSlice = 0; - offset=0; - DiscretizeFlag=false; - MultiSampleFlag=false; - AbsDistFlag=false; - - _x_cs = new VertexIndex[ SliceSize ]; - _y_cs = new VertexIndex[ SliceSize ]; - _z_cs = new VertexIndex[ SliceSize ]; - _x_ns = new VertexIndex[ SliceSize ]; - _z_ns = new VertexIndex[ SliceSize ]; - - _v_cs= new field_value[(this->siz.X()+1)*(this->siz.Z()+1)]; - _v_ns= new field_value[(this->siz.X()+1)*(this->siz.Z()+1)]; - - }; - - ~Walker() - {} - - - float V(const Point3i &p) - { - return V(p.V(0),p.V(1),p.V(2)); - } - - - std::pair VV(int x,int y,int z) - { - assert ((y==CurrentSlice)||(y==(CurrentSlice+1))); - - //test if it is outside the bb of the mesh - //vcg::Point3f test=vcg::Point3f((float)x,(float)y,(float)z); - /*if (!_oldM->bbox.IsIn(test)) - return (1.f);*/ - int index=GetSliceIndex(x,z); - - if (y==CurrentSlice) return _v_cs[index]; - else return _v_ns[index]; - } - - float V(int x,int y,int z) - { - if(DiscretizeFlag) return VV(x,y,z).second+offset<0?-1:1; - return VV(x,y,z).second+offset; - } - ///return true if the distance form the mesh is less than maxdim and return distance - field_value DistanceFromMesh(Point3f &pp,Old_Mesh */*mesh*/) - { - float dist; - typename Old_Mesh::FaceType *f=NULL; - const float max_dist = max_dim; - vcg::Point3f testPt; - this->IPfToPf(pp,testPt); - - vcg::Point3f closestNormV,closestNormF; - vcg::Point3f closestPt; - vcg::Point3f pip(-1,-1,-1); - - // Note that PointDistanceBaseFunctor does not require the edge and plane precomptued. - // while the PointDistanceFunctor requires them. - - DISTFUNCTOR PDistFunct; - f = _g.GetClosest(PDistFunct,markerFunctor,testPt,max_dist,dist,closestPt); - if (f==NULL) return field_value(false,0); - if(AbsDistFlag) return field_value(true,dist); - assert(!f->IsD()); - bool retIP; - - // To compute the interpolated normal we use the more robust function that require to know what is the most orhogonal direction of the face. - if((*f).Flags() & Old_Mesh::FaceType::NORMX) retIP=InterpolationParameters(*f,0,closestPt, pip); - else if((*f).Flags() & Old_Mesh::FaceType::NORMY) retIP=InterpolationParameters(*f,1,closestPt, pip); - else if((*f).Flags() & Old_Mesh::FaceType::NORMZ) retIP=InterpolationParameters(*f,2,closestPt, pip); - else assert(0); - assert(retIP); // this should happen only if the starting mesh has degenerate faces. - - const float InterpolationEpsilon = 0.00001f; - int zeroCnt=0; - if(pip[0]0) // we Not are in the middle of the face so the face normal is NOT reliable. - { - closestNormV = (f->V(0)->cN())*pip[0] + (f->V(1)->cN())*pip[1] + (f->V(2)->cN())*pip[2] ; - signBest = dir.dot(closestNormV) ; - } - else - { - closestNormF = f->cN() ; - signBest = dir.dot(closestNormF) ; - } - - if(signBest<0) dist=-dist; - - return field_value(true,dist); - } - - field_value MultiDistanceFromMesh(Point3f &pp, Old_Mesh */*mesh*/) - { - float distSum=0; - int positiveCnt=0; // positive results counter - const int MultiSample=7; - const Point3f delta[7]={Point3f(0,0,0), - Point3f( 0.2, -0.01, -0.02), - Point3f(-0.2, 0.01, 0.02), - Point3f( 0.01, 0.2, 0.01), - Point3f( 0.03, -0.2, -0.03), - Point3f(-0.02, -0.03, 0.2 ), - Point3f(-0.01, 0.01, -0.2 )}; - - for(int qq=0;qq0) positiveCnt ++; - } - if(positiveCnt<=MultiSample/2) distSum = -distSum; - return field_value(true, distSum/MultiSample); - } - - /// compute the values if an entire slice (per y) distances>dig of a cell are signed with double of - /// the distance of the bb - void ComputeSliceValues(int slice,field_value *slice_values) - { - for (int i=0; i<=this->siz.X(); i++) - { - for (int k=0; k<=this->siz.Z(); k++) - { - int index=GetSliceIndex(i,k); - Point3f pp(i,slice,k); - if(this->MultiSampleFlag) slice_values[index] = MultiDistanceFromMesh(pp,_oldM); - else slice_values[index] = DistanceFromMesh(pp,_oldM); - } - } - //ComputeConsensus(slice,slice_values); - } - - /* - For some reasons it can happens that the sign of the computed distance could not correct. - this function tries to correct these issues by flipping the isolated voxels with discordant sign - */ - void ComputeConsensus(int slice, field_value *slice_values) - { - float max_dist = min(min(this->voxel[0],this->voxel[1]),this->voxel[2]); - int flippedCnt=0; - int flippedTot=0; - int flippedTimes=0; - do - { - flippedCnt=0; - for (int i=0; i<=this->siz.X(); i++) - { - for (int k=0; k<=this->siz.Z(); k++) - { - int goodCnt=0; - int badCnt=0; - int index=GetSliceIndex(i,k); - int index_l,index_r,index_u,index_d; - if(slice_values[index].first) - { - float curVal= slice_values[index].second; - if(i > 0 ) index_l=GetSliceIndex(i-1,k); else index_l = index; - if(i < this->siz.X() ) index_r=GetSliceIndex(i+1,k); else index_r = index; - if(k > 0 ) index_d=GetSliceIndex(i,k-1); else index_d = index; - if(k < this->siz.Z() ) index_u=GetSliceIndex(i,k+1); else index_u = index; - - if(slice_values[index_l].first) { goodCnt++; if(fabs(slice_values[index_l].second - curVal) > max_dist) badCnt++; } - if(slice_values[index_r].first) { goodCnt++; if(fabs(slice_values[index_r].second - curVal) > max_dist) badCnt++; } - if(slice_values[index_u].first) { goodCnt++; if(fabs(slice_values[index_u].second - curVal) > max_dist) badCnt++; } - if(slice_values[index_d].first) { goodCnt++; if(fabs(slice_values[index_d].second - curVal) > max_dist) badCnt++; } - - if(badCnt >= goodCnt) { - slice_values[index].second *=-1.0f; - //slice_values[index].first = false; - flippedCnt++; - } - } - } - } - flippedTot+=flippedCnt; - flippedTimes++; - } while(flippedCnt>0); - - -#ifndef NO_QT - if(flippedTot>0) - qDebug("Flipped %i values in %i times",flippedTot,flippedTimes); -#endif - } - template - void ProcessSlice(EXTRACTOR_TYPE &extractor) - { - for (int i=0; isiz.X(); i++) - { - for (int k=0; ksiz.Z(); k++) - { - bool goodCell=true; - Point3i p1(i,CurrentSlice,k); - Point3i p2=p1+Point3i(1,1,1); - for(int ii=0;ii<2;++ii) - for(int jj=0;jj<2;++jj) - for(int kk=0;kk<2;++kk) - goodCell &= VV(p1[0]+ii,p1[1]+jj,p1[2]+kk).first; - - if(goodCell) extractor.ProcessCell(p1, p2); - } - } - } - - - template - void BuildMesh(Old_Mesh &old_mesh,New_Mesh &new_mesh,EXTRACTOR_TYPE &extractor,vcg::CallBackPos *cb) - { - _newM=&new_mesh; - _oldM=&old_mesh; - - // the following two steps are required to be sure that the point-face distance without precomputed data works well. - tri::UpdateNormals::PerFaceNormalized(old_mesh); - tri::UpdateNormals::PerVertexAngleWeighted(old_mesh); - tri::UpdateFlags::FaceProjection(old_mesh); - int _size=(int)old_mesh.fn*100; - - _g.Set(_oldM->face.begin(),_oldM->face.end(),_size); - markerFunctor.SetMesh(&old_mesh); - - _newM->Clear(); - - Begin(); - extractor.Initialize(); - for (int j=0; j<=this->siz.Y(); j++) - { - cb((100*j)/this->siz.Y(),"Marching "); - ProcessSlice(extractor);//find cells where there is the isosurface and examine it - NextSlice(); - } - extractor.Finalize(); - typename New_Mesh::VertexIterator vi; - for(vi=new_mesh.vert.begin();vi!=new_mesh.vert.end();++vi) - if(!(*vi).IsD()) - { - IPfToPf((*vi).cP(),(*vi).P()); - } - } - - //return the index of a vertex in slide as it was stored - int GetSliceIndex(int x,int z) - { - VertexIndex index = x+z*(this->siz.X()+1); - return (index); - } - - //swap slices , the initial value of distance fields ids set as double of bbox of space - void NextSlice() - { - - memset(_x_cs, -1, SliceSize*sizeof(VertexIndex)); - memset(_y_cs, -1, SliceSize*sizeof(VertexIndex)); - memset(_z_cs, -1, SliceSize*sizeof(VertexIndex)); - - - std::swap(_x_cs, _x_ns); - std::swap(_z_cs, _z_ns); - - std::swap(_v_cs, _v_ns); - - CurrentSlice ++; - - ComputeSliceValues(CurrentSlice + 1,_v_ns); - } - - //initialize data strucures , the initial value of distance fields ids set as double of bbox of space - void Begin() - { - - CurrentSlice = 0; - - memset(_x_cs, -1, SliceSize*sizeof(VertexIndex)); - memset(_y_cs, -1, SliceSize*sizeof(VertexIndex)); - memset(_z_cs, -1, SliceSize*sizeof(VertexIndex)); - memset(_x_ns, -1, SliceSize*sizeof(VertexIndex)); - memset(_z_ns, -1, SliceSize*sizeof(VertexIndex)); - - ComputeSliceValues(CurrentSlice,_v_cs); - ComputeSliceValues(CurrentSlice+1,_v_ns); - } - - - - - bool Exist(const vcg::Point3i &p1, const vcg::Point3i &p2, VertexPointer &v) - { - int i = p1.X();// - _bbox.min.X())/_cell_size.X(); - int z = p1.Z();// - _bbox.min.Z())/_cell_size.Z(); - VertexIndex index = i+z*this->siz.X(); - - //VertexIndex index =GetSliceIndex(// - int v_ind = 0; - if (p1.X()!=p2.X()) //intersezione della superficie con un Xedge - { - if (p1.Y()==CurrentSlice) - { - if (_x_cs[index]!=-1) - { - v_ind = _x_cs[index]; - v = &_newM->vert[v_ind]; - assert(!v->IsD()); - return true; - } - - } - else - { - if (_x_ns[index]!=-1) - { - v_ind = _x_ns[index]; - v = &_newM->vert[v_ind]; - assert(!v->IsD()); - return true; - } - } - v = NULL; - return false; - } - else if (p1.Y()!=p2.Y()) //intersezione della superficie con un Yedge - { - if (_y_cs[index]!=-1) - { - v_ind =_y_cs[index]; - v = &_newM->vert[v_ind]; - assert(!v->IsD()); - return true; - } - else - { - v = NULL; - return false; - } - - } - else if (p1.Z()!=p2.Z()) - //intersezione della superficie con un Zedge - { - if (p1.Y()==CurrentSlice) - { - if ( _z_cs[index]!=-1) - { - v_ind = _z_cs[index]; - v = &_newM->vert[v_ind]; - assert(!v->IsD()); - return true; - } - - } - else - { - if (_z_ns[index]!=-1) - { - v_ind = _z_ns[index]; - v = &_newM->vert[v_ind]; - assert(!v->IsD()); - return true; - } - } - v = NULL; - return false; - } - assert (0); - return false; - } - - ///interpolate - NewCoordType Interpolate(const vcg::Point3i &p1, const vcg::Point3i &p2,int dir) - { - float f1 = (float)V(p1); - float f2 = (float)V(p2); - float u = (float) f1/(f1-f2); - NewCoordType ret=vcg::Point3f((float)p1.V(0),(float)p1.V(1),(float)p1.V(2)); - ret.V(dir) = (float) p1.V(dir)*(1.f-u) + u*(float)p2.V(dir); - return (ret); - } - - ///if there is a vertex in z axis of a cell return the vertex or create it - void GetXIntercept(const vcg::Point3i &p1, const vcg::Point3i &p2, VertexPointer &v) - { - assert(p1.X()+1 == p2.X()); - assert(p1.Y() == p2.Y()); - assert(p1.Z() == p2.Z()); - - int i = p1.X();// (p1.X() - _bbox.min.X())/_cell_size.X(); - int z = p1.Z();//(p1.Z() - _bbox.min.Z())/_cell_size.Z(); - VertexIndex index = i+z*this->siz.X(); - VertexIndex pos=-1; - if (p1.Y()==CurrentSlice) - { - if ((pos=_x_cs[index])==-1) - { - _x_cs[index] = (VertexIndex) _newM->vert.size(); - pos = _x_cs[index]; - Allocator::AddVertices( *_newM, 1 ); - v = &_newM->vert[pos]; - v->P()=Interpolate(p1,p2,0); - return; - } - } - if (p1.Y()==CurrentSlice+1) - { - if ((pos=_x_ns[index])==-1) - { - _x_ns[index] = (VertexIndex) _newM->vert.size(); - pos = _x_ns[index]; - Allocator::AddVertices( *_newM, 1 ); - v = &_newM->vert[pos]; - v->P()=Interpolate(p1,p2,0); - return; - } - } - assert(pos>=0); - v = &_newM->vert[pos]; - } - - ///if there is a vertex in y axis of a cell return the vertex or create it - void GetYIntercept(const vcg::Point3i &p1, const vcg::Point3i &p2, VertexPointer &v) - { - assert(p1.X() == p2.X()); - assert(p1.Y()+1 == p2.Y()); - assert(p1.Z() == p2.Z()); - - int i = p1.X(); // (p1.X() - _bbox.min.X())/_cell_size.X(); - int z = p1.Z(); // (p1.Z() - _bbox.min.Z())/_cell_size.Z(); - VertexIndex index = i+z*this->siz.X(); - VertexIndex pos=-1; - if ((pos=_y_cs[index])==-1) - { - _y_cs[index] = (VertexIndex) _newM->vert.size(); - pos = _y_cs[index]; - Allocator::AddVertices( *_newM, 1); - v = &_newM->vert[ pos ]; - v->P()=Interpolate(p1,p2,1); - } - assert(pos>=0); - v = &_newM->vert[pos]; - } - - ///if there is a vertex in z axis of a cell return the vertex or create it - void GetZIntercept(const vcg::Point3i &p1, const vcg::Point3i &p2, VertexPointer &v) - { - assert(p1.X() == p2.X()); - assert(p1.Y() == p2.Y()); - assert(p1.Z()+1 == p2.Z()); - - int i = p1.X(); //(p1.X() - _bbox.min.X())/_cell_size.X(); - int z = p1.Z(); //(p1.Z() - _bbox.min.Z())/_cell_size.Z(); - VertexIndex index = i+z*this->siz.X(); - - VertexIndex pos=-1; - if (p1.Y()==CurrentSlice) - { - if ((pos=_z_cs[index])==-1) - { - _z_cs[index] = (VertexIndex) _newM->vert.size(); - pos = _z_cs[index]; - Allocator::AddVertices( *_newM, 1 ); - v = &_newM->vert[pos]; - v->P()=Interpolate(p1,p2,2); - return; - } - } - if (p1.Y()==CurrentSlice+1) - { - if ((pos=_z_ns[index])==-1) - { - _z_ns[index] = (VertexIndex) _newM->vert.size(); - pos = _z_ns[index]; - Allocator::AddVertices( *_newM, 1 ); - v = &_newM->vert[pos]; - v->P()=Interpolate(p1,p2,2); - return; - } - } - assert(pos>=0); - v = &_newM->vert[pos]; - } - - };//end class walker - -public: - -typedef Walker /*< Old_Mesh,New_Mesh>*/ MyWalker; - -typedef vcg::tri::MarchingCubes MyMarchingCubes; - -///resample the mesh using marching cube algorithm ,the accuracy is the dimension of one cell the parameter -static void Resample(Old_Mesh &old_mesh,New_Mesh &new_mesh, Box3f volumeBox, vcg::Point3 accuracy,float max_dist, float thr=0, bool DiscretizeFlag=false, bool MultiSampleFlag=false, bool AbsDistFlag=false, vcg::CallBackPos *cb=0 ) -{ - ///be sure that the bounding box is updated - vcg::tri::UpdateBounding::Box(old_mesh); - - MyWalker walker(volumeBox,accuracy); - - walker.max_dim=max_dist+fabs(thr); - walker.offset = - thr; - walker.DiscretizeFlag = DiscretizeFlag; - walker.MultiSampleFlag = MultiSampleFlag; - walker.AbsDistFlag = AbsDistFlag; - MyMarchingCubes mc(new_mesh, walker); - walker.BuildMesh(old_mesh,new_mesh,mc,cb); -} - - -};//end class resampler - -};//end namespace tri -};//end namespace vcg -#endif