本文整理汇总了C++中Facet_iterator::halfedge方法的典型用法代码示例。如果您正苦于以下问题:C++ Facet_iterator::halfedge方法的具体用法?C++ Facet_iterator::halfedge怎么用?C++ Facet_iterator::halfedge使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Facet_iterator
的用法示例。
在下文中一共展示了Facet_iterator::halfedge方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getFacetFromPoint
// Récupère la face de travail du point d'impact
int DegradeAnObject::getFacetFromPoint(Point_3 p, Facet &fs, int index) {
for(Facet_iterator fi = polys[index].facets_begin(); fi != polys[index].facets_end() ; ++fi) {
Point_3 p1 = fi->halfedge()->vertex()->point();
Point_3 p2 = fi->halfedge()->next()->vertex()->point();
Point_3 p3 = fi->halfedge()->next()->next()->vertex()->point();
if(isAPointInATriangle(p, p1, p2, p3)) {
fs = *fi;
return 1;
}
}
return 0;
}
示例2: getFacetsFromPoint
// Warning : only for triangle mesh. NO. QUAD. MESH.
// Récupère les faces correspondantes au point d'impact et retourne leurs nombres.
int DegradeAnObject::getFacetsFromPoint(Point_3 p, std::vector<Facet> &fs, std::vector<int> &index) {
for(int i = 0 ; i < polys.size() ; i++) {
for(Facet_iterator fi = polys[i].facets_begin(); fi != polys[i].facets_end() ; ++fi) {
Point_3 p1 = fi->halfedge()->vertex()->point();
Point_3 p2 = fi->halfedge()->next()->vertex()->point();
Point_3 p3 = fi->halfedge()->next()->next()->vertex()->point();
if(isAPointInATriangle(p, p1, p2, p3)) {
index.push_back(i);
fs.push_back(*fi);
}
}
}
return fs.size();
}
示例3: 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;
}
示例4:
void
Scene_polyhedron_item::compute_normals_and_vertices(void) const
{
positions_facets.resize(0);
positions_lines.resize(0);
positions_feature_lines.resize(0);
normals_flat.resize(0);
normals_gouraud.resize(0);
//Facets
typedef Polyhedron::Traits Kernel;
typedef Kernel::Point_3 Point;
typedef Kernel::Vector_3 Vector;
typedef Polyhedron::Facet_iterator Facet_iterator;
typedef Polyhedron::Halfedge_around_facet_circulator HF_circulator;
Facet_iterator f = poly->facets_begin();
for(f = poly->facets_begin();
f != poly->facets_end();
f++)
{
if (f == boost::graph_traits<Polyhedron>::null_face())
continue;
if(!is_triangle(f->halfedge(),*poly))
{
triangulate_facet(f);
}
else
{
int i=0;
HF_circulator he = f->facet_begin();
HF_circulator end = he;
CGAL_For_all(he,end)
{
// If Flat shading:1 normal per polygon added once per vertex
Vector n = CGAL::Polygon_mesh_processing::compute_face_normal(f, *poly);
normals_flat.push_back(n.x());
normals_flat.push_back(n.y());
normals_flat.push_back(n.z());
//// If Gouraud shading: 1 normal per vertex
n = CGAL::Polygon_mesh_processing::compute_vertex_normal(he->vertex(), *poly);
normals_gouraud.push_back(n.x());
normals_gouraud.push_back(n.y());
normals_gouraud.push_back(n.z());
//position
const Point& p = he->vertex()->point();
positions_facets.push_back(p.x());
positions_facets.push_back(p.y());
positions_facets.push_back(p.z());
positions_facets.push_back(1.0);
i = (i+1) %3;
}
}
}
示例5: get
void
Scene_polyhedron_item::compute_normals_and_vertices(void) const
{
positions_facets.resize(0);
positions_lines.resize(0);
positions_feature_lines.resize(0);
normals_flat.resize(0);
normals_gouraud.resize(0);
number_of_null_length_edges = 0;
number_of_degenerated_faces = 0;
//Facets
typedef Polyhedron::Traits Kernel;
typedef Kernel::Point_3 Point;
typedef Kernel::Vector_3 Vector;
typedef Polyhedron::Facet_iterator Facet_iterator;
typedef Polyhedron::Halfedge_around_facet_circulator HF_circulator;
self_intersect = CGAL::Polygon_mesh_processing::does_self_intersect(*poly);
Facet_iterator f = poly->facets_begin();
for(f = poly->facets_begin();
f != poly->facets_end();
f++)
{
if(!is_triangle(f->halfedge(),*poly))
{
is_triangulated = false;
triangulate_facet(f);
}
else
{
int i=0;
HF_circulator he = f->facet_begin();
HF_circulator end = he;
CGAL_For_all(he,end)
{
// If Flat shading:1 normal per polygon added once per vertex
Vector n = CGAL::Polygon_mesh_processing::compute_face_normal(f, *poly);
normals_flat.push_back(n.x());
normals_flat.push_back(n.y());
normals_flat.push_back(n.z());
//// If Gouraud shading: 1 normal per vertex
n = CGAL::Polygon_mesh_processing::compute_vertex_normal(he->vertex(), *poly);
normals_gouraud.push_back(n.x());
normals_gouraud.push_back(n.y());
normals_gouraud.push_back(n.z());
//position
const Point& p = he->vertex()->point();
positions_facets.push_back(p.x());
positions_facets.push_back(p.y());
positions_facets.push_back(p.z());
positions_facets.push_back(1.0);
i = (i+1) %3;
}
if(CGAL::Polygon_mesh_processing::is_degenerated(f,
*poly,
get(CGAL::vertex_point, *poly),
poly->traits()))
number_of_degenerated_faces++;
}
}