void MSDM2_Component::Matching_Multires_Init(PolyhedronPtr m_PolyDegrad, PolyhedronPtr m_PolyOriginal , Facet * _TabMatchedFacet) { // constructs AABB tree AABB_Tree tree(m_PolyOriginal->facets_begin(),m_PolyOriginal->facets_end()); tree.accelerate_distance_queries(); //Searching for the closest point and facet for each vertex int ind=0; for(Vertex_iterator pVertex = m_PolyDegrad->vertices_begin(); pVertex != m_PolyDegrad->vertices_end(); pVertex++) { pVertex->MSDM2_Local=0; // computes closest point and primitive id Point_and_primitive_id pp = tree.closest_point_and_primitive(pVertex->point()); Point3d Nearest=pp.first; Facet_iterator f_Nearest = pp.second; // closest primitive id pVertex->match=Nearest; _TabMatchedFacet[ind]=*f_Nearest; ind++; } }
void VSA_Component::ConstructFaceColorMap(PolyhedronPtr pMesh) { //Vertex_iterator pVertex = NULL; // MT Facet_iterator pFacet = pMesh->facets_begin(); for(;pFacet != pMesh->facets_end();pFacet++) { double R=(double)(pFacet->LabelVSA)/(double)pMesh->NbFaceLabel*255.; int indiceLut=floor(R); pFacet->color(LUT_Seg[3*indiceLut],LUT_Seg[3*indiceLut+1],LUT_Seg[3*indiceLut+2]); } }
// Description : Initialize all flags -verticeces and facets- to FREE and give order to vertices // This function is called within every conquest. void Init(PolyhedronPtr pMesh) { int i = 0; // vertices flags initialization Vertex_iterator pVertex = NULL; for(pVertex = pMesh->vertices_begin(); pVertex != pMesh->vertices_end(); i++,pVertex++) { pVertex->Vertex_Flag_S = FREE; pVertex->Vertex_Number_S = i; pVertex->Vertex_Sign_S = NOSIGN; } // facets flag initialization. Facet_iterator pFace = NULL; for(pFace = pMesh->facets_begin(); pFace != pMesh->facets_end(); pFace++) { pFace->Facet_Flag_S = FREE; } }
void Boolean_Operations_Component::SubdiviserPolyedre(PolyhedronPtr pMesh) { //Each facet must be triangular if(!pMesh->is_pure_triangle()) { pMesh->triangulate(); return; } Facet_iterator pFacet; Vector Vcenter; //Initialization of the tags for (pFacet = pMesh->facets_begin(); pFacet != pMesh->facets_end(); pFacet++) { Halfedge_around_facet_circulator pHEcirc = pFacet->facet_begin(); pFacet->Issub = false; pHEcirc->Isnew = false; pHEcirc->vertex()->Isnew = false; pHEcirc++; pHEcirc->Isnew = false; pHEcirc->vertex()->Isnew = false; pHEcirc++; pHEcirc->Isnew = false; pHEcirc->vertex()->Isnew = false; } //For each facet of the polyhedron for (pFacet = pMesh->facets_begin(); pFacet != pMesh->facets_end(); pFacet++) { //We subdivide the facet if it is not already done if(!(pFacet->Issub)) { Halfedge_handle pHE = pFacet->facet_begin(); for(unsigned int i = 0;i!=5;i++) { if(!pHE->Isnew) { //each edge is splited in its center Vcenter = Vector(0.0, 0.0, 0.0); Vcenter = ( (pHE->vertex()->point() - CGAL::ORIGIN) + (pHE->opposite()->vertex()->point() - CGAL::ORIGIN) ) / 2; pHE = pMesh->split_edge(pHE); pHE->vertex()->point() = CGAL::ORIGIN + Vcenter; //update of the tags (the new vertex and the four new halfedges pHE->vertex()->Isnew = true; pHE->Isnew = true; pHE->opposite()->Isnew = true; pHE->next()->Isnew = true; pHE->next()->opposite()->Isnew = true; } pHE = pHE->next(); } //Three new edges are build between the three new vertices, and the tags of the facets are updated if(!pHE->vertex()->Isnew) pHE = pHE->next(); pHE = pMesh->split_facet(pHE, pHE->next()->next()); pHE->opposite()->facet()->Issub = true; pHE = pMesh->split_facet(pHE, pHE->next()->next()); pHE->opposite()->facet()->Issub = true; pHE = pMesh->split_facet(pHE, pHE->next()->next()); pHE->opposite()->facet()->Issub = true; pHE->facet()->Issub = true; } } }