本文整理汇总了C++中Polyhedron::create_center_vertex方法的典型用法代码示例。如果您正苦于以下问题:C++ Polyhedron::create_center_vertex方法的具体用法?C++ Polyhedron::create_center_vertex怎么用?C++ Polyhedron::create_center_vertex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Polyhedron
的用法示例。
在下文中一共展示了Polyhedron::create_center_vertex方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: subdivide_create_center_vertex
void geometryUtils::subdivide_create_center_vertex(Polyhedron& P, Facet_iterator f) {
Vector_3 vec(0.0, 0.0, 0.0);
std::size_t order = 0;
HF_circulator h = f->facet_begin();
do {
vec = vec + (h->vertex()->point() - CGAL::ORIGIN);
++order;
} while (++h != f->facet_begin());
CGAL_assertion(order >= 3); // guaranteed by definition of polyhedron
Point_3 center = CGAL::ORIGIN + (vec / static_cast<double> (order));
Halfedge_handle new_center = P.create_center_vertex(f->halfedge());
new_center->vertex()->point() = center;
}
示例2:
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();
// }
}