本文整理汇总了C++中Point_set::insert方法的典型用法代码示例。如果您正苦于以下问题:C++ Point_set::insert方法的具体用法?C++ Point_set::insert怎么用?C++ Point_set::insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Point_set
的用法示例。
在下文中一共展示了Point_set::insert方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main (int, char**)
{
Point_set pts;
pts.add_normal_map();
bool map_added = false;
Size_t_map echo_map;
Color_map color_map;
boost::tie (echo_map, map_added) = pts.add_property_map<std::size_t> ("echo");
CGAL_assertion (map_added);
boost::tie (color_map, map_added) = pts.add_property_map<Classification::RGB_Color> ("color");
CGAL_assertion (map_added);
for (std::size_t i = 0; i < 1000; ++ i)
{
Point_set::iterator it
= pts.insert (Point (CGAL::get_default_random().get_double(),
CGAL::get_default_random().get_double(),
CGAL::get_default_random().get_double()),
Vector (CGAL::get_default_random().get_double(),
CGAL::get_default_random().get_double(),
CGAL::get_default_random().get_double()));
echo_map[*it] = std::size_t(CGAL::get_default_random().get_int(0, 4));
color_map[*it] = CGAL::make_array ((unsigned char)(CGAL::get_default_random().get_int(0, 255)),
(unsigned char)(CGAL::get_default_random().get_int(0, 255)),
(unsigned char)(CGAL::get_default_random().get_int(0, 255)));
}
Feature_set features;
Feature_generator generator (features, pts, pts.point_map(),
5, // using 5 scales
pts.normal_map(),
color_map, echo_map);
CGAL_assertion (generator.number_of_scales() == 5);
CGAL_assertion (features.size() == 80);
Label_set labels;
std::vector<int> training_set (pts.size(), -1);
for (std::size_t i = 0; i < 20; ++ i)
{
std::ostringstream oss;
oss << "label_" << i;
Label_handle lh = labels.add(oss.str().c_str());
for (std::size_t j = 0; j < 10; ++ j)
training_set[std::size_t(CGAL::get_default_random().get_int(0, int(training_set.size())))] = int(i);
}
CGAL_assertion (labels.size() == 20);
Classifier classifier (labels, features);
classifier.train<CGAL::Sequential_tag> (training_set, 800);
#ifdef CGAL_LINKED_WITH_TBB
classifier.train<CGAL::Parallel_tag> (training_set, 800);
#endif
std::vector<int> label_indices(pts.size(), -1);
Classification::classify<CGAL::Sequential_tag>
(pts, labels, classifier, label_indices);
Classification::classify_with_local_smoothing<CGAL::Sequential_tag>
(pts, pts.point_map(), labels, classifier,
generator.neighborhood().sphere_neighbor_query(0.01f),
label_indices);
Classification::classify_with_graphcut<CGAL::Sequential_tag>
(pts, pts.point_map(), labels, classifier,
generator.neighborhood().k_neighbor_query(12),
0.2f, 10, label_indices);
#ifdef CGAL_LINKED_WITH_TBB
Classification::classify<CGAL::Sequential_tag>
(pts, labels, classifier, label_indices);
Classification::classify_with_local_smoothing<CGAL::Sequential_tag>
(pts, pts.point_map(), labels, classifier,
generator.neighborhood().sphere_neighbor_query(0.01f),
label_indices);
Classification::classify_with_graphcut<CGAL::Sequential_tag>
(pts, pts.point_map(), labels, classifier,
generator.neighborhood().k_neighbor_query(12),
0.2f, 10, label_indices);
#endif
Classification::Evaluation evaluation (labels, training_set, label_indices);
return EXIT_SUCCESS;
}