本文整理汇总了C++中Point_set::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ Point_set::begin方法的具体用法?C++ Point_set::begin怎么用?C++ Point_set::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Point_set
的用法示例。
在下文中一共展示了Point_set::begin方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: compute_normals
void compute_normals (Point_set& points, unsigned int neighbors)
{
CGAL::jet_estimate_normals<Concurrency_tag>(points.begin(), points.end(),
CGAL::make_normal_of_point_with_normal_pmap(Point_set::value_type()),
2 * neighbors);
points.erase (CGAL::mst_orient_normals (points.begin(), points.end(),
CGAL::make_normal_of_point_with_normal_pmap(Point_set::value_type()),
2 * neighbors),
points.end ());
}
示例2: advancing_front
void advancing_front (const Point_set& points, Scene_polyhedron_item* new_item, double size)
{
Polyhedron& P = * const_cast<Polyhedron*>(new_item->polyhedron());
Radius filter(10 * size);
CGAL::advancing_front_surface_reconstruction (points.begin (), points.end (), P, filter);
}
示例3: advancing_front
void advancing_front (const Point_set& points, Scene_polyhedron_item* new_item, double size,
double radius_ratio_bound = 5., double beta = 0.52)
{
Polyhedron& P = * const_cast<Polyhedron*>(new_item->polyhedron());
Radius filter (size);
CGAL::advancing_front_surface_reconstruction (points.begin (), points.end (), P, filter,
radius_ratio_bound, beta);
}
示例4: print_point_set
void print_point_set (const Point_set& point_set)
{
std::cerr << "Content of point set:" << std::endl;
for (Point_set::const_iterator it = point_set.begin();
it != point_set.end(); ++ it)
std::cerr << "* Point " << *it
<< ": " << point_set.point(*it) // or point_set[it]
<< " with normal " << point_set.normal(*it)
<< std::endl;
}
示例5: compute_normals
void compute_normals (Point_set& points, unsigned int neighbors)
{
CGAL::jet_estimate_normals<Concurrency_tag>(points.begin_or_selection_begin(), points.end(),
points.point_map(),
points.normal_map(),
2 * neighbors);
points.set_first_selected (CGAL::mst_orient_normals (points.begin(), points.end(),
points.point_map(),
points.normal_map(),
2 * neighbors));
points.delete_selection();
}
示例6: scale_space
void scale_space (const Point_set& points, ItemsInserter items,
unsigned int scale, bool generate_smooth = false,
bool separate_shells = false, bool force_manifold = true,
unsigned int samples = 300, unsigned int iterations = 4)
{
ScaleSpace reconstruct (scale, samples);
reconstruct.reconstruct_surface(points.begin (), points.end (), iterations,
separate_shells, force_manifold);
for( unsigned int sh = 0; sh < reconstruct.number_of_shells(); ++sh )
{
Scene_polygon_soup_item* new_item
= new Scene_polygon_soup_item ();
new_item->setColor(Qt::magenta);
new_item->setRenderingMode(FlatPlusEdges);
new_item->init_polygon_soup(points.size(), reconstruct.number_of_triangles ());
Scene_polygon_soup_item* smooth_item = NULL;
if (generate_smooth)
{
smooth_item = new Scene_polygon_soup_item ();
smooth_item->setColor(Qt::magenta);
smooth_item->setRenderingMode(FlatPlusEdges);
smooth_item->init_polygon_soup(points.size(), reconstruct.number_of_triangles ());
}
std::map<unsigned int, unsigned int> map_i2i;
unsigned int current_index = 0;
for (ScaleSpace::Triple_iterator it = reconstruct.shell_begin (sh);
it != reconstruct.shell_end (sh); ++ it)
{
for (unsigned int ind = 0; ind < 3; ++ ind)
{
if (map_i2i.find ((*it)[ind]) == map_i2i.end ())
{
map_i2i.insert (std::make_pair ((*it)[ind], current_index ++));
Point p = points[(*it)[ind]].position();
new_item->new_vertex (p.x (), p.y (), p.z ());
if (generate_smooth)
{
p = *(reconstruct.points_begin() + (*it)[ind]);
smooth_item->new_vertex (p.x (), p.y (), p.z ());
}
}
}
new_item->new_triangle( map_i2i[(*it)[0]],
map_i2i[(*it)[1]],
map_i2i[(*it)[2]] );
if (generate_smooth)
smooth_item->new_triangle( map_i2i[(*it)[0]],
map_i2i[(*it)[1]],
map_i2i[(*it)[2]] );
}
*(items ++) = new_item;
if (generate_smooth)
*(items ++) = smooth_item;
}
if (force_manifold)
{
std::ptrdiff_t num = std::distance( reconstruct.garbage_begin( ),
reconstruct.garbage_end( ) );
Scene_polygon_soup_item* new_item
= new Scene_polygon_soup_item ();
new_item->setColor(Qt::blue);
new_item->setRenderingMode(FlatPlusEdges);
new_item->init_polygon_soup(points.size(), num);
Scene_polygon_soup_item* smooth_item = NULL;
if (generate_smooth)
{
smooth_item = new Scene_polygon_soup_item ();
smooth_item->setColor(Qt::blue);
smooth_item->setRenderingMode(FlatPlusEdges);
smooth_item->init_polygon_soup(points.size(), num);
}
std::map<unsigned int, unsigned int> map_i2i;
unsigned int current_index = 0;
for (ScaleSpace::Triple_iterator it=reconstruct.garbage_begin(),
end=reconstruct.garbage_end();it!=end;++it)
{
for (unsigned int ind = 0; ind < 3; ++ ind)
{
if (map_i2i.find ((*it)[ind]) == map_i2i.end ())
{
map_i2i.insert (std::make_pair ((*it)[ind], current_index ++));
Point p = points[(*it)[ind]].position();
new_item->new_vertex (p.x (), p.y (), p.z ());
if (generate_smooth)
{
p = *(reconstruct.points_begin() + (*it)[ind]);
smooth_item->new_vertex (p.x (), p.y (), p.z ());
//.........这里部分代码省略.........
示例7: smooth_point_set
void smooth_point_set (Point_set& points, unsigned int scale)
{
CGAL::jet_smooth_point_set<Concurrency_tag>(points.begin(), points.end(),
scale);
}
示例8: simplify_point_set
void simplify_point_set (Point_set& points, double size)
{
points.erase (CGAL::grid_simplify_point_set (points.begin (), points.end (), size),
points.end ());
}
示例9: scale_of_noise
unsigned int scale_of_noise (const Point_set& points, double& size)
{
Tree tree(points.begin(), points.end());
double ratio_kept = (points.size() < 1000)
? 1. : 1000. / (points.size());
std::vector<Point> subset;
for (std::size_t i = 0; i < points.size (); ++ i)
if (rand() / (double)RAND_MAX < ratio_kept)
subset.push_back (points[i]);
std::vector<unsigned int> scales;
generate_scales (std::back_inserter (scales));
std::vector<unsigned int> chosen;
for (std::size_t i = 0; i < subset.size (); ++ i)
{
Neighbor_search search(tree, subset[i],scales.back());
double current = 0.;
unsigned int nb = 0;
std::size_t index = 0;
double minimum = (std::numeric_limits<double>::max)();
unsigned int c = 0;
for (Search_iterator search_iterator = search.begin();
search_iterator != search.end (); ++ search_iterator, ++ nb)
{
current += search_iterator->second;
if (nb + 1 == scales[index])
{
double score = std::sqrt (current / scales[index])
/ std::pow (scales[index], 0.375); // NB ^ (5/12)
if (score < minimum)
{
minimum = score;
c = scales[index];
}
++ index;
if (index == scales.size ())
break;
}
}
chosen.push_back (c);
}
std::sort (chosen.begin (), chosen.end());
unsigned int noise_scale = chosen[chosen.size() / 2];
size = 0.;
for (std::size_t i = 0; i < subset.size (); ++ i)
{
Neighbor_search search(tree, subset[i], noise_scale);
size += std::sqrt ((-- search.end())->second);
}
size /= subset.size();
return noise_scale;
}
示例10: scale_of_anisotropy
unsigned int scale_of_anisotropy (const Point_set& points, double& size)
{
Tree tree(points.begin(), points.end());
double ratio_kept = (points.size() < 1000)
? 1. : 1000. / (points.size());
std::vector<Point> subset;
for (std::size_t i = 0; i < points.size (); ++ i)
if (rand() / (double)RAND_MAX < ratio_kept)
subset.push_back (points[i]);
std::vector<unsigned int> scales;
generate_scales (std::back_inserter (scales));
std::vector<unsigned int> chosen;
for (std::size_t i = 0; i < subset.size (); ++ i)
{
Neighbor_search search(tree, subset[i],scales.back());
double current = 0.;
unsigned int nb = 0;
std::size_t index = 0;
double maximum = 0.;
unsigned int c = 0;
for (Search_iterator search_iterator = search.begin();
search_iterator != search.end (); ++ search_iterator, ++ nb)
{
current += search_iterator->second;
if (nb + 1 == scales[index])
{
double score = std::sqrt (current / scales[index])
/ std::pow (scales[index], 0.75); // NB ^ (3/4)
if (score > maximum)
{
maximum = score;
c = scales[index];
}
++ index;
if (index == scales.size ())
break;
}
}
chosen.push_back (c);
}
double mean = 0.;
for (std::size_t i = 0; i < chosen.size(); ++ i)
mean += chosen[i];
mean /= chosen.size();
unsigned int aniso_scale = static_cast<unsigned int>(mean);
size = 0.;
for (std::size_t i = 0; i < subset.size (); ++ i)
{
Neighbor_search search(tree, subset[i], aniso_scale);
size += std::sqrt ((-- search.end())->second);
}
size /= subset.size();
return aniso_scale;
}
示例11: simplify_point_set
void simplify_point_set (Point_set& points, double size)
{
points.set_first_selected (CGAL::grid_simplify_point_set (points.begin (), points.end (), points.point_map(), size));
points.delete_selection();
}