mirror of https://github.com/CGAL/cgal
Remove undocumented CGAL::Point_with_normal_3 from examples
This commit is contained in:
parent
251bced65e
commit
3544d43898
|
|
@ -3,7 +3,6 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||||
#include <CGAL/Point_with_normal_3.h>
|
|
||||||
#include <CGAL/Shape_detection_3.h>
|
#include <CGAL/Shape_detection_3.h>
|
||||||
#include <CGAL/structure_point_set.h>
|
#include <CGAL/structure_point_set.h>
|
||||||
#include <CGAL/Delaunay_triangulation_3.h>
|
#include <CGAL/Delaunay_triangulation_3.h>
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||||
#include <CGAL/IO/read_xyz_points.h>
|
#include <CGAL/IO/read_xyz_points.h>
|
||||||
#include <CGAL/IO/write_xyz_points.h>
|
#include <CGAL/IO/write_xyz_points.h>
|
||||||
#include <CGAL/Point_with_normal_3.h>
|
|
||||||
#include <CGAL/property_map.h>
|
#include <CGAL/property_map.h>
|
||||||
|
|
||||||
#include <CGAL/Shape_detection_3.h>
|
#include <CGAL/Shape_detection_3.h>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||||
#include <CGAL/IO/read_xyz_points.h>
|
#include <CGAL/IO/read_xyz_points.h>
|
||||||
#include <CGAL/Point_with_normal_3.h>
|
|
||||||
#include <CGAL/property_map.h>
|
#include <CGAL/property_map.h>
|
||||||
|
|
||||||
#include <CGAL/Shape_detection_3.h>
|
#include <CGAL/Shape_detection_3.h>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||||
#include <CGAL/IO/read_xyz_points.h>
|
#include <CGAL/IO/read_xyz_points.h>
|
||||||
#include <CGAL/Point_with_normal_3.h>
|
|
||||||
#include <CGAL/property_map.h>
|
#include <CGAL/property_map.h>
|
||||||
|
|
||||||
#include <CGAL/Shape_detection_3.h>
|
#include <CGAL/Shape_detection_3.h>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||||
#include <CGAL/IO/read_xyz_points.h>
|
#include <CGAL/IO/read_xyz_points.h>
|
||||||
#include <CGAL/Point_with_normal_3.h>
|
|
||||||
#include <CGAL/property_map.h>
|
#include <CGAL/property_map.h>
|
||||||
#include <CGAL/Timer.h>
|
#include <CGAL/Timer.h>
|
||||||
#include <CGAL/number_utils.h>
|
#include <CGAL/number_utils.h>
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@
|
||||||
|
|
||||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||||
#include <CGAL/IO/read_xyz_points.h>
|
#include <CGAL/IO/read_xyz_points.h>
|
||||||
#include <CGAL/Point_with_normal_3.h>
|
|
||||||
#include <CGAL/property_map.h>
|
#include <CGAL/property_map.h>
|
||||||
|
|
||||||
#include <CGAL/Shape_detection_3.h>
|
#include <CGAL/Shape_detection_3.h>
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@
|
||||||
|
|
||||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||||
#include <CGAL/IO/read_xyz_points.h>
|
#include <CGAL/IO/read_xyz_points.h>
|
||||||
#include <CGAL/Point_with_normal_3.h>
|
|
||||||
#include <CGAL/property_map.h>
|
#include <CGAL/property_map.h>
|
||||||
|
|
||||||
#include <CGAL/Shape_detection_3.h>
|
#include <CGAL/Shape_detection_3.h>
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@
|
||||||
|
|
||||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||||
#include <CGAL/IO/read_xyz_points.h>
|
#include <CGAL/IO/read_xyz_points.h>
|
||||||
#include <CGAL/Point_with_normal_3.h>
|
|
||||||
#include <CGAL/property_map.h>
|
#include <CGAL/property_map.h>
|
||||||
|
|
||||||
#include <CGAL/Shape_detection_3.h>
|
#include <CGAL/Shape_detection_3.h>
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@
|
||||||
#include <CGAL/Poisson_implicit_surface_3.h>
|
#include <CGAL/Poisson_implicit_surface_3.h>
|
||||||
#include <CGAL/IO/facets_in_complex_2_to_triangle_mesh.h>
|
#include <CGAL/IO/facets_in_complex_2_to_triangle_mesh.h>
|
||||||
#include <CGAL/Poisson_reconstruction_function.h>
|
#include <CGAL/Poisson_reconstruction_function.h>
|
||||||
#include <CGAL/Point_with_normal_3.h>
|
|
||||||
#include <CGAL/IO/read_xyz_points.h>
|
#include <CGAL/IO/read_xyz_points.h>
|
||||||
#include <CGAL/compute_average_spacing.h>
|
#include <CGAL/compute_average_spacing.h>
|
||||||
#include <CGAL/Polygon_mesh_processing/compute_normal.h>
|
#include <CGAL/Polygon_mesh_processing/compute_normal.h>
|
||||||
|
|
@ -43,7 +42,7 @@ typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
|
||||||
typedef Kernel::FT FT;
|
typedef Kernel::FT FT;
|
||||||
typedef Kernel::Point_3 Point;
|
typedef Kernel::Point_3 Point;
|
||||||
typedef Kernel::Vector_3 Vector;
|
typedef Kernel::Vector_3 Vector;
|
||||||
typedef CGAL::Point_with_normal_3<Kernel> Point_with_normal;
|
typedef std::pair<Point, Vector> Point_with_normal;
|
||||||
typedef Kernel::Sphere_3 Sphere;
|
typedef Kernel::Sphere_3 Sphere;
|
||||||
typedef std::deque<Point_with_normal> PointList;
|
typedef std::deque<Point_with_normal> PointList;
|
||||||
|
|
||||||
|
|
@ -180,7 +179,7 @@ int main(int argc, char * argv[])
|
||||||
vertices(input_mesh)){
|
vertices(input_mesh)){
|
||||||
const Point& p = v->point();
|
const Point& p = v->point();
|
||||||
Vector n = CGAL::Polygon_mesh_processing::compute_vertex_normal(v,input_mesh);
|
Vector n = CGAL::Polygon_mesh_processing::compute_vertex_normal(v,input_mesh);
|
||||||
points.push_back(Point_with_normal(p,n));
|
points.push_back(std::make_pair(p,n));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// If XYZ file format
|
// If XYZ file format
|
||||||
|
|
@ -190,14 +189,14 @@ int main(int argc, char * argv[])
|
||||||
// Reads the point set file in points[].
|
// Reads the point set file in points[].
|
||||||
// Note: read_xyz_points_and_normals() requires an iterator over points
|
// Note: read_xyz_points_and_normals() requires an iterator over points
|
||||||
// + property maps to access each point's position and normal.
|
// + property maps to access each point's position and normal.
|
||||||
// The position property map can be omitted here as we use iterators over Point_3 elements.
|
|
||||||
std::ifstream stream(input_filename.c_str());
|
std::ifstream stream(input_filename.c_str());
|
||||||
if (!stream ||
|
if (!stream ||
|
||||||
!CGAL::read_xyz_points(
|
!CGAL::read_xyz_points(
|
||||||
stream,
|
stream,
|
||||||
std::back_inserter(points),
|
std::back_inserter(points),
|
||||||
CGAL::parameters::normal_map
|
CGAL::parameters::point_map
|
||||||
(CGAL::make_normal_of_point_with_normal_map(PointList::value_type()))))
|
(CGAL::make_first_of_pair_property_map(Point_with_normal())).
|
||||||
|
normal_map (CGAL::make_second_of_pair_property_map(Point_with_normal()))))
|
||||||
{
|
{
|
||||||
std::cerr << "Error: cannot read file " << input_filename << std::endl;
|
std::cerr << "Error: cannot read file " << input_filename << std::endl;
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|
@ -226,7 +225,7 @@ int main(int argc, char * argv[])
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool points_have_normals = (points.begin()->normal() != CGAL::NULL_VECTOR);
|
bool points_have_normals = (points.begin()->second != CGAL::NULL_VECTOR);
|
||||||
if ( ! points_have_normals )
|
if ( ! points_have_normals )
|
||||||
{
|
{
|
||||||
std::cerr << "Input point set not supported: this reconstruction method requires oriented normals" << std::endl;
|
std::cerr << "Input point set not supported: this reconstruction method requires oriented normals" << std::endl;
|
||||||
|
|
@ -249,11 +248,10 @@ int main(int argc, char * argv[])
|
||||||
// Creates implicit function from the read points.
|
// Creates implicit function from the read points.
|
||||||
// Note: this method requires an iterator over points
|
// Note: this method requires an iterator over points
|
||||||
// + property maps to access each point's position and normal.
|
// + property maps to access each point's position and normal.
|
||||||
// The position property map can be omitted here as we use iterators over Point_3 elements.
|
|
||||||
Poisson_reconstruction_function function(
|
Poisson_reconstruction_function function(
|
||||||
points.begin(), points.end(),
|
points.begin(), points.end(),
|
||||||
CGAL::make_identity_property_map(PointList::value_type()),
|
CGAL::make_first_of_pair_property_map(Point_with_normal()),
|
||||||
CGAL::make_normal_of_point_with_normal_map(PointList::value_type()),
|
CGAL::make_second_of_pair_property_map(Point_with_normal()),
|
||||||
visitor);
|
visitor);
|
||||||
|
|
||||||
#ifdef CGAL_EIGEN3_ENABLED
|
#ifdef CGAL_EIGEN3_ENABLED
|
||||||
|
|
@ -295,7 +293,9 @@ int main(int argc, char * argv[])
|
||||||
std::cerr << "Surface meshing...\n";
|
std::cerr << "Surface meshing...\n";
|
||||||
|
|
||||||
// Computes average spacing
|
// Computes average spacing
|
||||||
FT average_spacing = CGAL::compute_average_spacing<CGAL::Sequential_tag>(points, 6 /* knn = 1 ring */);
|
FT average_spacing = CGAL::compute_average_spacing<CGAL::Sequential_tag>
|
||||||
|
(points, 6 /* knn = 1 ring */,
|
||||||
|
CGAL::parameters::point_map (CGAL::make_first_of_pair_property_map(Point_with_normal())));
|
||||||
|
|
||||||
// Gets one point inside the implicit surface
|
// Gets one point inside the implicit surface
|
||||||
Point inner_point = function.get_inner_point();
|
Point inner_point = function.get_inner_point();
|
||||||
|
|
@ -369,7 +369,7 @@ int main(int argc, char * argv[])
|
||||||
double avg_distance = 0;
|
double avg_distance = 0;
|
||||||
for (PointList::const_iterator p=points.begin(); p!=points.end(); p++)
|
for (PointList::const_iterator p=points.begin(); p!=points.end(); p++)
|
||||||
{
|
{
|
||||||
double distance = std::sqrt(tree.squared_distance(*p));
|
double distance = std::sqrt(tree.squared_distance(p->first));
|
||||||
|
|
||||||
max_distance = (std::max)(max_distance, distance);
|
max_distance = (std::max)(max_distance, distance);
|
||||||
avg_distance += distance;
|
avg_distance += distance;
|
||||||
|
|
|
||||||
|
|
@ -6,13 +6,14 @@
|
||||||
#include <CGAL/Implicit_surface_3.h>
|
#include <CGAL/Implicit_surface_3.h>
|
||||||
#include <CGAL/IO/facets_in_complex_2_to_triangle_mesh.h>
|
#include <CGAL/IO/facets_in_complex_2_to_triangle_mesh.h>
|
||||||
#include <CGAL/Poisson_reconstruction_function.h>
|
#include <CGAL/Poisson_reconstruction_function.h>
|
||||||
#include <CGAL/Point_with_normal_3.h>
|
|
||||||
#include <CGAL/property_map.h>
|
#include <CGAL/property_map.h>
|
||||||
#include <CGAL/IO/read_xyz_points.h>
|
#include <CGAL/IO/read_xyz_points.h>
|
||||||
#include <CGAL/compute_average_spacing.h>
|
#include <CGAL/compute_average_spacing.h>
|
||||||
|
|
||||||
#include <CGAL/Polygon_mesh_processing/distance.h>
|
#include <CGAL/Polygon_mesh_processing/distance.h>
|
||||||
|
|
||||||
|
#include <boost/iterator/transform_iterator.hpp>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
|
|
@ -20,7 +21,10 @@
|
||||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
|
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
|
||||||
typedef Kernel::FT FT;
|
typedef Kernel::FT FT;
|
||||||
typedef Kernel::Point_3 Point;
|
typedef Kernel::Point_3 Point;
|
||||||
typedef CGAL::Point_with_normal_3<Kernel> Point_with_normal;
|
typedef Kernel::Vector_3 Vector;
|
||||||
|
typedef std::pair<Point, Vector> Point_with_normal;
|
||||||
|
typedef CGAL::First_of_pair_property_map<Point_with_normal> Point_map;
|
||||||
|
typedef CGAL::Second_of_pair_property_map<Point_with_normal> Normal_map;
|
||||||
typedef Kernel::Sphere_3 Sphere;
|
typedef Kernel::Sphere_3 Sphere;
|
||||||
typedef std::vector<Point_with_normal> PointList;
|
typedef std::vector<Point_with_normal> PointList;
|
||||||
typedef CGAL::Polyhedron_3<Kernel> Polyhedron;
|
typedef CGAL::Polyhedron_3<Kernel> Polyhedron;
|
||||||
|
|
@ -39,14 +43,14 @@ int main(void)
|
||||||
// Reads the point set file in points[].
|
// Reads the point set file in points[].
|
||||||
// Note: read_xyz_points_and_normals() requires an iterator over points
|
// Note: read_xyz_points_and_normals() requires an iterator over points
|
||||||
// + property maps to access each point's position and normal.
|
// + property maps to access each point's position and normal.
|
||||||
// The position property map can be omitted here as we use iterators over Point_3 elements.
|
|
||||||
PointList points;
|
PointList points;
|
||||||
std::ifstream stream("data/kitten.xyz");
|
std::ifstream stream("data/kitten.xyz");
|
||||||
if (!stream ||
|
if (!stream ||
|
||||||
!CGAL::read_xyz_points(
|
!CGAL::read_xyz_points(
|
||||||
stream,
|
stream,
|
||||||
std::back_inserter(points),
|
std::back_inserter(points),
|
||||||
CGAL::parameters::normal_map(CGAL::make_normal_of_point_with_normal_map(PointList::value_type()))))
|
CGAL::parameters::point_map (Point_map()).
|
||||||
|
normal_map (Normal_map())))
|
||||||
{
|
{
|
||||||
std::cerr << "Error: cannot read file data/kitten.xyz" << std::endl;
|
std::cerr << "Error: cannot read file data/kitten.xyz" << std::endl;
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|
@ -56,9 +60,7 @@ int main(void)
|
||||||
|
|
||||||
// Note: this method requires an iterator over points
|
// Note: this method requires an iterator over points
|
||||||
// + property maps to access each point's position and normal.
|
// + property maps to access each point's position and normal.
|
||||||
// The position property map can be omitted here as we use iterators over Point_3 elements.
|
Poisson_reconstruction_function function(points.begin(), points.end(), Point_map(), Normal_map());
|
||||||
Poisson_reconstruction_function function(points.begin(), points.end(),
|
|
||||||
CGAL::make_normal_of_point_with_normal_map(PointList::value_type()) );
|
|
||||||
|
|
||||||
// Computes the Poisson indicator function f()
|
// Computes the Poisson indicator function f()
|
||||||
// at each vertex of the triangulation.
|
// at each vertex of the triangulation.
|
||||||
|
|
@ -66,7 +68,9 @@ int main(void)
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|
||||||
// Computes average spacing
|
// Computes average spacing
|
||||||
FT average_spacing = CGAL::compute_average_spacing<CGAL::Sequential_tag>(points, 6 /* knn = 1 ring */);
|
FT average_spacing = CGAL::compute_average_spacing<CGAL::Sequential_tag>
|
||||||
|
(points, 6 /* knn = 1 ring */,
|
||||||
|
CGAL::parameters::point_map (Point_map()));
|
||||||
|
|
||||||
// Gets one point inside the implicit surface
|
// Gets one point inside the implicit surface
|
||||||
// and computes implicit function bounding sphere radius.
|
// and computes implicit function bounding sphere radius.
|
||||||
|
|
@ -108,8 +112,12 @@ int main(void)
|
||||||
/// [PMP_distance_snippet]
|
/// [PMP_distance_snippet]
|
||||||
// computes the approximation error of the reconstruction
|
// computes the approximation error of the reconstruction
|
||||||
double max_dist =
|
double max_dist =
|
||||||
CGAL::Polygon_mesh_processing::approximate_max_distance_to_point_set(output_mesh,
|
CGAL::Polygon_mesh_processing::approximate_max_distance_to_point_set
|
||||||
points,
|
(output_mesh,
|
||||||
|
CGAL::make_range (boost::make_transform_iterator
|
||||||
|
(points.begin(), CGAL::Property_map_to_unary_function<Point_map>()),
|
||||||
|
boost::make_transform_iterator
|
||||||
|
(points.end(), CGAL::Property_map_to_unary_function<Point_map>())),
|
||||||
4000);
|
4000);
|
||||||
std::cout << "Max distance to point_set: " << max_dist << std::endl;
|
std::cout << "Max distance to point_set: " << max_dist << std::endl;
|
||||||
/// [PMP_distance_snippet]
|
/// [PMP_distance_snippet]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue