Update examples

This commit is contained in:
Simon Giraudot 2016-09-28 10:50:22 +02:00
parent d4ab17634e
commit d097870ecd
5 changed files with 29357 additions and 13 deletions

View File

@ -47,6 +47,7 @@ create_single_source_cgal_program( "point_set.cpp" )
create_single_source_cgal_program( "point_set_property.cpp" )
create_single_source_cgal_program( "point_set_read_xyz.cpp" )
create_single_source_cgal_program( "point_set_read_ply.cpp" )
create_single_source_cgal_program( "point_set_advanced.cpp" )
find_package(Eigen3 3.1.0) #(requires 3.1.0 or greater)
if (NOT EIGEN3_FOUND)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,33 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Point_set_3.h>
#include <CGAL/IO/read_off_points.h>
#include <fstream>
#include <limits>
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
typedef Kernel::FT FT;
typedef Kernel::Point_3 Point;
typedef Kernel::Vector_3 Vector;
typedef CGAL::Point_set_3<Point> Point_set;
int main (int argc, char** argv)
{
std::ifstream f (argc > 1 ? argv[1] : "data/camel.off");
Point_set point_set;
point_set.add_normal_map();
// Reading input in OFF format
if (!f || !CGAL::read_off_points_and_normals
(f,
point_set.index_back_inserter(), // OutputIterator
point_set.point_push_map(),
point_set.normal_push_map()))
{
std::cerr << "Can't read input file " << std::endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}

View File

@ -3,6 +3,7 @@
#include <CGAL/Point_set_3/Point_set_processing_3.h>
#include <CGAL/Point_set_3/IO.h>
#include <CGAL/grid_simplify_point_set.h>
#include <CGAL/point_generators_3.h>
#include <CGAL/Shape_detection_3.h>
@ -14,6 +15,8 @@ typedef Kernel::FT FT;
typedef Kernel::Point_3 Point;
typedef Kernel::Vector_3 Vector;
typedef CGAL::Random_points_on_sphere_3<Point> Point_generator;
typedef CGAL::Point_set_3<Point> Point_set;
typedef CGAL::Shape_detection_3::Efficient_RANSAC_traits
@ -21,23 +24,18 @@ typedef CGAL::Shape_detection_3::Efficient_RANSAC_traits
typedef CGAL::Shape_detection_3::Efficient_RANSAC<Traits> Efficient_ransac;
typedef CGAL::Shape_detection_3::Sphere<Traits> Sphere;
int main (int, char**)
{
Point_set point_set;
// Generate points on a sphere
Point_generator generator(1.);
std::size_t nb_pts = 10000;
point_set.reserve (nb_pts);
for (std::size_t i = 0; i < nb_pts; ++ i)
{
double sintheta = 2 * rand () / (double)RAND_MAX;
double theta = std::asin (sintheta);
double phi = 2 * M_PI * (rand () / (double)RAND_MAX) - M_PI;
Point p (std::cos (theta) * std::cos (phi),
std::cos (theta) * std::sin (phi),
std::sin (theta));
point_set.insert (p);
}
point_set.insert (*(generator ++));
// Add normal property and estimate normal values
CGAL::jet_estimate_normals<CGAL::Sequential_tag> (point_set,

View File

@ -18,11 +18,13 @@ int main (int argc, char** argv)
Point_set point_set;
if (!f || !CGAL::read_ply_point_set (f, point_set))
{
std::cerr << "Can't read input file " << std::endl;
}
// if (!f || !CGAL::read_ply_point_set (f, point_set))
// {
// std::cerr << "Can't read input file " << std::endl;
// }
f >> point_set;
std::cerr << point_set.properties(); // Shows which properties were defined
// Recover "label" property of type int