本文整理汇总了C++中PolyhedronPtr::is_pure_triangle方法的典型用法代码示例。如果您正苦于以下问题:C++ PolyhedronPtr::is_pure_triangle方法的具体用法?C++ PolyhedronPtr::is_pure_triangle怎么用?C++ PolyhedronPtr::is_pure_triangle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PolyhedronPtr
的用法示例。
在下文中一共展示了PolyhedronPtr::is_pure_triangle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SubdiviserPolyedre
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;
}
}
}