本文整理汇总了C++中Polyhedron::join_facet方法的典型用法代码示例。如果您正苦于以下问题:C++ Polyhedron::join_facet方法的具体用法?C++ Polyhedron::join_facet怎么用?C++ Polyhedron::join_facet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Polyhedron
的用法示例。
在下文中一共展示了Polyhedron::join_facet方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: remove_edge
static void remove_edge(Polyhedron& p, typename
Polyhedron::Halfedge_handle& edge)
{
// // FIXME: Is it possible to do this in a smarter way than a linear scan
// for (csg::Polyhedron_3::Facet_iterator facet = p.facets_begin();
// facet != p.facets_end(); facet++)
// {
// if ( facet_is_degenerate<csg::Polyhedron_3>(facet, threshold) )
// {
// //print_facet(facet);
// // Find a short edge
// csg::Polyhedron_3::Halfedge::Halfedge_handle shortest_edge = facet->facet_begin();
// csg::Polyhedron_3::Facet::Halfedge_around_facet_circulator current_edge = facet->facet_begin();
// double min_length = get_edge_length(current_edge);
// for (int i = 0; i < 2; i++)
// {
// current_edge++;
// if (get_edge_length(current_edge) < min_length)
// {
// shortest_edge = current_edge;
// min_length = get_edge_length(current_edge);
// }
// }
// Join small triangles with neighbor facets
edge = p.join_facet(edge->next());
p.join_facet(edge->opposite()->prev());
// The joined facets are now quads
// Join the two close vertices
p.join_vertex(edge);
}
示例2: flip_edge
void flip_edge( Polyhedron& P, Halfedge_handle e) {
if ( e->is_border_edge())
return;
Halfedge_handle h = e->next();
P.join_facet( e);
P.split_facet( h, h->next()->next());
}
示例3: mergeCoplanar
void mergeCoplanar(Polyhedron& p,bool step2) {
int facetsBefore = p.size_of_facets();
p.normalize_border();
if(!p.size_of_border_halfedges()) {
// Calculate normals only once in advace! so all tris should be coplanar with the original
std::transform( p.facets_begin(), p.facets_end(),p.planes_begin(),Plane_equation()); // Calculate plane equations (only works on tri<- = bs)=true
bool coplanarFound = true;
std::vector<Polyhedron::Halfedge_handle> skipHEs;
while (coplanarFound) {
coplanarFound = false; // Set coplanarFound false
int percCount = 1;
for (Polyhedron::Halfedge_iterator hit = p.halfedges_begin(); hit != p.halfedges_end(); ++hit,++percCount){ // Loop through all halfedges
if (is_coplanar(hit,true)){ // If coplanar and equals semantics
Polyhedron::Halfedge_handle removeMe = hit;
while (CGAL::circulator_size(removeMe->vertex_begin()) < 3) // Mover handle to beginning of linestring
removeMe = removeMe->next();
bool jcnh = false;
if (!step2) jcnh = joinCreatesNoHole (hit);
else jcnh = joinCreatesNoHole2(hit);
if (jcnh){ // If no holes will be created
std::cout << "\rFacets before/after: "<<facetsBefore<<" -> "<< p.size_of_facets()<<". ("<<100*percCount/p.size_of_halfedges()<<"%)";
while (CGAL::circulator_size(removeMe->opposite()->vertex_begin()) < 3) // Join vertexes until at the other end of linestring
if (removeMe->facet_degree()>3 && removeMe->opposite()->facet_degree()>3)
removeMe = (p.join_vertex(removeMe))->next()->opposite();
else // One of the faces turned into a triangle ->remove center vertex
break;
if (CGAL::circulator_size(removeMe->opposite()->vertex_begin()) < 3) // Remove remained of the border
p.erase_center_vertex(removeMe->opposite()); // if two segments remain remove center point
else
p.join_facet(removeMe); // if one segment remains join facets
coplanarFound = true;
break;
} else { // simplify border, but how to do this safely? not optimal solution implemented. Should do: add inward offseted point of intersection etc.
if (std::find(skipHEs.begin(), skipHEs.end(),hit)!=skipHEs.end()) { // Skip if hit in skipList
while (CGAL::circulator_size(removeMe->opposite()->vertex_begin()) < 3) { // Join vertexes until at the other end of linestring
if (removeMe->facet_degree()>3 && removeMe->opposite()->facet_degree()>3)
if (triDoesNotIntersectFacet(removeMe)) // if tri reMe,reME->prev does not intersect left or right facet
removeMe = (p.join_vertex(removeMe))->next()->opposite(); // remove removeME
else {
skipHEs.push_back(removeMe);
skipHEs.push_back(removeMe->opposite());
removeMe = removeMe->prev(); // move removeME one halfedge back
}
else break; // stop if only a triangle remains or at other end
}
skipHEs.push_back(removeMe);
skipHEs.push_back(removeMe->opposite());
} } } } } }
//if (!step2) mergeCoplanar(p,true);
//else
std::cout << "\rFacets before/after: "<<facetsBefore<<" -> "<< p.size_of_facets()<<". (100%)"<<std::endl;
}
示例4:
static void
remove_triangle(Polyhedron& p, typename Polyhedron::Facet_handle facet)
{
dolfin_assert(facet->is_triangle());
// cout << "Removing triangle" << endl;
// print_facet<Polyhedron>(facet);
// Find the longest edge
typename Polyhedron::Halfedge_handle edge
= get_longest_edge<Polyhedron>(facet);
// cout << "Longest edge" << endl;
// print_halfedge<Polyhedron>(edge);
// cout << "Opposite triangle" << endl;
// print_facet<Polyhedron>(edge->opposite()->facet());
edge = p.join_facet(edge);
// cout << "Edge after join: " << endl;
// print_halfedge<Polyhedron>(edge);
// cout << "Facet after join" << endl;
// print_facet<Polyhedron>(edge->facet());
typename Polyhedron::Point_3 new_center
= facet_midpoint<Polyhedron>(edge->facet());
edge = p.create_center_vertex(edge);
edge->vertex()->point() = new_center;
// std::cout << "Center vertex: " << edge->vertex()->point() << std::endl;
// for (std::size_t i=0; i < 4; i++)
// {
// print_facet<Polyhedron>(edge->facet());
// edge = edge->next()->opposite();
// }
}
示例5: subdivide_flip_edge
void geometryUtils::subdivide_flip_edge(Polyhedron& P, Halfedge_handle e) {
Halfedge_handle h = e->next();
P.join_facet(e);
P.split_facet(h, h->next()->next());
}