mirror of https://github.com/CGAL/cgal
Replace IO functions in examples and fix Surface_mesh read_OFF()
This commit is contained in:
parent
ed03dc0cb8
commit
25c8313859
|
|
@ -6,7 +6,7 @@
|
||||||
#include <CGAL/boost/graph/graph_traits_TriMesh_ArrayKernelT.h>
|
#include <CGAL/boost/graph/graph_traits_TriMesh_ArrayKernelT.h>
|
||||||
#include <CGAL/boost/graph/iterator.h>
|
#include <CGAL/boost/graph/iterator.h>
|
||||||
#include <CGAL/boost/graph/Euler_operations.h>
|
#include <CGAL/boost/graph/Euler_operations.h>
|
||||||
#include <CGAL/boost/graph/IO/OFF.h>
|
#include <CGAL/boost/graph/IO/polygon_mesh_io.h>
|
||||||
#include <CGAL/mesh_segmentation.h>
|
#include <CGAL/mesh_segmentation.h>
|
||||||
#include <CGAL/property_map.h>
|
#include <CGAL/property_map.h>
|
||||||
|
|
||||||
|
|
@ -26,14 +26,15 @@ int main(int argc, char** argv )
|
||||||
Mesh mesh;
|
Mesh mesh;
|
||||||
|
|
||||||
std::vector<vertex_descriptor> V;
|
std::vector<vertex_descriptor> V;
|
||||||
std::ifstream in((argc>1)?argv[1]:"in.off");
|
const char* filename = (argc>1)?argv[1]:"in.off";
|
||||||
CGAL::read_OFF(in, mesh);
|
const char* outname= (argc>2)?argv[2]:"out.off";
|
||||||
|
CGAL::read_polygon_mesh(filename, mesh);
|
||||||
|
|
||||||
for(vertex_descriptor vd : vertices(mesh)){
|
for(vertex_descriptor vd : vertices(mesh)){
|
||||||
for(halfedge_descriptor hd : CGAL::halfedges_around_target(vd,mesh)){
|
for(halfedge_descriptor hd : CGAL::halfedges_around_target(vd,mesh)){
|
||||||
if(! CGAL::is_border(edge(hd,mesh),mesh)){
|
if(! CGAL::is_border(edge(hd,mesh),mesh)){
|
||||||
CGAL::Euler::flip_edge(hd,mesh);
|
CGAL::Euler::flip_edge(hd,mesh);
|
||||||
CGAL::write_OFF((argc>2)?argv[2]:"out.off", mesh);
|
CGAL::write_polygon_mesh(outname, mesh);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#include <CGAL/boost/graph/Face_filtered_graph.h>
|
#include <CGAL/boost/graph/Face_filtered_graph.h>
|
||||||
#include <CGAL/boost/graph/partition.h>
|
#include <CGAL/boost/graph/partition.h>
|
||||||
#include <CGAL/boost/graph/IO/OFF.h>
|
#include <CGAL/boost/graph/IO/polygon_mesh_io.h>
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
@ -13,16 +13,11 @@ typedef CGAL::Surface_mesh<K::Point_3> SM;
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
std::ifstream in((argc>1) ? argv[1] : "data/blobby.off");
|
const char* filename = (argc>1)?argv[1]:"data/blobby.off";
|
||||||
int number_of_parts = (argc>2) ? atoi(argv[2]) : 8;
|
int number_of_parts = (argc>2) ? atoi(argv[2]) : 8;
|
||||||
|
|
||||||
if(!in) {
|
|
||||||
std::cerr << "Error: could not read input file" << std::endl;
|
|
||||||
return EXIT_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
SM sm;
|
SM sm;
|
||||||
CGAL::read_OFF(in, sm);
|
CGAL::read_polygon_mesh(filename, sm);
|
||||||
|
|
||||||
// The vertex <--> partition_id property map
|
// The vertex <--> partition_id property map
|
||||||
typedef SM::Property_map<SM::Vertex_index, std::size_t> Vertex_id_map;
|
typedef SM::Property_map<SM::Vertex_index, std::size_t> Vertex_id_map;
|
||||||
|
|
|
||||||
|
|
@ -14,12 +14,12 @@ typedef CGAL::Point_set_3<Point> Point_set;
|
||||||
|
|
||||||
int main (int argc, char** argv)
|
int main (int argc, char** argv)
|
||||||
{
|
{
|
||||||
std::ifstream f (argc > 1 ? argv[1] : "data/oni.xyz");
|
const char* fname (argc > 1 ? argv[1] : "data/oni.xyz");
|
||||||
|
|
||||||
Point_set point_set;
|
Point_set point_set;
|
||||||
|
|
||||||
// Reading input in XYZ format
|
// Reading input in XYZ format
|
||||||
if (!f || !CGAL::read_XYZ(f, point_set))
|
if (!CGAL::read_point_set(fname, point_set))
|
||||||
{
|
{
|
||||||
std::cerr << "Can't read input file " << std::endl;
|
std::cerr << "Can't read input file " << std::endl;
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||||
|
|
||||||
#include <CGAL/Point_set_3.h>
|
#include <CGAL/Point_set_3.h>
|
||||||
#include <CGAL/Point_set_3/IO.h>
|
#include <CGAL/Point_set_3/point_set_io.h>
|
||||||
#include <CGAL/grid_simplify_point_set.h>
|
#include <CGAL/grid_simplify_point_set.h>
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
@ -36,10 +36,8 @@ int main (int, char**)
|
||||||
point_set.add_normal_map();
|
point_set.add_normal_map();
|
||||||
test (point_set.has_normal_map(), "point set should have normals.");
|
test (point_set.has_normal_map(), "point set should have normals.");
|
||||||
|
|
||||||
std::ifstream f ("data/oni.pwn");
|
const char* fname ("data/oni.pwn");
|
||||||
CGAL::read_XYZ(f, point_set);
|
CGAL::read_point_set(fname, point_set);
|
||||||
|
|
||||||
f.close ();
|
|
||||||
|
|
||||||
Point_set::iterator
|
Point_set::iterator
|
||||||
first_to_remove = CGAL::grid_simplify_point_set (point_set,
|
first_to_remove = CGAL::grid_simplify_point_set (point_set,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||||
#include <CGAL/compute_average_spacing.h>
|
#include <CGAL/compute_average_spacing.h>
|
||||||
#include <CGAL/IO/read_xyz_points.h>
|
#include <CGAL/IO/read_points.h>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
@ -26,10 +26,8 @@ int main(int argc, char*argv[])
|
||||||
// we use a property map that accesses the 1st element of the tuple.
|
// we use a property map that accesses the 1st element of the tuple.
|
||||||
|
|
||||||
std::vector<IndexedPointWithColorTuple> points;
|
std::vector<IndexedPointWithColorTuple> points;
|
||||||
std::ifstream stream(fname);
|
if (!CGAL::read_points(
|
||||||
if (!stream ||
|
fname, std::back_inserter(points),
|
||||||
!CGAL::read_XYZ(
|
|
||||||
stream, std::back_inserter(points),
|
|
||||||
CGAL::parameters::point_map(CGAL::Nth_of_tuple_property_map<1,IndexedPointWithColorTuple>())))
|
CGAL::parameters::point_map(CGAL::Nth_of_tuple_property_map<1,IndexedPointWithColorTuple>())))
|
||||||
{
|
{
|
||||||
std::cerr << "Error: cannot read file " << fname << std::endl;
|
std::cerr << "Error: cannot read file " << fname << std::endl;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include <CGAL/Simple_cartesian.h>
|
#include <CGAL/Simple_cartesian.h>
|
||||||
#include <CGAL/property_map.h>
|
#include <CGAL/property_map.h>
|
||||||
#include <CGAL/IO/read_xyz_points.h>
|
#include <CGAL/IO/read_points.h>
|
||||||
#include <CGAL/IO/write_xyz_points.h>
|
#include <CGAL/IO/write_xyz_points.h>
|
||||||
#include <CGAL/bilateral_smooth_point_set.h>
|
#include <CGAL/bilateral_smooth_point_set.h>
|
||||||
#include <CGAL/tags.h>
|
#include <CGAL/tags.h>
|
||||||
|
|
@ -26,9 +26,7 @@ int main(int argc, char*argv[])
|
||||||
|
|
||||||
// Reads a .xyz point set file in points[] * with normals *.
|
// Reads a .xyz point set file in points[] * with normals *.
|
||||||
std::vector<PointVectorPair> points;
|
std::vector<PointVectorPair> points;
|
||||||
std::ifstream stream(input_filename);
|
if (!CGAL::read_points(input_filename,
|
||||||
if (!stream ||
|
|
||||||
!CGAL::read_XYZ(stream,
|
|
||||||
std::back_inserter(points),
|
std::back_inserter(points),
|
||||||
CGAL::parameters::point_map(CGAL::First_of_pair_property_map<PointVectorPair>()).
|
CGAL::parameters::point_map(CGAL::First_of_pair_property_map<PointVectorPair>()).
|
||||||
normal_map(CGAL::Second_of_pair_property_map<PointVectorPair>())))
|
normal_map(CGAL::Second_of_pair_property_map<PointVectorPair>())))
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include <CGAL/Simple_cartesian.h>
|
#include <CGAL/Simple_cartesian.h>
|
||||||
#include <CGAL/edge_aware_upsample_point_set.h>
|
#include <CGAL/edge_aware_upsample_point_set.h>
|
||||||
#include <CGAL/IO/read_xyz_points.h>
|
#include <CGAL/IO/read_points.h>
|
||||||
#include <CGAL/IO/write_xyz_points.h>
|
#include <CGAL/IO/write_xyz_points.h>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
@ -25,10 +25,7 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
// Reads a .xyz point set file in points[], *with normals*.
|
// Reads a .xyz point set file in points[], *with normals*.
|
||||||
std::vector<PointVectorPair> points;
|
std::vector<PointVectorPair> points;
|
||||||
std::ifstream stream(input_filename);
|
if (!CGAL::read_points(input_filename,
|
||||||
|
|
||||||
if (!stream ||
|
|
||||||
!CGAL::read_XYZ(stream,
|
|
||||||
std::back_inserter(points),
|
std::back_inserter(points),
|
||||||
CGAL::parameters::point_map(CGAL::First_of_pair_property_map<PointVectorPair>()).
|
CGAL::parameters::point_map(CGAL::First_of_pair_property_map<PointVectorPair>()).
|
||||||
normal_map(CGAL::Second_of_pair_property_map<PointVectorPair>())))
|
normal_map(CGAL::Second_of_pair_property_map<PointVectorPair>())))
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||||
#include <CGAL/vcm_estimate_edges.h>
|
#include <CGAL/vcm_estimate_edges.h>
|
||||||
#include <CGAL/property_map.h>
|
#include <CGAL/property_map.h>
|
||||||
#include <CGAL/IO/read_off_points.h>
|
#include <CGAL/IO/read_points.h>
|
||||||
|
|
||||||
#include <utility> // defines std::pair
|
#include <utility> // defines std::pair
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
@ -22,9 +22,7 @@ typedef std::array<double,6> Covariance;
|
||||||
int main (int , char**) {
|
int main (int , char**) {
|
||||||
// Reads a .xyz point set file in points[].
|
// Reads a .xyz point set file in points[].
|
||||||
std::list<PointVectorPair> points;
|
std::list<PointVectorPair> points;
|
||||||
std::ifstream stream("data/fandisk.off");
|
if (!CGAL::read_points("data/fandisk.off",
|
||||||
if (!stream ||
|
|
||||||
!CGAL::read_OFF(stream,
|
|
||||||
std::back_inserter(points),
|
std::back_inserter(points),
|
||||||
CGAL::parameters::point_map(CGAL::First_of_pair_property_map<PointVectorPair>())))
|
CGAL::parameters::point_map(CGAL::First_of_pair_property_map<PointVectorPair>())))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||||
#include <CGAL/grid_simplify_point_set.h>
|
#include <CGAL/grid_simplify_point_set.h>
|
||||||
#include <CGAL/IO/read_xyz_points.h>
|
#include <CGAL/IO/read_points.h>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
@ -14,9 +14,7 @@ int main(int argc, char*argv[])
|
||||||
// Reads a .xyz point set file in points[].
|
// Reads a .xyz point set file in points[].
|
||||||
std::vector<Point> points;
|
std::vector<Point> points;
|
||||||
const char* fname = (argc>1)?argv[1]:"data/oni.xyz";
|
const char* fname = (argc>1)?argv[1]:"data/oni.xyz";
|
||||||
std::ifstream stream(fname);
|
if (!CGAL::read_points(fname, std::back_inserter(points)))
|
||||||
if (!stream ||
|
|
||||||
!CGAL::read_XYZ(stream, std::back_inserter(points)))
|
|
||||||
{
|
{
|
||||||
std::cerr << "Error: cannot read file " << fname << std::endl;
|
std::cerr << "Error: cannot read file " << fname << std::endl;
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||||
#include <CGAL/hierarchy_simplify_point_set.h>
|
#include <CGAL/hierarchy_simplify_point_set.h>
|
||||||
#include <CGAL/IO/read_xyz_points.h>
|
#include <CGAL/IO/read_points.h>
|
||||||
#include <CGAL/IO/write_xyz_points.h>
|
#include <CGAL/IO/write_xyz_points.h>
|
||||||
#include <CGAL/Timer.h>
|
#include <CGAL/Timer.h>
|
||||||
#include <CGAL/Memory_sizer.h>
|
#include <CGAL/Memory_sizer.h>
|
||||||
|
|
@ -17,9 +17,7 @@ int main(int argc, char*argv[])
|
||||||
// Reads a .xyz point set file in points[].
|
// Reads a .xyz point set file in points[].
|
||||||
std::vector<Point> points;
|
std::vector<Point> points;
|
||||||
const char* fname = (argc>1)?argv[1]:"data/oni.xyz";
|
const char* fname = (argc>1)?argv[1]:"data/oni.xyz";
|
||||||
std::ifstream stream(fname);
|
if (!CGAL::read_points(fname, std::back_inserter(points)))
|
||||||
if (!stream ||
|
|
||||||
!CGAL::read_XYZ(stream, std::back_inserter(points)))
|
|
||||||
{
|
{
|
||||||
std::cerr << "Error: cannot read file " << fname << std::endl;
|
std::cerr << "Error: cannot read file " << fname << std::endl;
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,7 @@
|
||||||
#include <CGAL/vcm_estimate_normals.h>
|
#include <CGAL/vcm_estimate_normals.h>
|
||||||
#include <CGAL/mst_orient_normals.h>
|
#include <CGAL/mst_orient_normals.h>
|
||||||
#include <CGAL/property_map.h>
|
#include <CGAL/property_map.h>
|
||||||
#include <CGAL/IO/read_off_points.h>
|
#include <CGAL/IO/read_points.h>
|
||||||
#include <CGAL/IO/read_xyz_points.h>
|
|
||||||
#include <CGAL/IO/write_xyz_points.h>
|
#include <CGAL/IO/write_xyz_points.h>
|
||||||
|
|
||||||
#include <utility> // defines std::pair
|
#include <utility> // defines std::pair
|
||||||
|
|
@ -252,9 +251,7 @@ int main(int argc, char * argv[])
|
||||||
std::string extension = input_filename.substr(input_filename.find_last_of('.'));
|
std::string extension = input_filename.substr(input_filename.find_last_of('.'));
|
||||||
if (extension == ".off" || extension == ".OFF")
|
if (extension == ".off" || extension == ".OFF")
|
||||||
{
|
{
|
||||||
std::ifstream stream(input_filename.c_str());
|
success = CGAL::read_points(input_filename.c_str(),
|
||||||
success = stream &&
|
|
||||||
CGAL::read_OFF(stream,
|
|
||||||
std::back_inserter(points),
|
std::back_inserter(points),
|
||||||
CGAL::parameters::point_map(CGAL::First_of_pair_property_map<PointVectorPair>()));
|
CGAL::parameters::point_map(CGAL::First_of_pair_property_map<PointVectorPair>()));
|
||||||
}
|
}
|
||||||
|
|
@ -262,9 +259,7 @@ int main(int argc, char * argv[])
|
||||||
else if (extension == ".xyz" || extension == ".XYZ" ||
|
else if (extension == ".xyz" || extension == ".XYZ" ||
|
||||||
extension == ".pwn" || extension == ".PWN")
|
extension == ".pwn" || extension == ".PWN")
|
||||||
{
|
{
|
||||||
std::ifstream stream(input_filename.c_str());
|
success = CGAL::read_points(input_filename.c_str(),
|
||||||
success = stream &&
|
|
||||||
CGAL::read_XYZ(stream,
|
|
||||||
std::back_inserter(points),
|
std::back_inserter(points),
|
||||||
CGAL::parameters::point_map(CGAL::First_of_pair_property_map<PointVectorPair>()));
|
CGAL::parameters::point_map(CGAL::First_of_pair_property_map<PointVectorPair>()));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
#include <CGAL/pca_estimate_normals.h>
|
#include <CGAL/pca_estimate_normals.h>
|
||||||
#include <CGAL/mst_orient_normals.h>
|
#include <CGAL/mst_orient_normals.h>
|
||||||
#include <CGAL/property_map.h>
|
#include <CGAL/property_map.h>
|
||||||
#include <CGAL/IO/read_xyz_points.h>
|
#include <CGAL/IO/read_points.h>
|
||||||
|
|
||||||
#include <utility> // defines std::pair
|
#include <utility> // defines std::pair
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
@ -25,9 +25,7 @@ int main(int argc, char*argv[])
|
||||||
const char* fname = (argc>1)?argv[1]:"data/sphere_1k.xyz";
|
const char* fname = (argc>1)?argv[1]:"data/sphere_1k.xyz";
|
||||||
// Reads a .xyz point set file in points[].
|
// Reads a .xyz point set file in points[].
|
||||||
std::list<PointVectorPair> points;
|
std::list<PointVectorPair> points;
|
||||||
std::ifstream stream(fname);
|
if (!CGAL::read_points(fname,
|
||||||
if (!stream ||
|
|
||||||
!CGAL::read_XYZ(stream,
|
|
||||||
std::back_inserter(points),
|
std::back_inserter(points),
|
||||||
CGAL::parameters::point_map(CGAL::First_of_pair_property_map<PointVectorPair>())))
|
CGAL::parameters::point_map(CGAL::First_of_pair_property_map<PointVectorPair>())))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||||
#include <CGAL/random_simplify_point_set.h>
|
#include <CGAL/random_simplify_point_set.h>
|
||||||
#include <CGAL/IO/read_xyz_points.h>
|
#include <CGAL/IO/read_points.h>
|
||||||
#include <CGAL/IO/write_xyz_points.h>
|
#include <CGAL/IO/write_xyz_points.h>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
@ -16,9 +16,7 @@ int main(int argc, char*argv[])
|
||||||
const char* fname = (argc>1)?argv[1]:"data/oni.xyz";
|
const char* fname = (argc>1)?argv[1]:"data/oni.xyz";
|
||||||
// Reads a .xyz point set file in points[].
|
// Reads a .xyz point set file in points[].
|
||||||
std::vector<Point> points;
|
std::vector<Point> points;
|
||||||
std::ifstream stream(fname);
|
if (!CGAL::read_points(fname, std::back_inserter(points)))
|
||||||
if (!stream ||
|
|
||||||
!CGAL::read_XYZ(stream, std::back_inserter(points)))
|
|
||||||
{
|
{
|
||||||
std::cerr << "Error: cannot read file " << fname << std::endl;
|
std::cerr << "Error: cannot read file " << fname << std::endl;
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||||
#include <CGAL/property_map.h>
|
#include <CGAL/property_map.h>
|
||||||
#include <CGAL/IO/read_xyz_points.h>
|
#include <CGAL/IO/read_points.h>
|
||||||
#include <CGAL/IO/write_xyz_points.h>
|
#include <CGAL/IO/write_xyz_points.h>
|
||||||
|
|
||||||
#include <utility> // defines std::pair
|
#include <utility> // defines std::pair
|
||||||
|
|
@ -20,14 +20,12 @@ int main(int argc, char*argv[])
|
||||||
{
|
{
|
||||||
const char* fname = (argc>1)?argv[1]:"data/oni.xyz";
|
const char* fname = (argc>1)?argv[1]:"data/oni.xyz";
|
||||||
// Reads a .xyz point set file in points[].
|
// Reads a .xyz point set file in points[].
|
||||||
// Note: read_XYZ() requires an output iterator
|
// Note: read_points() requires an output iterator
|
||||||
// over points and as well as property maps to access each
|
// over points and as well as property maps to access each
|
||||||
// point position and normal.
|
// point position and normal.
|
||||||
std::vector<Pwn> points;
|
std::vector<Pwn> points;
|
||||||
std::ifstream in(fname);
|
if (!CGAL::read_points(fname,
|
||||||
if (!in ||
|
std::back_inserter(points),
|
||||||
!CGAL::read_XYZ(
|
|
||||||
in,std::back_inserter(points),
|
|
||||||
CGAL::parameters::point_map (CGAL::First_of_pair_property_map<Pwn>()).
|
CGAL::parameters::point_map (CGAL::First_of_pair_property_map<Pwn>()).
|
||||||
normal_map (CGAL::Second_of_pair_property_map<Pwn>())))
|
normal_map (CGAL::Second_of_pair_property_map<Pwn>())))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
#include <CGAL/Simple_cartesian.h>
|
#include <CGAL/Simple_cartesian.h>
|
||||||
#include <CGAL/IO/read_ply_points.h>
|
#include <CGAL/IO/read_points.h>
|
||||||
#include <CGAL/IO/write_ply_points.h>
|
#include <CGAL/IO/write_ply_points.h>
|
||||||
#include <CGAL/property_map.h>
|
#include <CGAL/property_map.h>
|
||||||
|
|
||||||
|
|
@ -25,27 +25,21 @@ int main(int argc, const char** argv)
|
||||||
const char* fname2 = (argc>2)?argv[2]:"data/hippo2.ply";
|
const char* fname2 = (argc>2)?argv[2]:"data/hippo2.ply";
|
||||||
|
|
||||||
std::vector<Pwn> pwns1, pwns2;
|
std::vector<Pwn> pwns1, pwns2;
|
||||||
std::ifstream input(fname1);
|
if (!CGAL::read_points(fname1, std::back_inserter(pwns1),
|
||||||
if (!input ||
|
|
||||||
!CGAL::read_PLY(input, std::back_inserter(pwns1),
|
|
||||||
CGAL::parameters::point_map (CGAL::First_of_pair_property_map<Pwn>()).
|
CGAL::parameters::point_map (CGAL::First_of_pair_property_map<Pwn>()).
|
||||||
normal_map (Normal_map())))
|
normal_map (Normal_map())))
|
||||||
{
|
{
|
||||||
std::cerr << "Error: cannot read file " << fname1 << std::endl;
|
std::cerr << "Error: cannot read file " << fname1 << std::endl;
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
input.close();
|
|
||||||
|
|
||||||
input.open(fname2);
|
if (!CGAL::read_points(fname2, std::back_inserter(pwns2),
|
||||||
if (!input ||
|
|
||||||
!CGAL::read_PLY(input, std::back_inserter(pwns2),
|
|
||||||
CGAL::parameters::point_map (Point_map()).
|
CGAL::parameters::point_map (Point_map()).
|
||||||
normal_map (Normal_map())))
|
normal_map (Normal_map())))
|
||||||
{
|
{
|
||||||
std::cerr << "Error: cannot read file " << fname2 << std::endl;
|
std::cerr << "Error: cannot read file " << fname2 << std::endl;
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
input.close();
|
|
||||||
|
|
||||||
// EITHER call the registration method Super4PCS from OpenGR to get the transformation to apply to pwns2
|
// EITHER call the registration method Super4PCS from OpenGR to get the transformation to apply to pwns2
|
||||||
// std::pair<K::Aff_transformation_3, double> res =
|
// std::pair<K::Aff_transformation_3, double> res =
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
#include <CGAL/Simple_cartesian.h>
|
#include <CGAL/Simple_cartesian.h>
|
||||||
#include <CGAL/IO/read_ply_points.h>
|
#include <CGAL/IO/read_points.h>
|
||||||
#include <CGAL/IO/write_ply_points.h>
|
#include <CGAL/IO/write_ply_points.h>
|
||||||
#include <CGAL/property_map.h>
|
#include <CGAL/property_map.h>
|
||||||
#include <CGAL/Aff_transformation_3.h>
|
#include <CGAL/Aff_transformation_3.h>
|
||||||
|
|
@ -28,27 +28,21 @@ int main(int argc, const char** argv)
|
||||||
const char* fname2 = (argc>2)?argv[2]:"data/hippo2.ply";
|
const char* fname2 = (argc>2)?argv[2]:"data/hippo2.ply";
|
||||||
|
|
||||||
std::vector<Pwn> pwns1, pwns2;
|
std::vector<Pwn> pwns1, pwns2;
|
||||||
std::ifstream input(fname1);
|
if (!CGAL::read_points(fname1, std::back_inserter(pwns1),
|
||||||
if (!input ||
|
|
||||||
!CGAL::read_PLY(input, std::back_inserter(pwns1),
|
|
||||||
CGAL::parameters::point_map (CGAL::First_of_pair_property_map<Pwn>()).
|
CGAL::parameters::point_map (CGAL::First_of_pair_property_map<Pwn>()).
|
||||||
normal_map (Normal_map())))
|
normal_map (Normal_map())))
|
||||||
{
|
{
|
||||||
std::cerr << "Error: cannot read file " << fname1 << std::endl;
|
std::cerr << "Error: cannot read file " << fname1 << std::endl;
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
input.close();
|
|
||||||
|
|
||||||
input.open(fname2);
|
if (!CGAL::read_points(fname2, std::back_inserter(pwns2),
|
||||||
if (!input ||
|
|
||||||
!CGAL::read_PLY(input, std::back_inserter(pwns2),
|
|
||||||
CGAL::parameters::point_map (Point_map()).
|
CGAL::parameters::point_map (Point_map()).
|
||||||
normal_map (Normal_map())))
|
normal_map (Normal_map())))
|
||||||
{
|
{
|
||||||
std::cerr << "Error: cannot read file " << fname2 << std::endl;
|
std::cerr << "Error: cannot read file " << fname2 << std::endl;
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
input.close();
|
|
||||||
|
|
||||||
std::cerr << "Computing registration transformation using OpenGR Super4PCS.." << std::endl;
|
std::cerr << "Computing registration transformation using OpenGR Super4PCS.." << std::endl;
|
||||||
// First, compute registration transformation using OpenGR Super4PCS
|
// First, compute registration transformation using OpenGR Super4PCS
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
#include <CGAL/Simple_cartesian.h>
|
#include <CGAL/Simple_cartesian.h>
|
||||||
#include <CGAL/IO/read_ply_points.h>
|
#include <CGAL/IO/read_points.h>
|
||||||
#include <CGAL/IO/write_ply_points.h>
|
#include <CGAL/IO/write_ply_points.h>
|
||||||
#include <CGAL/property_map.h>
|
#include <CGAL/property_map.h>
|
||||||
#include <CGAL/Aff_transformation_3.h>
|
#include <CGAL/Aff_transformation_3.h>
|
||||||
|
|
@ -28,27 +28,21 @@ int main(int argc, const char** argv)
|
||||||
const char* fname2 = (argc>2)?argv[2]:"data/hippo2.ply";
|
const char* fname2 = (argc>2)?argv[2]:"data/hippo2.ply";
|
||||||
|
|
||||||
std::vector<Pwn> pwns1, pwns2;
|
std::vector<Pwn> pwns1, pwns2;
|
||||||
std::ifstream input(fname1);
|
if (!CGAL::read_points(fname1, std::back_inserter(pwns1),
|
||||||
if (!input ||
|
|
||||||
!CGAL::read_PLY(input, std::back_inserter(pwns1),
|
|
||||||
CGAL::parameters::point_map (CGAL::First_of_pair_property_map<Pwn>()).
|
CGAL::parameters::point_map (CGAL::First_of_pair_property_map<Pwn>()).
|
||||||
normal_map (Normal_map())))
|
normal_map (Normal_map())))
|
||||||
{
|
{
|
||||||
std::cerr << "Error: cannot read file " << fname1 << std::endl;
|
std::cerr << "Error: cannot read file " << fname1 << std::endl;
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
input.close();
|
|
||||||
|
|
||||||
input.open(fname2);
|
if (!CGAL::read_points(fname2, std::back_inserter(pwns2),
|
||||||
if (!input ||
|
|
||||||
!CGAL::read_PLY(input, std::back_inserter(pwns2),
|
|
||||||
CGAL::parameters::point_map (Point_map()).
|
CGAL::parameters::point_map (Point_map()).
|
||||||
normal_map (Normal_map())))
|
normal_map (Normal_map())))
|
||||||
{
|
{
|
||||||
std::cerr << "Error: cannot read file " << fname2 << std::endl;
|
std::cerr << "Error: cannot read file " << fname2 << std::endl;
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
input.close();
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Prepare ICP config
|
// Prepare ICP config
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
#include <CGAL/property_map.h>
|
#include <CGAL/property_map.h>
|
||||||
#include <CGAL/compute_average_spacing.h>
|
#include <CGAL/compute_average_spacing.h>
|
||||||
#include <CGAL/remove_outliers.h>
|
#include <CGAL/remove_outliers.h>
|
||||||
#include <CGAL/IO/read_xyz_points.h>
|
#include <CGAL/IO/read_points.h>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
@ -18,9 +18,7 @@ int main(int argc, char*argv[])
|
||||||
// Reads a .xyz point set file in points[].
|
// Reads a .xyz point set file in points[].
|
||||||
// The Identity_property_map property map can be omitted here as it is the default value.
|
// The Identity_property_map property map can be omitted here as it is the default value.
|
||||||
std::vector<Point> points;
|
std::vector<Point> points;
|
||||||
std::ifstream stream(fname);
|
if (!CGAL::read_points(fname, std::back_inserter(points),
|
||||||
if (!stream ||
|
|
||||||
!CGAL::read_XYZ(stream, std::back_inserter(points),
|
|
||||||
CGAL::parameters::point_map(CGAL::Identity_property_map<Point>())))
|
CGAL::parameters::point_map(CGAL::Identity_property_map<Point>())))
|
||||||
{
|
{
|
||||||
std::cerr << "Error: cannot read file " << fname << std::endl;
|
std::cerr << "Error: cannot read file " << fname << std::endl;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +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_points.h>
|
||||||
|
|
||||||
#include <CGAL/estimate_scale.h>
|
#include <CGAL/estimate_scale.h>
|
||||||
#include <CGAL/jet_smooth_point_set.h>
|
#include <CGAL/jet_smooth_point_set.h>
|
||||||
|
|
@ -27,11 +27,9 @@ int main (int argc, char** argv)
|
||||||
CGAL::Timer task_timer;
|
CGAL::Timer task_timer;
|
||||||
|
|
||||||
std::vector<Point_3> points;
|
std::vector<Point_3> points;
|
||||||
std::ifstream stream(fname);
|
|
||||||
|
|
||||||
// read input
|
// read input
|
||||||
if (!(stream
|
if (!CGAL::read_points(fname, std::back_inserter(points)))
|
||||||
&& CGAL::read_XYZ(stream, std::back_inserter(points))))
|
|
||||||
{
|
{
|
||||||
std::cerr << "Error: can't read input file" << std::endl;
|
std::cerr << "Error: can't read input file" << std::endl;
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +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_points.h>
|
||||||
#include <CGAL/IO/write_xyz_points.h>
|
#include <CGAL/IO/write_xyz_points.h>
|
||||||
#include <CGAL/property_map.h>
|
#include <CGAL/property_map.h>
|
||||||
|
|
||||||
|
|
@ -30,10 +30,8 @@ int main (int argc, char** argv)
|
||||||
Pwn_vector points;
|
Pwn_vector points;
|
||||||
|
|
||||||
// Loading point set from a file.
|
// Loading point set from a file.
|
||||||
std::ifstream stream(argc>1 ? argv[1] : "data/cube.pwn");
|
|
||||||
|
|
||||||
if (!stream ||
|
if (!CGAL::read_points((argc>1 ? argv[1] : "data/cube.pwn"),
|
||||||
!CGAL::read_XYZ(stream,
|
|
||||||
std::back_inserter(points),
|
std::back_inserter(points),
|
||||||
CGAL::parameters::point_map(Point_map()).
|
CGAL::parameters::point_map(Point_map()).
|
||||||
normal_map(Normal_map())))
|
normal_map(Normal_map())))
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include <CGAL/Simple_cartesian.h>
|
#include <CGAL/Simple_cartesian.h>
|
||||||
#include <CGAL/wlop_simplify_and_regularize_point_set.h>
|
#include <CGAL/wlop_simplify_and_regularize_point_set.h>
|
||||||
#include <CGAL/IO/read_xyz_points.h>
|
#include <CGAL/IO/read_points.h>
|
||||||
#include <CGAL/IO/write_xyz_points.h>
|
#include <CGAL/IO/write_xyz_points.h>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
@ -21,9 +21,8 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
// Reads a .xyz point set file in points[]
|
// Reads a .xyz point set file in points[]
|
||||||
std::vector<Point> points;
|
std::vector<Point> points;
|
||||||
std::ifstream stream(input_filename);
|
|
||||||
|
|
||||||
if (!stream || !CGAL::read_XYZ(stream, std::back_inserter(points)))
|
if (!CGAL::read_points(input_filename, std::back_inserter(points)))
|
||||||
{
|
{
|
||||||
std::cerr << "Error: cannot read file " << input_filename << std::endl;
|
std::cerr << "Error: cannot read file " << input_filename << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
#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/IO/read_xyz_points.h>
|
#include <CGAL/IO/read_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>
|
||||||
|
|
||||||
|
|
@ -185,12 +185,11 @@ int main(int argc, char * argv[])
|
||||||
extension == ".pwn" || extension == ".PWN")
|
extension == ".pwn" || extension == ".PWN")
|
||||||
{
|
{
|
||||||
// Reads the point set file in points[].
|
// Reads the point set file in points[].
|
||||||
// Note: read_XYZ() requires an iterator over points
|
// Note: read_points() 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.
|
||||||
std::ifstream stream(input_filename.c_str());
|
|
||||||
if (!stream ||
|
if (!stream ||
|
||||||
!CGAL::read_XYZ(
|
!CGAL::read_points(
|
||||||
stream,
|
input_filename.c_str(),
|
||||||
std::back_inserter(points),
|
std::back_inserter(points),
|
||||||
CGAL::parameters::point_map
|
CGAL::parameters::point_map
|
||||||
(CGAL::make_first_of_pair_property_map(Point_with_normal())).
|
(CGAL::make_first_of_pair_property_map(Point_with_normal())).
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
#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/property_map.h>
|
#include <CGAL/property_map.h>
|
||||||
#include <CGAL/IO/read_xyz_points.h>
|
#include <CGAL/IO/read_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>
|
||||||
|
|
@ -40,13 +40,12 @@ int main(void)
|
||||||
FT sm_distance = 0.375; // Surface Approximation error w.r.t. point set average spacing.
|
FT sm_distance = 0.375; // Surface Approximation error w.r.t. point set average spacing.
|
||||||
|
|
||||||
// Reads the point set file in points[].
|
// Reads the point set file in points[].
|
||||||
// Note: read_XYZ() requires an iterator over points
|
// Note: read_points() 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.
|
||||||
PointList points;
|
PointList points;
|
||||||
std::ifstream stream("data/kitten.xyz");
|
|
||||||
if (!stream ||
|
if (!stream ||
|
||||||
!CGAL::read_XYZ(
|
!CGAL::read_points(
|
||||||
stream,
|
"data/kitten.xyz",
|
||||||
std::back_inserter(points),
|
std::back_inserter(points),
|
||||||
CGAL::parameters::point_map (Point_map()).
|
CGAL::parameters::point_map (Point_map()).
|
||||||
normal_map (Normal_map())))
|
normal_map (Normal_map())))
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||||
#include <CGAL/Polyhedron_3.h>
|
#include <CGAL/Polyhedron_3.h>
|
||||||
#include <CGAL/poisson_surface_reconstruction.h>
|
#include <CGAL/poisson_surface_reconstruction.h>
|
||||||
#include <CGAL/IO/read_xyz_points.h>
|
#include <CGAL/IO/read_points.h>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
@ -16,10 +16,10 @@ typedef CGAL::Polyhedron_3<Kernel> Polyhedron;
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
std::vector<Pwn> points;
|
std::vector<Pwn> points;
|
||||||
std::ifstream stream("data/kitten.xyz");
|
|
||||||
if (!stream ||
|
if (!stream ||
|
||||||
!CGAL::read_XYZ(
|
!CGAL::read_points(
|
||||||
stream,
|
"data/kitten.xyz",
|
||||||
std::back_inserter(points),
|
std::back_inserter(points),
|
||||||
CGAL::parameters::point_map(CGAL::First_of_pair_property_map<Pwn>()).
|
CGAL::parameters::point_map(CGAL::First_of_pair_property_map<Pwn>()).
|
||||||
normal_map(CGAL::Second_of_pair_property_map<Pwn>())))
|
normal_map(CGAL::Second_of_pair_property_map<Pwn>())))
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
#include <CGAL/Poisson_reconstruction_function.h>
|
#include <CGAL/Poisson_reconstruction_function.h>
|
||||||
#include <CGAL/Point_with_normal_3.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/readpoints.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>
|
||||||
|
|
||||||
|
|
@ -135,13 +135,11 @@ int main(int argc, char * argv[])
|
||||||
extension == ".pwn" || extension == ".PWN")
|
extension == ".pwn" || extension == ".PWN")
|
||||||
{
|
{
|
||||||
// Reads the point set file in points[].
|
// Reads the point set file in points[].
|
||||||
// Note: read_XYZ() requires an iterator over points
|
// Note: read_points() 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.
|
// The position property map can be omitted here as we use iterators over Point_3 elements.
|
||||||
std::ifstream stream(input_filename.c_str());
|
if (!CGAL::read_points(
|
||||||
if (!stream ||
|
input_filename.c_str(),
|
||||||
!CGAL::read_XYZ(
|
|
||||||
stream,
|
|
||||||
std::back_inserter(points),
|
std::back_inserter(points),
|
||||||
CGAL::parameters::normal_map
|
CGAL::parameters::normal_map
|
||||||
(CGAL::make_normal_of_point_with_normal_map(PointList::value_type()))
|
(CGAL::make_normal_of_point_with_normal_map(PointList::value_type()))
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
#include <CGAL/Polygon_mesh_processing/polygon_soup_to_polygon_mesh.h>
|
#include <CGAL/Polygon_mesh_processing/polygon_soup_to_polygon_mesh.h>
|
||||||
#include <CGAL/Polygon_mesh_processing/orientation.h>
|
#include <CGAL/Polygon_mesh_processing/orientation.h>
|
||||||
|
|
||||||
#include <CGAL/IO/OFF.h>
|
#include <CGAL/IO/polygon_soup_io.h>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
@ -19,12 +19,11 @@ typedef CGAL::Polyhedron_3<K, CGAL::Polyhedron_items_with_id_3> Polyhedron;
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
const char* filename = (argc > 1) ? argv[1] : "data/tet-shuffled.off";
|
const char* filename = (argc > 1) ? argv[1] : "data/tet-shuffled.off";
|
||||||
std::ifstream input(filename);
|
|
||||||
|
|
||||||
std::vector<K::Point_3> points;
|
std::vector<K::Point_3> points;
|
||||||
std::vector<std::vector<std::size_t> > polygons;
|
std::vector<std::vector<std::size_t> > polygons;
|
||||||
|
|
||||||
if(!input || !CGAL::read_OFF(input, points, polygons) || points.empty())
|
if(!CGAL::read_polygon_soup(filename, points, polygons) || points.empty())
|
||||||
{
|
{
|
||||||
std::cerr << "Cannot open file " << std::endl;
|
std::cerr << "Cannot open file " << std::endl;
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +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_points.h>
|
||||||
#include <CGAL/property_map.h>
|
#include <CGAL/property_map.h>
|
||||||
#include <CGAL/Surface_mesh.h>
|
#include <CGAL/Surface_mesh.h>
|
||||||
#include <CGAL/Shape_detection/Region_growing/Region_growing.h>
|
#include <CGAL/Shape_detection/Region_growing/Region_growing.h>
|
||||||
|
|
@ -96,12 +96,12 @@ int main()
|
||||||
std::cerr << "Failed open file \'" << input_file << "\'" << std::endl;
|
std::cerr << "Failed open file \'" << input_file << "\'" << std::endl;
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
input_stream.close();
|
||||||
std::cout << "Loading point cloud: " << input_file << "...";
|
std::cout << "Loading point cloud: " << input_file << "...";
|
||||||
|
|
||||||
CGAL::Timer t;
|
CGAL::Timer t;
|
||||||
t.start();
|
t.start();
|
||||||
if (!input_stream ||
|
if (!CGAL::read_points(input_file.c_str(),
|
||||||
!CGAL::read_XYZ(input_stream,
|
|
||||||
std::back_inserter(points),
|
std::back_inserter(points),
|
||||||
CGAL::parameters::point_map(Point_map()).normal_map(Normal_map()))) {
|
CGAL::parameters::point_map(Point_map()).normal_map(Normal_map()))) {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +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_points.h>
|
||||||
#include <CGAL/property_map.h>
|
#include <CGAL/property_map.h>
|
||||||
#include <CGAL/Surface_mesh.h>
|
#include <CGAL/Surface_mesh.h>
|
||||||
#include <CGAL/Shape_detection/Efficient_RANSAC.h>
|
#include <CGAL/Shape_detection/Efficient_RANSAC.h>
|
||||||
|
|
@ -63,12 +63,12 @@ int main()
|
||||||
std::cerr << "failed open file \'" <<input_file << "\'" << std::endl;
|
std::cerr << "failed open file \'" <<input_file << "\'" << std::endl;
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
input_stream.close();
|
||||||
std::cout << "Loading point cloud: " << input_file << "...";
|
std::cout << "Loading point cloud: " << input_file << "...";
|
||||||
|
|
||||||
CGAL::Timer t;
|
CGAL::Timer t;
|
||||||
t.start();
|
t.start();
|
||||||
if (!input_stream ||
|
if (!CGAL::read_points(input_file.c_str(),
|
||||||
!CGAL::read_XYZ(input_stream,
|
|
||||||
std::back_inserter(points),
|
std::back_inserter(points),
|
||||||
CGAL::parameters::point_map(Point_map()).normal_map(Normal_map())))
|
CGAL::parameters::point_map(Point_map()).normal_map(Normal_map())))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ Polyhedron_demo_gocad_plugin::load(QFileInfo fileinfo, bool& ok, bool add_to_sce
|
||||||
ok = false;
|
ok = false;
|
||||||
return QList<Scene_item*>();
|
return QList<Scene_item*>();
|
||||||
}
|
}
|
||||||
|
in.close();
|
||||||
|
|
||||||
CGAL::Timer t;
|
CGAL::Timer t;
|
||||||
t.start();
|
t.start();
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
|
#include "SMesh_type.h"
|
||||||
#include "Scene_surface_mesh_item.h"
|
#include "Scene_surface_mesh_item.h"
|
||||||
#include "Scene_polygon_soup_item.h"
|
#include "Scene_polygon_soup_item.h"
|
||||||
#include "Kernel_type.h"
|
#include "Kernel_type.h"
|
||||||
#include "Scene.h"
|
#include "Scene.h"
|
||||||
#include "SMesh_type.h"
|
|
||||||
|
|
||||||
#include <CGAL/Three/Polyhedron_demo_io_plugin_interface.h>
|
#include <CGAL/Three/Polyhedron_demo_io_plugin_interface.h>
|
||||||
#include <CGAL/Three/Three.h>
|
#include <CGAL/Three/Three.h>
|
||||||
|
|
||||||
#include <CGAL/IO/STL.h>
|
#include <CGAL/IO/polygon_soup_io.h>
|
||||||
#include <CGAL/boost/graph/io.h>
|
#include <CGAL/boost/graph/io.h>
|
||||||
#include <CGAL/Polygon_mesh_processing/polygon_soup_to_polygon_mesh.h>
|
#include <CGAL/Polygon_mesh_processing/polygon_soup_to_polygon_mesh.h>
|
||||||
|
|
||||||
|
|
@ -65,6 +65,7 @@ load(QFileInfo fileinfo, bool& ok, bool add_to_scene){
|
||||||
ok = false;
|
ok = false;
|
||||||
return QList<Scene_item*>();
|
return QList<Scene_item*>();
|
||||||
}
|
}
|
||||||
|
in.close();
|
||||||
if(fileinfo.size() == 0)
|
if(fileinfo.size() == 0)
|
||||||
{
|
{
|
||||||
CGAL::Three::Three::warning( tr("The file you are trying to load is empty."));
|
CGAL::Three::Three::warning( tr("The file you are trying to load is empty."));
|
||||||
|
|
@ -75,9 +76,9 @@ load(QFileInfo fileinfo, bool& ok, bool add_to_scene){
|
||||||
CGAL::Three::Three::scene()->addItem(item);
|
CGAL::Three::Three::scene()->addItem(item);
|
||||||
return QList<Scene_item*>()<<item;
|
return QList<Scene_item*>()<<item;
|
||||||
}
|
}
|
||||||
std::vector<std::array<double, 3> > points;
|
std::vector<EPICK::Point_3> points;
|
||||||
std::vector<std::array<int, 3> > triangles;
|
std::vector<std::vector<int> > triangles;
|
||||||
if (!CGAL::read_STL(in, points, triangles))
|
if (!CGAL::read_polygon_soup(fileinfo.filePath().toUtf8().toStdString(), points, triangles))
|
||||||
{
|
{
|
||||||
std::cerr << "Error: invalid STL file" << std::endl;
|
std::cerr << "Error: invalid STL file" << std::endl;
|
||||||
ok = false;
|
ok = false;
|
||||||
|
|
@ -90,11 +91,10 @@ load(QFileInfo fileinfo, bool& ok, bool add_to_scene){
|
||||||
SMesh* SM = new SMesh();
|
SMesh* SM = new SMesh();
|
||||||
if (CGAL::Polygon_mesh_processing::is_polygon_soup_a_polygon_mesh(triangles))
|
if (CGAL::Polygon_mesh_processing::is_polygon_soup_a_polygon_mesh(triangles))
|
||||||
{
|
{
|
||||||
auto pmap = boost::make_function_property_map<std::array<double, 3>, Point_3>(
|
//auto pmap = boost::make_function_property_map<std::array<double, 3>, Point_3>(
|
||||||
[](const std::array<double, 3>& a) { return Point_3(a[0], a[1], a[2]); });
|
// [](const std::array<double, 3>& a) { return Point_3(a[0], a[1], a[2]); });
|
||||||
CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh(points, triangles, *SM,
|
|
||||||
CGAL::parameters::point_map(pmap),
|
CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh(points, triangles, *SM);
|
||||||
CGAL::parameters::all_default());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!SM->is_valid() || SM->is_empty()){
|
if(!SM->is_valid() || SM->is_empty()){
|
||||||
|
|
|
||||||
|
|
@ -355,7 +355,7 @@ public:
|
||||||
if(is_polygon_mesh)
|
if(is_polygon_mesh)
|
||||||
{
|
{
|
||||||
FaceGraph* poly = new FaceGraph();
|
FaceGraph* poly = new FaceGraph();
|
||||||
if (CGAL::IO::internal::vtkPointSet_to_polygon_mesh(data, *poly))
|
if (CGAL::IO::internal::vtkPointSet_to_polygon_mesh(data, *poly, CGAL::parameters::all_default()))
|
||||||
{
|
{
|
||||||
Scene_facegraph_item* poly_item = new Scene_facegraph_item(poly);
|
Scene_facegraph_item* poly_item = new Scene_facegraph_item(poly);
|
||||||
if(group)
|
if(group)
|
||||||
|
|
|
||||||
|
|
@ -661,7 +661,7 @@ Scene_polygon_soup_item::new_triangle(const std::size_t i,
|
||||||
d->soup->polygons.push_back(new_polygon);
|
d->soup->polygons.push_back(new_polygon);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Point, class Polygon>
|
template <class Point, typename Polygon>
|
||||||
void Scene_polygon_soup_item::load(const std::vector<Point>& points, const std::vector<Polygon>& polygons)
|
void Scene_polygon_soup_item::load(const std::vector<Point>& points, const std::vector<Polygon>& polygons)
|
||||||
{
|
{
|
||||||
if(!d->soup)
|
if(!d->soup)
|
||||||
|
|
@ -700,8 +700,8 @@ void Scene_polygon_soup_item::load(const std::vector<Point>& points, const std::
|
||||||
}
|
}
|
||||||
// Force the instanciation of the template function for the types used in the STL_io_plugin. This is needed
|
// Force the instanciation of the template function for the types used in the STL_io_plugin. This is needed
|
||||||
// because the d-pointer forbid the definition in the .h for this function.
|
// because the d-pointer forbid the definition in the .h for this function.
|
||||||
template SCENE_POLYGON_SOUP_ITEM_EXPORT void Scene_polygon_soup_item::load<std::array<double, 3>, std::array<int, 3> >
|
template SCENE_POLYGON_SOUP_ITEM_EXPORT void Scene_polygon_soup_item::load<EPICK::Point_3, std::vector<int> >
|
||||||
(const std::vector<std::array<double, 3> >& points, const std::vector<std::array<int, 3> >& polygons);
|
(const std::vector<EPICK::Point_3>& points, const std::vector<std::vector<int> >& polygons);
|
||||||
template SCENE_POLYGON_SOUP_ITEM_EXPORT void Scene_polygon_soup_item::load<CGAL::Epick::Point_3, std::vector<std::size_t> >
|
template SCENE_POLYGON_SOUP_ITEM_EXPORT void Scene_polygon_soup_item::load<CGAL::Epick::Point_3, std::vector<std::size_t> >
|
||||||
(const std::vector<CGAL::Epick::Point_3>& points, const std::vector<std::vector<std::size_t> >& polygons);
|
(const std::vector<CGAL::Epick::Point_3>& points, const std::vector<std::vector<std::size_t> >& polygons);
|
||||||
template SCENE_POLYGON_SOUP_ITEM_EXPORT void Scene_polygon_soup_item::load<CGAL::Epick::Point_3, std::vector<std::size_t> >
|
template SCENE_POLYGON_SOUP_ITEM_EXPORT void Scene_polygon_soup_item::load<CGAL::Epick::Point_3, std::vector<std::size_t> >
|
||||||
|
|
|
||||||
|
|
@ -113,7 +113,7 @@ public:
|
||||||
|
|
||||||
Scene_polygon_soup_item* clone() const Q_DECL_OVERRIDE;
|
Scene_polygon_soup_item* clone() const Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
template <class Point, class Polygon>
|
template <class Point, typename Polygon>
|
||||||
void load(const std::vector<Point>& points, const std::vector<Polygon>& polygons);
|
void load(const std::vector<Point>& points, const std::vector<Polygon>& polygons);
|
||||||
|
|
||||||
template <class Point, class Polygon>
|
template <class Point, class Polygon>
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
#include <CGAL/Monge_via_jet_fitting.h>
|
#include <CGAL/Monge_via_jet_fitting.h>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
#include <CGAL/boost/graph/IO/polygon_mesh_io.h>
|
||||||
|
|
||||||
#if defined(CGAL_USE_BOOST_PROGRAM_OPTIONS) && ! defined(DONT_USE_BOOST_PROGRAM_OPTIONS)
|
#if defined(CGAL_USE_BOOST_PROGRAM_OPTIONS) && ! defined(DONT_USE_BOOST_PROGRAM_OPTIONS)
|
||||||
#include <boost/program_options.hpp>
|
#include <boost/program_options.hpp>
|
||||||
|
|
@ -286,7 +287,7 @@ int main()
|
||||||
|
|
||||||
//load the model from <mesh.off>
|
//load the model from <mesh.off>
|
||||||
PolyhedralSurf P;
|
PolyhedralSurf P;
|
||||||
CGAL::read_OFF(if_name.c_str(), P);
|
CGAL::read_polygon_mesh(if_name.c_str(), P);
|
||||||
fprintf(stderr, "loadMesh %d Ves %d Facets\n",
|
fprintf(stderr, "loadMesh %d Ves %d Facets\n",
|
||||||
(int)num_vertices(P), (int)num_faces(P));
|
(int)num_vertices(P), (int)num_faces(P));
|
||||||
if(verbose)
|
if(verbose)
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include <CGAL/property_map.h>
|
#include <CGAL/property_map.h>
|
||||||
#include <CGAL/IO/read_xyz_points.h>
|
#include <CGAL/IO/read_points.h>
|
||||||
#include <CGAL/Point_with_normal_3.h>
|
#include <CGAL/Point_with_normal_3.h>
|
||||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||||
|
|
||||||
|
|
@ -29,11 +29,9 @@ typedef CGAL::Shape_detection::Plane<Traits> Plane;
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
|
|
||||||
Pwn_vector points;
|
Pwn_vector points;
|
||||||
std::ifstream stream(argc > 1 ? argv[1] : "data/cube.pwn");
|
|
||||||
|
|
||||||
if (!stream ||
|
if (!CGAL::read_points(
|
||||||
!CGAL::read_XYZ(
|
(argc > 1 ? argv[1] : "data/cube.pwn"),
|
||||||
stream,
|
|
||||||
std::back_inserter(points),
|
std::back_inserter(points),
|
||||||
CGAL::parameters::point_map(Point_map()).
|
CGAL::parameters::point_map(Point_map()).
|
||||||
normal_map(Normal_map()))) {
|
normal_map(Normal_map()))) {
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include <CGAL/property_map.h>
|
#include <CGAL/property_map.h>
|
||||||
#include <CGAL/IO/read_xyz_points.h>
|
#include <CGAL/IO/read_points.h>
|
||||||
#include <CGAL/Point_with_normal_3.h>
|
#include <CGAL/Point_with_normal_3.h>
|
||||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||||
|
|
||||||
|
|
@ -34,11 +34,9 @@ int main (int argc, char** argv) {
|
||||||
Pwn_vector points;
|
Pwn_vector points;
|
||||||
|
|
||||||
// Load point set from a file.
|
// Load point set from a file.
|
||||||
std::ifstream stream(filename);
|
|
||||||
|
|
||||||
if (!stream ||
|
if (!CGAL::read_points(
|
||||||
!CGAL::read_XYZ(
|
filename,
|
||||||
stream,
|
|
||||||
std::back_inserter(points),
|
std::back_inserter(points),
|
||||||
CGAL::parameters::point_map(Point_map()).
|
CGAL::parameters::point_map(Point_map()).
|
||||||
normal_map(Normal_map()))) {
|
normal_map(Normal_map()))) {
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
#include <CGAL/Timer.h>
|
#include <CGAL/Timer.h>
|
||||||
#include <CGAL/property_map.h>
|
#include <CGAL/property_map.h>
|
||||||
#include <CGAL/IO/read_xyz_points.h>
|
#include <CGAL/IO/read_points.h>
|
||||||
#include <CGAL/Point_with_normal_3.h>
|
#include <CGAL/Point_with_normal_3.h>
|
||||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||||
|
|
||||||
|
|
@ -61,11 +61,9 @@ int main (int argc, char** argv) {
|
||||||
const char* filename = (argc > 1) ? argv[1] : "data/cube.pwn";
|
const char* filename = (argc > 1) ? argv[1] : "data/cube.pwn";
|
||||||
|
|
||||||
Pwn_vector points;
|
Pwn_vector points;
|
||||||
std::ifstream stream(filename);
|
|
||||||
|
|
||||||
if (!stream ||
|
if (!CGAL::read_points(
|
||||||
!CGAL::read_XYZ(
|
filename,
|
||||||
stream,
|
|
||||||
std::back_inserter(points),
|
std::back_inserter(points),
|
||||||
CGAL::parameters::point_map(Point_map()).
|
CGAL::parameters::point_map(Point_map()).
|
||||||
normal_map(Normal_map()))) {
|
normal_map(Normal_map()))) {
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include <CGAL/property_map.h>
|
#include <CGAL/property_map.h>
|
||||||
#include <CGAL/IO/read_xyz_points.h>
|
#include <CGAL/IO/read_points.h>
|
||||||
#include <CGAL/Point_with_normal_3.h>
|
#include <CGAL/Point_with_normal_3.h>
|
||||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||||
|
|
||||||
|
|
@ -27,11 +27,10 @@ int main(int argc, char** argv) {
|
||||||
Pwn_vector points;
|
Pwn_vector points;
|
||||||
|
|
||||||
// Load point set from a file.
|
// Load point set from a file.
|
||||||
std::ifstream stream((argc > 1) ? argv[1] : "data/cube.pwn");
|
|
||||||
|
|
||||||
if (!stream ||
|
if (!stream ||
|
||||||
!CGAL::read_XYZ(
|
!CGAL::read_points(
|
||||||
stream,
|
((argc > 1) ? argv[1] : "data/cube.pwn"),
|
||||||
std::back_inserter(points),
|
std::back_inserter(points),
|
||||||
CGAL::parameters::point_map(Point_map()).
|
CGAL::parameters::point_map(Point_map()).
|
||||||
normal_map(Normal_map()))) {
|
normal_map(Normal_map()))) {
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include <CGAL/property_map.h>
|
#include <CGAL/property_map.h>
|
||||||
#include <CGAL/IO/read_xyz_points.h>
|
#include <CGAL/IO/read_points.h>
|
||||||
#include <CGAL/Point_with_normal_3.h>
|
#include <CGAL/Point_with_normal_3.h>
|
||||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||||
|
|
||||||
|
|
@ -31,11 +31,9 @@ int main(int argc, char** argv) {
|
||||||
Pwn_vector points;
|
Pwn_vector points;
|
||||||
|
|
||||||
// Load point set from a file.
|
// Load point set from a file.
|
||||||
std::ifstream stream((argc > 1) ? argv[1] : "data/cube.pwn");
|
|
||||||
|
|
||||||
if (!stream ||
|
if (!CGAL::read_points(
|
||||||
!CGAL::read_XYZ(
|
((argc > 1) ? argv[1] : "data/cube.pwn"),
|
||||||
stream,
|
|
||||||
std::back_inserter(points),
|
std::back_inserter(points),
|
||||||
CGAL::parameters::point_map(Point_map()).
|
CGAL::parameters::point_map(Point_map()).
|
||||||
normal_map(Normal_map()))) {
|
normal_map(Normal_map()))) {
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
#include <CGAL/Timer.h>
|
#include <CGAL/Timer.h>
|
||||||
#include <CGAL/number_utils.h>
|
#include <CGAL/number_utils.h>
|
||||||
#include <CGAL/property_map.h>
|
#include <CGAL/property_map.h>
|
||||||
#include <CGAL/IO/read_xyz_points.h>
|
#include <CGAL/IO/read_points.h>
|
||||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||||
|
|
||||||
#include <CGAL/Shape_detection/Efficient_RANSAC.h>
|
#include <CGAL/Shape_detection/Efficient_RANSAC.h>
|
||||||
|
|
@ -28,11 +28,9 @@ int main(int argc, char** argv) {
|
||||||
Pwn_vector points;
|
Pwn_vector points;
|
||||||
|
|
||||||
// Load point set from a file.
|
// Load point set from a file.
|
||||||
std::ifstream stream((argc > 1) ? argv[1] : "data/cube.pwn");
|
|
||||||
|
|
||||||
if (!stream ||
|
if (!CGAL::read_points(
|
||||||
!CGAL::read_XYZ(
|
((argc > 1) ? argv[1] : "data/cube.pwn"),
|
||||||
stream,
|
|
||||||
std::back_inserter(points),
|
std::back_inserter(points),
|
||||||
CGAL::parameters::point_map(Point_map()).
|
CGAL::parameters::point_map(Point_map()).
|
||||||
normal_map(Normal_map()))) {
|
normal_map(Normal_map()))) {
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include <CGAL/property_map.h>
|
#include <CGAL/property_map.h>
|
||||||
#include <CGAL/IO/read_xyz_points.h>
|
#include <CGAL/IO/read_points.h>
|
||||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||||
#include <CGAL/Shape_detection_3.h>
|
#include <CGAL/Shape_detection_3.h>
|
||||||
|
|
||||||
|
|
@ -40,10 +40,8 @@ int run(const char* filename) {
|
||||||
// Load a point set from a file.
|
// Load a point set from a file.
|
||||||
// read_XYZ takes an OutputIterator for storing the points
|
// read_XYZ takes an OutputIterator for storing the points
|
||||||
// and a property map to store the normal vector with each point.
|
// and a property map to store the normal vector with each point.
|
||||||
std::ifstream stream(filename);
|
|
||||||
|
|
||||||
if (!stream ||
|
if (!CGAL::read_points(filename,
|
||||||
!CGAL::read_XYZ(stream,
|
|
||||||
std::back_inserter(points),
|
std::back_inserter(points),
|
||||||
CGAL::parameters::point_map(Point_map()).
|
CGAL::parameters::point_map(Point_map()).
|
||||||
normal_map(Normal_map()))) {
|
normal_map(Normal_map()))) {
|
||||||
|
|
|
||||||
|
|
@ -475,7 +475,7 @@ bool write_triangle_soups_to_3mf(const std::string& fname,
|
||||||
}
|
}
|
||||||
|
|
||||||
// convenience
|
// convenience
|
||||||
template<typename PointRanges, typename PolygonRanges>
|
template<typename PointRange, typename PolygonRange>
|
||||||
bool write_triangle_soup_to_3mf(const std::string& fname,
|
bool write_triangle_soup_to_3mf(const std::string& fname,
|
||||||
const PointRange& points,
|
const PointRange& points,
|
||||||
const PolygonRange& polygons,
|
const PolygonRange& polygons,
|
||||||
|
|
@ -488,7 +488,7 @@ bool write_triangle_soup_to_3mf(const std::string& fname,
|
||||||
return write_triangle_soups_to_3mf(fname, all_points, all_polygons, names);
|
return write_triangle_soups_to_3mf(fname, all_points, all_polygons, names);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename PointRanges, typename PolygonRanges>
|
template<typename PointRange, typename PolygonRange>
|
||||||
bool write_3MF(const std::string& fname,
|
bool write_3MF(const std::string& fname,
|
||||||
const PointRange& points,
|
const PointRange& points,
|
||||||
const PolygonRange& polygons)
|
const PolygonRange& polygons)
|
||||||
|
|
|
||||||
|
|
@ -80,8 +80,8 @@ operator<<(VRML_1_ostream& os,
|
||||||
<< oformat(CGAL::to_double(t[1].z())) << " ,\n"
|
<< oformat(CGAL::to_double(t[1].z())) << " ,\n"
|
||||||
<< Indent << " "
|
<< Indent << " "
|
||||||
<< oformat(CGAL::to_double(t[2].x())) << " "
|
<< oformat(CGAL::to_double(t[2].x())) << " "
|
||||||
<< oformat(CGAL::to_double(t[2].y()) << " "
|
<< oformat(CGAL::to_double(t[2].y())) << " "
|
||||||
<< oformat(CGAL::to_double(t[2].z()) << " ,\n"
|
<< oformat(CGAL::to_double(t[2].z())) << " ,\n"
|
||||||
<< Indent << " "
|
<< Indent << " "
|
||||||
<< oformat(CGAL::to_double(t[3].x())) << " "
|
<< oformat(CGAL::to_double(t[3].x())) << " "
|
||||||
<< oformat(CGAL::to_double(t[3].y())) << " "
|
<< oformat(CGAL::to_double(t[3].y())) << " "
|
||||||
|
|
|
||||||
|
|
@ -114,6 +114,165 @@ public:
|
||||||
DefaultMap_const
|
DefaultMap_const
|
||||||
> ::type const_type;
|
> ::type const_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
template <typename Point, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
|
||||||
|
bool read_OFF_with_or_without_fcolors(std::istream& is,
|
||||||
|
Surface_mesh<Point>& sm,
|
||||||
|
const CGAL::File_scanner_OFF& scanner,
|
||||||
|
const CGAL_BGL_NP_CLASS& np)
|
||||||
|
{
|
||||||
|
typedef Surface_mesh<Point> Mesh;
|
||||||
|
typedef typename Mesh::Face_index Face_index;
|
||||||
|
typedef CGAL::Color Color;
|
||||||
|
|
||||||
|
typedef typename
|
||||||
|
CGAL::internal::IO::GetFaceColorMap<Mesh, CGAL_BGL_NP_CLASS>::type FCM;
|
||||||
|
using parameters::choose_parameter;
|
||||||
|
using parameters::is_default_parameter;
|
||||||
|
using parameters::get_parameter;
|
||||||
|
bool created;
|
||||||
|
typename Mesh::template Property_map<Face_index, Color> fcm;
|
||||||
|
bool is_fcm_requested =
|
||||||
|
!(is_default_parameter(get_parameter(np, internal_np::face_color_map)));
|
||||||
|
|
||||||
|
if(!is_fcm_requested && scanner.has_colors())
|
||||||
|
{
|
||||||
|
std::tie(fcm, created) =
|
||||||
|
sm.template add_property_map<Face_index, Color>("f:color", Color(0,0,0));
|
||||||
|
CGAL_assertion(created);
|
||||||
|
is_fcm_requested = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(is_fcm_requested)
|
||||||
|
{
|
||||||
|
FCM fcolors = choose_parameter(get_parameter(np, internal_np::face_color_map),
|
||||||
|
fcm);
|
||||||
|
return CGAL::IO::internal::read_OFF_BGL(is, sm, np.face_color_map(fcolors));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return CGAL::IO::internal::read_OFF_BGL(is, sm, np);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename Point, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
|
||||||
|
bool read_OFF_with_or_without_vtextures(std::istream& is,
|
||||||
|
Surface_mesh<Point>& sm,
|
||||||
|
const CGAL::File_scanner_OFF& scanner,
|
||||||
|
const CGAL_BGL_NP_CLASS& np)
|
||||||
|
{
|
||||||
|
typedef Surface_mesh<Point> Mesh;
|
||||||
|
typedef typename Mesh::Vertex_index Vertex_index;
|
||||||
|
|
||||||
|
typedef typename GetK<Surface_mesh<Point>, CGAL_BGL_NP_CLASS>::Kernel K;
|
||||||
|
typedef typename K::Point_2 Texture;
|
||||||
|
typedef typename
|
||||||
|
CGAL::internal::IO::GetVertexTextureMap<Mesh, K, CGAL_BGL_NP_CLASS>::type VTM;
|
||||||
|
|
||||||
|
typename Mesh::template Property_map<Vertex_index, Texture> vtextures;
|
||||||
|
using parameters::choose_parameter;
|
||||||
|
using parameters::is_default_parameter;
|
||||||
|
using parameters::get_parameter;
|
||||||
|
|
||||||
|
bool created;
|
||||||
|
typename Mesh::template Property_map<Vertex_index, Texture> vtm;
|
||||||
|
|
||||||
|
bool is_vtm_requested =
|
||||||
|
!(is_default_parameter(get_parameter(np, internal_np::vertex_texture_map)));
|
||||||
|
|
||||||
|
|
||||||
|
if(!is_vtm_requested && scanner.has_textures())
|
||||||
|
{
|
||||||
|
std::tie(vtm, created) =
|
||||||
|
sm.template add_property_map<Vertex_index, Texture>("v:texcoord");
|
||||||
|
CGAL_assertion(created);
|
||||||
|
is_vtm_requested = true;
|
||||||
|
}
|
||||||
|
if(is_vtm_requested)
|
||||||
|
{
|
||||||
|
VTM vtextures = choose_parameter(get_parameter(np, internal_np::vertex_texture_map),
|
||||||
|
vtm);
|
||||||
|
return read_OFF_with_or_without_fcolors(is, sm, scanner, np.vertex_texture_map(vtextures));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return read_OFF_with_or_without_fcolors(is, sm, scanner, np);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename Point, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
|
||||||
|
bool read_OFF_with_or_without_vcolors(std::istream& is,
|
||||||
|
Surface_mesh<Point>& sm,
|
||||||
|
const CGAL::File_scanner_OFF& scanner,
|
||||||
|
const CGAL_BGL_NP_CLASS& np)
|
||||||
|
{
|
||||||
|
typedef Surface_mesh<Point> Mesh;
|
||||||
|
typedef typename Mesh::Vertex_index Vertex_index;
|
||||||
|
typedef CGAL::Color Color;
|
||||||
|
|
||||||
|
typename Mesh::template Property_map<Vertex_index, Color> vcolors;
|
||||||
|
typedef typename
|
||||||
|
CGAL::internal::IO::GetVertexColorMap<Mesh, CGAL_BGL_NP_CLASS>::type VCM;
|
||||||
|
using parameters::choose_parameter;
|
||||||
|
using parameters::is_default_parameter;
|
||||||
|
using parameters::get_parameter;
|
||||||
|
|
||||||
|
bool created;
|
||||||
|
bool is_vcm_requested =
|
||||||
|
!(is_default_parameter(get_parameter(np, internal_np::vertex_color_map)));
|
||||||
|
typename Mesh::template Property_map<Vertex_index, Color> vcm;
|
||||||
|
if(!is_vcm_requested && scanner.has_colors())
|
||||||
|
{
|
||||||
|
std::tie(vcm, created) =
|
||||||
|
sm.template add_property_map<Vertex_index, Color>("v:color", Color(0,0,0));
|
||||||
|
CGAL_assertion(created);
|
||||||
|
is_vcm_requested = true;
|
||||||
|
}
|
||||||
|
if(is_vcm_requested)
|
||||||
|
{
|
||||||
|
VCM vcolors = choose_parameter(get_parameter(np, internal_np::vertex_color_map),
|
||||||
|
vcm);
|
||||||
|
return read_OFF_with_or_without_vtextures(is, sm, scanner, np.vertex_color_map(vcolors));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return read_OFF_with_or_without_vtextures(is, sm, scanner, np);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename Point, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
|
||||||
|
bool read_OFF_with_or_without_vnormals(std::istream& is,
|
||||||
|
Surface_mesh<Point>& sm,
|
||||||
|
const CGAL::File_scanner_OFF& scanner,
|
||||||
|
const CGAL_BGL_NP_CLASS& np)
|
||||||
|
{
|
||||||
|
typedef Surface_mesh<Point> Mesh;
|
||||||
|
typedef typename Mesh::Vertex_index Vertex_index;
|
||||||
|
|
||||||
|
typedef typename GetK<Surface_mesh<Point>, CGAL_BGL_NP_CLASS>::Kernel K;
|
||||||
|
typedef typename K::Vector_3 Normal;
|
||||||
|
using parameters::choose_parameter;
|
||||||
|
using parameters::is_default_parameter;
|
||||||
|
using parameters::get_parameter;
|
||||||
|
typedef typename
|
||||||
|
CGAL::internal::IO::GetVertexNormalMap<Mesh, K, CGAL_BGL_NP_CLASS>::type VNM;
|
||||||
|
|
||||||
|
bool is_vnm_requested =
|
||||||
|
!(is_default_parameter(get_parameter(np, internal_np::vertex_normal_map)));
|
||||||
|
bool created;
|
||||||
|
typename Mesh::template Property_map<Vertex_index, Normal> vnm;
|
||||||
|
|
||||||
|
if(!is_vnm_requested && scanner.has_normals())
|
||||||
|
{
|
||||||
|
std::tie(vnm, created) =
|
||||||
|
sm.template add_property_map<Vertex_index, Normal>("v:normal");
|
||||||
|
CGAL_assertion(created);
|
||||||
|
is_vnm_requested = true;
|
||||||
|
}
|
||||||
|
if(is_vnm_requested){
|
||||||
|
VNM vnormals = choose_parameter(get_parameter(np, internal_np::vertex_normal_map),
|
||||||
|
vnm);
|
||||||
|
return read_OFF_with_or_without_vcolors(is, sm, scanner, np.vertex_normal_map(vnormals));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return read_OFF_with_or_without_vcolors(is, sm, scanner, np);
|
||||||
|
}
|
||||||
|
|
||||||
}//end IO
|
}//end IO
|
||||||
}// end internal
|
}// end internal
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
@ -155,72 +314,13 @@ bool read_OFF(std::istream& is,
|
||||||
|
|
||||||
|
|
||||||
typedef typename CGAL::GetVertexPointMap<Mesh, CGAL_BGL_NP_CLASS>::type VPM;
|
typedef typename CGAL::GetVertexPointMap<Mesh, CGAL_BGL_NP_CLASS>::type VPM;
|
||||||
typedef typename
|
|
||||||
CGAL::internal::IO::GetVertexNormalMap<Mesh, K, CGAL_BGL_NP_CLASS>::type VNM;
|
|
||||||
typedef typename
|
|
||||||
CGAL::internal::IO::GetVertexColorMap<Mesh, CGAL_BGL_NP_CLASS>::type VCM;
|
|
||||||
typedef typename
|
|
||||||
CGAL::internal::IO::GetVertexTextureMap<Mesh, K, CGAL_BGL_NP_CLASS>::type VTM;
|
|
||||||
typedef typename
|
|
||||||
CGAL::internal::IO::GetFaceColorMap<Mesh, CGAL_BGL_NP_CLASS>::type FCM;
|
|
||||||
|
|
||||||
const bool is_vnm_requested =
|
|
||||||
!(is_default_parameter(get_parameter(np, internal_np::vertex_normal_map)));
|
|
||||||
const bool is_vcm_requested =
|
|
||||||
!(is_default_parameter(get_parameter(np, internal_np::vertex_color_map)));
|
|
||||||
const bool is_vtm_requested =
|
|
||||||
!(is_default_parameter(get_parameter(np, internal_np::vertex_texture_map)));
|
|
||||||
const bool is_fcm_requested =
|
|
||||||
!(is_default_parameter(get_parameter(np, internal_np::face_color_map)));
|
|
||||||
|
|
||||||
bool created;
|
|
||||||
typename Mesh::template Property_map<Vertex_index, Normal> vnm;
|
|
||||||
typename Mesh::template Property_map<Vertex_index, Color> vcm;
|
|
||||||
typename Mesh::template Property_map<Vertex_index, Texture> vtm;
|
|
||||||
typename Mesh::template Property_map<Face_index, Color> fcm;
|
|
||||||
|
|
||||||
if(!is_vnm_requested)
|
|
||||||
{
|
|
||||||
std::tie(vnm, created) =
|
|
||||||
sm.template add_property_map<Vertex_index, Normal>("v:normal");
|
|
||||||
CGAL_assertion(created);
|
|
||||||
}
|
|
||||||
if(!is_vcm_requested)
|
|
||||||
{
|
|
||||||
std::tie(vcm, created) =
|
|
||||||
sm.template add_property_map<Vertex_index, Color>("v:color", Color(0,0,0));
|
|
||||||
CGAL_assertion(created);
|
|
||||||
}
|
|
||||||
if(!is_vtm_requested)
|
|
||||||
{
|
|
||||||
std::tie(vtm, created) =
|
|
||||||
sm.template add_property_map<Vertex_index, Texture>("v:texcoord");
|
|
||||||
CGAL_assertion(created);
|
|
||||||
}
|
|
||||||
if(!is_fcm_requested)
|
|
||||||
{
|
|
||||||
std::tie(fcm, created) =
|
|
||||||
sm.template add_property_map<Face_index, Color>("f:color", Color(0,0,0));
|
|
||||||
CGAL_assertion(created);
|
|
||||||
}
|
|
||||||
|
|
||||||
VPM vpm = choose_parameter(get_parameter(np, internal_np::vertex_point),
|
VPM vpm = choose_parameter(get_parameter(np, internal_np::vertex_point),
|
||||||
get_property_map(CGAL::vertex_point, sm));
|
get_property_map(CGAL::vertex_point, sm));
|
||||||
VNM vnormals = choose_parameter(get_parameter(np, internal_np::vertex_normal_map),
|
std::streampos pos = is.tellg();
|
||||||
vnm);
|
CGAL::File_scanner_OFF scanner(is, false);
|
||||||
VCM vcolors = choose_parameter(get_parameter(np, internal_np::vertex_color_map),
|
is.seekg(pos);
|
||||||
vcm);
|
bool res = internal::IO::read_OFF_with_or_without_vnormals(is, sm, scanner, np);
|
||||||
VTM vtextures = choose_parameter(get_parameter(np, internal_np::vertex_texture_map),
|
|
||||||
vtm);
|
|
||||||
FCM fcolors = choose_parameter(get_parameter(np, internal_np::face_color_map),
|
|
||||||
fcm);
|
|
||||||
|
|
||||||
bool res = IO::internal::read_OFF_BGL(is, sm, CGAL::parameters::vertex_point_map(vpm)
|
|
||||||
.vertex_normal_map(vnormals)
|
|
||||||
.vertex_color_map(vcolors)
|
|
||||||
.vertex_texture_map(vtextures)
|
|
||||||
.face_color_map(fcolors),
|
|
||||||
verbose);
|
|
||||||
if(!res)
|
if(!res)
|
||||||
sm.clear();
|
sm.clear();
|
||||||
return res;
|
return res;
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
#include <CGAL/Linear_cell_complex_for_combinatorial_map.h>
|
#include <CGAL/Linear_cell_complex_for_combinatorial_map.h>
|
||||||
|
|
||||||
#include <CGAL/boost/graph/graph_traits_Linear_cell_complex_for_combinatorial_map.h>
|
#include <CGAL/boost/graph/graph_traits_Linear_cell_complex_for_combinatorial_map.h>
|
||||||
#include <CGAL/boost/graph/IO/OFF.h>
|
#include <CGAL/boost/graph/IO/polygon_mesh_io.h>
|
||||||
#include <CGAL/mesh_segmentation.h>
|
#include <CGAL/mesh_segmentation.h>
|
||||||
#include <CGAL/property_map.h>
|
#include <CGAL/property_map.h>
|
||||||
#include <CGAL/Unique_hash_map.h>
|
#include <CGAL/Unique_hash_map.h>
|
||||||
|
|
@ -20,7 +20,7 @@ int main()
|
||||||
{
|
{
|
||||||
// create and read LCC
|
// create and read LCC
|
||||||
LCC mesh;
|
LCC mesh;
|
||||||
CGAL::read_OFF("data/cactus.off", mesh);
|
CGAL::read_polygon_mesh("data/cactus.off", mesh);
|
||||||
|
|
||||||
// create a property-map for SDF values
|
// create a property-map for SDF values
|
||||||
typedef CGAL::Unique_hash_map<Facet_const_handle, double> Facet_double_map;
|
typedef CGAL::Unique_hash_map<Facet_const_handle, double> Facet_double_map;
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_length_cost.h>
|
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_length_cost.h>
|
||||||
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Midpoint_placement.h>
|
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Midpoint_placement.h>
|
||||||
|
|
||||||
#include <CGAL/boost/graph/IO/OFF.h>
|
#include <CGAL/boost/graph/IO/polygon_mesh_io.h>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
@ -24,7 +24,7 @@ int main(int argc, char** argv)
|
||||||
LCC lcc;
|
LCC lcc;
|
||||||
const char* filename = (argc > 1) ? argv[1] : "data/cube-meshed.off";
|
const char* filename = (argc > 1) ? argv[1] : "data/cube-meshed.off";
|
||||||
std::ifstream is(filename);
|
std::ifstream is(filename);
|
||||||
if(!CGAL::read_OFF(filename, lcc))
|
if(!CGAL::read_polygon_mesh(filename, lcc))
|
||||||
{
|
{
|
||||||
std::cerr << "Failed to read input mesh: " << filename << std::endl;
|
std::cerr << "Failed to read input mesh: " << filename << std::endl;
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
#include <CGAL/Linear_cell_complex_for_combinatorial_map.h>
|
#include <CGAL/Linear_cell_complex_for_combinatorial_map.h>
|
||||||
|
|
||||||
#include <CGAL/boost/graph/graph_traits_Linear_cell_complex_for_combinatorial_map.h>
|
#include <CGAL/boost/graph/graph_traits_Linear_cell_complex_for_combinatorial_map.h>
|
||||||
#include <CGAL/boost/graph/IO/OFF.h>
|
#include <CGAL/boost/graph/IO/polygon_mesh_io.h>
|
||||||
#include <CGAL/Mean_curvature_flow_skeletonization.h>
|
#include <CGAL/Mean_curvature_flow_skeletonization.h>
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
@ -24,7 +24,7 @@ typedef Skeleton::edge_descriptor Skeleton_edge;
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
LCC lcc;
|
LCC lcc;
|
||||||
CGAL::read_OFF("data/elephant.off", lcc);
|
CGAL::read_polygon_mesh("data/elephant.off", lcc);
|
||||||
|
|
||||||
Skeleton skeleton;
|
Skeleton skeleton;
|
||||||
Skeletonization mcs(lcc);
|
Skeletonization mcs(lcc);
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
#include <CGAL/boost/graph/graph_traits_Linear_cell_complex_for_combinatorial_map.h>
|
#include <CGAL/boost/graph/graph_traits_Linear_cell_complex_for_combinatorial_map.h>
|
||||||
#include <CGAL/boost/graph/properties_Linear_cell_complex_for_combinatorial_map.h>
|
#include <CGAL/boost/graph/properties_Linear_cell_complex_for_combinatorial_map.h>
|
||||||
#include <CGAL/boost/graph/split_graph_into_polylines.h>
|
#include <CGAL/boost/graph/split_graph_into_polylines.h>
|
||||||
#include <CGAL/boost/graph/IO/OFF.h>
|
#include <CGAL/boost/graph/IO/polygon_mesh_io.h>
|
||||||
#include <CGAL/extract_mean_curvature_flow_skeleton.h>
|
#include <CGAL/extract_mean_curvature_flow_skeleton.h>
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
@ -53,7 +53,7 @@ struct Display_polylines{
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
LCC lcc;
|
LCC lcc;
|
||||||
CGAL::read_OFF("data/elephant.off", lcc);
|
CGAL::read_polygon_mesh("data/elephant.off", lcc);
|
||||||
|
|
||||||
Skeleton skeleton;
|
Skeleton skeleton;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,8 @@
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
#include <CGAL/IO/OFF.h>
|
#include <CGAL/IO/OFF.h>
|
||||||
#include <CGAL/IO/read_off_points.h>
|
#include <CGAL/IO/read_points.h>
|
||||||
#include <CGAL/IO/write_off_points.h>
|
#include <CGAL/IO/write_off_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/Iterator_range.h>
|
#include <CGAL/Iterator_range.h>
|
||||||
|
|
@ -102,20 +101,6 @@ void Scene::loadPointsOFF(const char* filename)
|
||||||
/* 1. use CGAL::File_scanner_OFF to read in data --tested */
|
/* 1. use CGAL::File_scanner_OFF to read in data --tested */
|
||||||
readOFFPointsandFacets( filename, pts );
|
readOFFPointsandFacets( filename, pts );
|
||||||
|
|
||||||
/* 2. use CGAL::read_OFF to read in data -- tested */
|
|
||||||
/* Note: read in points only, i.e. normals and faces are ignored */
|
|
||||||
/* Note: this function can NOT omit comments (starting with '#') */
|
|
||||||
// ifstream fin;
|
|
||||||
// fin.open( filename );
|
|
||||||
// check whether the file is opened properly
|
|
||||||
// if( !fin ) {
|
|
||||||
// showError( QObject::tr("Error: cannot open file %1 for reading.").arg(filename) );
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// if ( !CGAL::read_OFF( fin, // inout ifstream
|
|
||||||
// back_inserter(pts) ) ) { // output iterator over points
|
|
||||||
// showError( QObject::tr("Error: cannot read file %1.").arg(filename) );
|
|
||||||
// }
|
|
||||||
|
|
||||||
/* Insert the points to build a Delaunay triangulation */
|
/* Insert the points to build a Delaunay triangulation */
|
||||||
/* Note: this function returns the number of inserted points;
|
/* Note: this function returns the number of inserted points;
|
||||||
|
|
@ -139,19 +124,11 @@ void Scene::loadPointsOFF(const char* filename)
|
||||||
|
|
||||||
void Scene::loadPointsXYZ(const char* filename)
|
void Scene::loadPointsXYZ(const char* filename)
|
||||||
{
|
{
|
||||||
ifstream fin;
|
|
||||||
fin.open( filename );
|
|
||||||
// Check whether the file is opened properly
|
|
||||||
if( !fin ) {
|
|
||||||
showError( QObject::tr("Error: cannot open file %1 for reading.").arg(filename) );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Use CGAL::read_XYZ to read in data -- tested */
|
/* Use CGAL::read_XYZ to read in data -- tested */
|
||||||
/* Note: this function reads in points only (normals are ignored) */
|
/* Note: this function reads in points only (normals are ignored) */
|
||||||
/* Note: this function can NOT omit comments (starting with '#') */
|
/* Note: this function can NOT omit comments (starting with '#') */
|
||||||
list<Point_3> pts;
|
list<Point_3> pts;
|
||||||
if( !CGAL::read_XYZ( fin, // input ifstream
|
if( !CGAL::read_points( filename, // input ifstream
|
||||||
back_inserter(pts) ) ) { // output iterator over points
|
back_inserter(pts) ) ) { // output iterator over points
|
||||||
showError( QObject::tr("Error: cannot read file %1.").arg(filename) );
|
showError( QObject::tr("Error: cannot read file %1.").arg(filename) );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue