diff --git a/wrap/miq/seams_initializer.h b/wrap/miq/seams_initializer.h index ab31b335..7e24342b 100644 --- a/wrap/miq/seams_initializer.h +++ b/wrap/miq/seams_initializer.h @@ -42,7 +42,6 @@ private: std::vector faces; std::vector edges; - //SortedFaces(v,faces); vcg::face::VFOrderedStarVF_FF(v,faces,edges); missmatch=0; @@ -101,9 +100,7 @@ private: int j = f->FFi(s); if ((!(IsRotSeam(f,s))) && (!(IsRotSeam(g,j))) && (!g->IsV()) ) { - //f->seam[s] = false; Handle_Seams[f][s]=false; - //g->seam[j] = false; // dissolve seam Handle_Seams[g][j]=false; g->SetV(); d.push_back(g); @@ -155,61 +152,6 @@ private: } while (!over); } -// bool LoadSeamsMMFromOBJ(std::string PathOBJ) -// { -// FILE *f = fopen(PathOBJ.c_str(),"rt"); -// if (!f) -// return false; - -// for (unsigned int i=0;iface.size();i++) -// { -// for (int j=0;j<3;j++) -// Handle_Seams[i][j]=false; -// } - -// while (!feof(f)) -// { - -// int f_int,v_int,rot; -// int readed=fscanf(f,"sm %d %d %d\n",&f_int,&v_int,&rot); -// ///skip lines -// if (readed==0) -// { -// char buff[200]; -// fscanf(f,"%s\n",&buff[0]); -// } -// else ///add the actual seams -// { -// VertexType *v=&mesh->vert[v_int-1]; -// FaceType *f0=&mesh->face[f_int-1]; -// int e0=-1; -// if (f0->V(0)==v)e0=0; -// if (f0->V(1)==v)e0=1; -// if (f0->V(2)==v)e0=2; -// e0=(e0+2)%3; -// assert(e0!=-1); -// FaceType *f1; -// int e1; -// f1=f0->FFp(e0); -// e1=f0->FFi(e0); -// Handle_Seams[f0][e0]=true; -// Handle_Seams[f1][e1]=true; - -// Handle_MMatch[f0][e0]=rot; -// int rot1; -// if (rot==0)rot1=0; -// if (rot==1)rot1=3; -// if (rot==2)rot1=2; -// if (rot==3)rot1=1; -// Handle_MMatch[f1][e1]=rot1; -// } -// } -// //printf("NEED %d LINES\n",i); -// return true; -// } - - - void AddSeamsByMM() { for (unsigned int i=0;iface.size();i++) @@ -292,33 +234,26 @@ private: public: - bool InitFromGradOBJ(const std::string &PathGrad, - const std::string &PathObj) - { - AddAttributesIfNeeded(); - ///OPEN THE GRAD FILE - bool field_loaded=vcg::tri::io::ImporterFIELD::LoadGrad(mesh,PathGrad.c_str()); - if (!field_loaded)return false; - vcg::tri::io::ImporterFIELD::LoadSeamsMMFromOBJ(*mesh,PathObj); - SelectSingularityByMM(); - return true; - } - bool InitFromFField(const std::string &PathFField) + void Init(MeshType *_mesh, + bool orient_globally, + bool initMM, + bool initCuts) { + mesh=_mesh; AddAttributesIfNeeded(); - bool field_loaded=vcg::tri::io::ImporterFIELD::LoadFFIELD(mesh,PathFField.c_str()); - if (!field_loaded)return false; - vcg::tri::CrossField::MakeDirectionFaceCoherent(*mesh); - InitMMatch(); + if (orient_globally) + vcg::tri::CrossField::MakeDirectionFaceCoherent(*mesh); + if (initMM) + InitMMatch(); SelectSingularityByMM(); - InitTopologycalCuts(); - AddSeamsByMM(); - return true; + if (initCuts) + { + InitTopologycalCuts(); + AddSeamsByMM(); + } } - void Init(MeshType *_mesh){mesh=_mesh;}//AllocateMappingStructures();} - SeamsInitializer(){mesh=NULL;} };