fix functions calls

This commit is contained in:
Maxime Gimeno 2020-05-14 13:46:57 +02:00
parent e81a41f9d7
commit 20898e4b31
27 changed files with 84 additions and 81 deletions

View File

@ -8,7 +8,7 @@
#include <CGAL/Delaunay_triangulation_3.h>
#include <CGAL/Triangulation_vertex_base_with_info_3.h>
#include <CGAL/Advancing_front_surface_reconstruction.h>
#include <CGAL/IO/read_xyz_points.h>
#include <CGAL/IO/read_points.h>
#include <CGAL/disable_warnings.h>
#include <boost/lexical_cast.hpp>
@ -112,10 +112,8 @@ int main (int argc, char* argv[])
const char* fname = (argc>1) ? argv[1] : "data/cube.pwn";
// Loading point set from a file.
std::ifstream stream(fname);
if (!stream ||
!CGAL::read_XYZ(stream,
if (!CGAL::read_points(fname,
std::back_inserter(points),
CGAL::parameters::point_map(Point_map()).
normal_map(Normal_map())))

View File

@ -6,6 +6,7 @@
#include <CGAL/boost/graph/graph_traits_Linear_cell_complex_for_combinatorial_map.h>
#include <CGAL/boost/graph/copy_face_graph.h>
#include <CGAL/boost/graph/IO/OFF.h>
#include <iostream>
#include <fstream>
@ -38,7 +39,7 @@ int main(int argc, char* argv[])
Target1 T1;
{
CGAL::copy_face_graph(S, T1);
CGAL::write_off("lcc.off", T1);
CGAL::write_OFF("lcc.off", T1);
}
S.clear();

View File

@ -1,7 +1,7 @@
#include <CGAL/Simple_cartesian.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 <boost/graph/breadth_first_search.hpp>
@ -20,24 +20,24 @@ typedef boost::graph_traits<LCC>::vertex_iterator vertex_iterator;
int main(int argc, char** argv)
{
LCC lcc;
CGAL::read_OFF((argc>1)?argv[1]:"cube.off", lcc);
CGAL::read_polygon_mesh((argc>1)?argv[1]:"cube.off", lcc);
// This is the vector where the distance gets written to
std::vector<int> distance(lcc.vertex_attributes().size());
std::vector<int> distance(lcc.vertex_attributes().size());
// Here we start at an arbitrary vertex
// Here we start at an arbitrary vertex
// Any other vertex could be the starting point
vertex_iterator vb, ve;
boost::tie(vb,ve)=vertices(lcc);
vertex_descriptor vd = *vb;
std::cout << "We compute distances to " << vd->point() << std::endl;
// bfs = breadth first search explores the graph
// Just as the distance_recorder there is a way to record the predecessor of a vertex
// Just as the distance_recorder there is a way to record the predecessor of a vertex
boost::breadth_first_search(lcc,
vd,
visitor(boost::make_bfs_visitor
vd,
visitor(boost::make_bfs_visitor
(boost::record_distances
(make_iterator_property_map
(distance.begin(),
@ -50,6 +50,6 @@ int main(int argc, char** argv)
vd = *vb;
std::cout<<vd->point()<<" is "<<distance[vd->id()]<<" hops away."<<std::endl;
}
return 0;
}

View File

@ -2,7 +2,7 @@
#include <CGAL/boost/graph/graph_traits_Linear_cell_complex_for_combinatorial_map.h>
#include <CGAL/boost/graph/iterator.h>
#include <CGAL/boost/graph/IO/OFF.h>
#include <CGAL/boost/graph/IO/polygon_mesh_io.h>
#include <iostream>
#include <fstream>
@ -51,7 +51,7 @@ OutputIterator adjacent_vertices_V2(const LCC& g,
int main(int argc, char** argv)
{
LCC lcc;
CGAL::read_OFF((argc>1)?argv[1]:"cube.off", lcc);
CGAL::read_polygon_mesh((argc>1)?argv[1]:"cube.off", lcc);
GraphTraits::vertex_iterator vi = vertices(lcc).first;
std::list<vertex_descriptor> V;

View File

@ -1,7 +1,7 @@
#include <CGAL/Simple_cartesian.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/property_map.h>
#include <boost/graph/graph_traits.hpp>
@ -17,12 +17,12 @@ typedef CGAL::Linear_cell_complex_traits<3, Kernel> LCC_traits;
typedef CGAL::Linear_cell_complex_for_bgl_combinatorial_map_helper
<2, 3, LCC_traits>::type LCC;
template<typename HalfedgeGraph,
typename PointMap,
template<typename HalfedgeGraph,
typename PointMap,
typename NormalMap>
void calculate_face_normals(const HalfedgeGraph& g,
PointMap pm,
NormalMap nm)
void calculate_face_normals(const HalfedgeGraph& g,
PointMap pm,
NormalMap nm)
{
typedef boost::graph_traits<HalfedgeGraph> GraphTraits;
typedef typename GraphTraits::face_iterator face_iterator;
@ -42,7 +42,7 @@ void calculate_face_normals(const HalfedgeGraph& g,
edg = next(edg, g);
point p2 = pm[target(edg, g)];
edg = next(edg, g);
if(edg == edgb) {
// triangle
nm[*fb] = CGAL::unit_normal(p1, p2, p0);
@ -54,11 +54,11 @@ void calculate_face_normals(const HalfedgeGraph& g,
n = n + CGAL::normal(p1, p2, p0);
p0 = p1;
p1 = p2;
edg = next(edg, g);
p2 = pm[target(edg, g)];
} while(edg != edgb);
nm[*fb] = n / CGAL::sqrt(n.squared_length());
}
}
@ -70,13 +70,13 @@ int main(int argc, char** argv)
Face_index_map;
LCC lcc;
CGAL::read_OFF((argc>1)?argv[1]:"cube.off", lcc);
CGAL::read_polygon_mesh((argc>1)?argv[1]:"cube.off", lcc);
// Ad hoc property_map to store normals. Face_index_map is used to
// map face_descriptors to a contiguous range of indices. See
// http://www.boost.org/libs/property_map/doc/vector_property_map.html
// for details.
boost::vector_property_map<Vector, Face_index_map>
boost::vector_property_map<Vector, Face_index_map>
normals(get(CGAL::face_index, lcc));
calculate_face_normals(
@ -88,7 +88,7 @@ int main(int argc, char** argv)
std::cout << "Normals" << std::endl;
for(LCC::Attribute_range<2>::type::iterator it=lcc.attributes<2>().begin();
it!=lcc.attributes<2>().end(); ++it)
{
{
// Facet_iterator is a face_descriptor, so we can use it as the
// key here
std::cout << normals[it] << std::endl;

View File

@ -2,7 +2,7 @@
#include <CGAL/Iterator_range.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 <iostream>
#include <fstream>
@ -36,15 +36,15 @@ struct Fct
void fct(const LCC& lcc)
{
vertex_range vr(vertices(lcc));
std::cout << "new for loop" << std::endl;
for(vertex_descriptor vd : vr){
std::cout << vd->point() << std::endl;
}
std::cout << "boost::tie + std::for_each" << std::endl;
vertex_iterator vb, ve;
boost::tie(vb,ve) = vertices_range(lcc);
std::for_each(vb,ve, Fct());
}
@ -52,7 +52,7 @@ void fct(const LCC& lcc)
int main(int argc, char** argv)
{
LCC lcc;
CGAL::read_OFF((argc>1)?argv[1]:"cube.off", lcc);
CGAL::read_polygon_mesh((argc>1)?argv[1]:"cube.off", lcc);
fct(lcc);
return 0;

View File

@ -3,7 +3,7 @@
#include <CGAL/boost/graph/graph_traits_Linear_cell_complex_for_combinatorial_map.h>
#include <CGAL/boost/graph/iterator.h>
#include <CGAL/boost/iterator/transform_iterator.hpp>
#include <CGAL/boost/graph/IO/OFF.h>
#include <CGAL/boost/graph/IO/polygon_mesh_io.h>
#include <algorithm>
#include <fstream>
@ -21,7 +21,7 @@ typedef CGAL::Halfedge_around_target_iterator<LCC> halfedge_around_target_iterat
template <typename G>
struct Source {
const G* g;
const G* g;
Source()
: g(NULL)
@ -43,17 +43,17 @@ struct Source {
int main(int argc, char** argv)
{
LCC lcc;
CGAL::read_OFF((argc>1)?argv[1]:"cube.off", lcc);
CGAL::read_polygon_mesh((argc>1)?argv[1]:"cube.off", lcc);
GraphTraits::vertex_descriptor vd = *(vertices(lcc).first);
typedef boost::transform_iterator<Source<LCC>,halfedge_around_target_iterator> adjacent_vertex_iterator;
typedef boost::transform_iterator<Source<LCC>,halfedge_around_target_iterator> adjacent_vertex_iterator;
halfedge_around_target_iterator hb,he;
boost::tie(hb,he) = halfedges_around_target(halfedge(vd,lcc),lcc);
adjacent_vertex_iterator avib, avie;
avib = boost::make_transform_iterator(hb, Source<LCC>(lcc));
avie = boost::make_transform_iterator(he, Source<LCC>(lcc));
std::list<vertex_descriptor> V;
std::copy(avib,avie, std::back_inserter(V));
return 0;

View File

@ -33,7 +33,7 @@ int main(int argc, char** argv )
for(halfedge_descriptor hd : CGAL::halfedges_around_target(vd,mesh)){
if(! CGAL::is_border(edge(hd,mesh),mesh)){
CGAL::Euler::flip_edge(hd,mesh);
CGAL::write_off((argc>2)?argv[2]:"out.off", mesh);
CGAL::write_OFF((argc>2)?argv[2]:"out.off", mesh);
return 0;
}
}

View File

@ -1,6 +1,7 @@
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/boost/graph/selection.h>
#include <CGAL/boost/graph/IO/OFF.h>
#include <fstream>
#include <iostream>
@ -20,7 +21,7 @@ int main(int argc, char** argv)
}
Mesh mesh;
CGAL::read_off (in, mesh);
CGAL::read_OFF (in, mesh);
boost::unordered_map<Face_index, bool> is_selected_map;

View File

@ -47,7 +47,7 @@ int main(int argc, char** argv)
// Output the mesh extracted from subpart n°0
std::ofstream out("sm_part_0.off");
out.precision(17);
CGAL::write_off(out, part_sm);
CGAL::write_OFF(out, part_sm);
// Output all the vertices that are in the part n°0
std::ofstream outxyz("out.xyz");

View File

@ -139,10 +139,10 @@ bool write_STL(std::ostream& out,
const float coords[12] =
{
static_cast<float>(n.x()), static_cast<float>(n.y()), static_cast<float>(n.z()),
static_cast<float>(p.x()), static_cast<float>(p.y()), static_cast<float>(p.z()),
static_cast<float>(q.x()), static_cast<float>(q.y()), static_cast<float>(q.z()),
static_cast<float>(r.x()), static_cast<float>(r.y()), static_cast<float>(r.z()) };
static_cast<float>(to_double(n.x())), static_cast<float>(to_double(n.y())), static_cast<float>(to_double(n.z())),
static_cast<float>(to_double(p.x())), static_cast<float>(to_double(p.y())), static_cast<float>(to_double(p.z())),
static_cast<float>(to_double(q.x())), static_cast<float>(to_double(q.y())), static_cast<float>(to_double(q.z())),
static_cast<float>(to_double(r.x())), static_cast<float>(to_double(r.y())), static_cast<float>(to_double(r.z())) };
for(int i=0; i<12; ++i)
out.write(reinterpret_cast<const char *>(&coords[i]), sizeof(coords[i]));

View File

@ -144,10 +144,11 @@ bool write_polygon_mesh(const std::string& fname,
if (fname.find(".stl") != std::string::npos) {
return write_STL(fname, g, np);
}
#ifdef CGAL_USE_VTK
if (fname.find(".vtp") != std::string::npos) {
return write_VTP(fname, g, np);
}
#endif
return false;
}

View File

@ -19,7 +19,7 @@ int main (int argc, char** argv)
Point_set point_set;
point_set.add_normal_map();
// Reading input in OFF format
if (!f || !CGAL::read_off_points
if (!f || !CGAL::read_OFF
(f,
point_set.index_back_inserter(), // OutputIterator
CGAL::parameters::point_map(point_set.point_push_map()).

View File

@ -53,7 +53,7 @@ int main (int argc, char** argv)
{
std::ofstream out ("out.ply");
out.precision(17); // Use sufficient precision in ASCII
CGAL::write_ply_point_set (out, point_set); // same as `out << point_set`
CGAL::write_PLY (out, point_set); // same as `out << point_set`
}
return 0;

View File

@ -1,6 +1,6 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Point_set_3.h>
#include <CGAL/Point_set_3/IO.h>
#include <CGAL/Point_set_3/point_set_io.h>
#include <fstream>
#include <limits>
@ -19,7 +19,7 @@ int main (int argc, char** argv)
Point_set point_set;
// Reading input in XYZ format
if (!f || !CGAL::read_XYZ (f, point_set))
if (!f || !CGAL::read_XYZ(f, point_set))
{
std::cerr << "Can't read input file " << std::endl;
return EXIT_FAILURE;

View File

@ -36,7 +36,7 @@ int main(int argc, char*argv[])
}
// Saves point set.
// Note: write_xyz_points() requires property maps to access each
// Note: write_XYZ() requires property maps to access each
// point position and normal.
std::ofstream out("oni_copy.xyz");
out.precision(17);

View File

@ -27,7 +27,7 @@ int main(int argc, const char** argv)
std::vector<Pwn> pwns1, pwns2;
std::ifstream input(fname1);
if (!input ||
!CGAL::read_PLY_points(input, std::back_inserter(pwns1),
!CGAL::read_PLY(input, std::back_inserter(pwns1),
CGAL::parameters::point_map (CGAL::First_of_pair_property_map<Pwn>()).
normal_map (Normal_map())))
{
@ -38,7 +38,7 @@ int main(int argc, const char** argv)
input.open(fname2);
if (!input ||
!CGAL::read_PLY_points(input, std::back_inserter(pwns2),
!CGAL::read_PLY(input, std::back_inserter(pwns2),
CGAL::parameters::point_map (Point_map()).
normal_map (Normal_map())))
{

View File

@ -30,7 +30,7 @@ int main(int argc, const char** argv)
std::vector<Pwn> pwns1, pwns2;
std::ifstream input(fname1);
if (!input ||
!CGAL::read_PLY_points(input, std::back_inserter(pwns1),
!CGAL::read_PLY(input, std::back_inserter(pwns1),
CGAL::parameters::point_map (CGAL::First_of_pair_property_map<Pwn>()).
normal_map (Normal_map())))
{
@ -41,7 +41,7 @@ int main(int argc, const char** argv)
input.open(fname2);
if (!input ||
!CGAL::read_PLY_points(input, std::back_inserter(pwns2),
!CGAL::read_PLY(input, std::back_inserter(pwns2),
CGAL::parameters::point_map (Point_map()).
normal_map (Normal_map())))
{

View File

@ -545,7 +545,6 @@ read_off_points(
}
#else
typename CGAL_BGL_NP_TEMPLATE_PARAMETERS
template <typename OutputIteratorValueType,
typename OutputIterator,
typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>

View File

@ -123,7 +123,7 @@ int main(int argc, char * argv[])
// If XYZ file format:
std::ifstream stream(input_filename.c_str());
if(stream &&
CGAL::read_xyz_points
CGAL::read_XYZ
(stream,
std::back_inserter(points),
CGAL::parameters::point_map(CGAL::First_of_pair_property_map<PointVectorPair>()).

View File

@ -311,7 +311,7 @@ int main(int argc, char * argv[])
{
std::ifstream stream(input_filename.c_str());
success = stream &&
CGAL::read_off_points(stream,
CGAL::read_OFF(stream,
std::back_inserter(points),
CGAL::parameters::normal_map
(CGAL::make_normal_of_point_with_normal_map(PointList::value_type()))

View File

@ -33,7 +33,7 @@ std::cout << "=== test_fandisk ===\n";
cov.reserve(nb_points);
std::ifstream stream("data/fandisk.off");
if (!stream ||
!CGAL::read_off_points(stream,
!CGAL::read_OFF(stream,
std::back_inserter(points),
CGAL::parameters::point_map(pmap)))
{

View File

@ -2,6 +2,7 @@
#include <CGAL/boost/graph/graph_traits_Linear_cell_complex_for_combinatorial_map.h>
#include <CGAL/Polygon_mesh_processing/corefinement.h>
#include <CGAL/Polygon_mesh_processing/IO/polygon_mesh_io.h>
#include <fstream>
@ -20,8 +21,8 @@ int main(int argc, char* argv[])
std::ifstream input(filename1);
LCC mesh1, mesh2;
CGAL::read_OFF(filename1, mesh1);
CGAL::read_OFF(filename2, mesh2);
CGAL::Polygon_mesh_processing::IO::read_polygon_mesh(filename1, mesh1);
CGAL::Polygon_mesh_processing::IO::read_polygon_mesh(filename2, mesh2);
std::cout << "Number of vertices before corefinement "
<< num_vertices(mesh1) << " and "
@ -35,10 +36,10 @@ int main(int argc, char* argv[])
std::ofstream output("mesh1_refined.off");
output.precision(17);
CGAL::write_off(output, mesh1);
CGAL::write_OFF(output, mesh1);
output.close();
output.open("mesh2_refined.off");
CGAL::write_off(output, mesh2);
CGAL::write_OFF(output, mesh2);
output.close();
return 0;

View File

@ -3,6 +3,7 @@
#include <CGAL/Linear_cell_complex_constructors.h>
#include <CGAL/Polygon_mesh_processing/triangulate_hole.h>
#include <CGAL/Polygon_mesh_processing/IO/polygon_mesh_io.h>
#include <iostream>
#include <fstream>
@ -23,7 +24,7 @@ int main(int argc, char* argv[])
{
const char* filename = (argc > 1) ? argv[1] : "data/mech-holes-shark.off";
LCC mesh;
CGAL::read_OFF(filename, mesh);
CGAL::Polygon_mesh_processing::IO::read_polygon_mesh(filename, mesh);
// Incrementally fill the holes
unsigned int nb_holes = 0;
@ -53,10 +54,10 @@ int main(int argc, char* argv[])
std::cout << std::endl;
std::cout << nb_holes << " holes have been filled" << std::endl;
std::ofstream out("filled_LCC.off");
out.precision(17);
CGAL::write_off(out, mesh);
CGAL::write_OFF(out, mesh);
return 0;
}

View File

@ -7,6 +7,7 @@
#include <CGAL/iterator.h>
#include <CGAL/Polygon_mesh_processing/intersection.h>
#include <CGAL/Polygon_mesh_processing/IO/polygon_mesh_io.h>
#include <CGAL/Timer.h>
#include <iostream>
@ -27,13 +28,13 @@ template <class TriangleMesh>
void run(const char* filename1, const char* filename2, const char* msg)
{
TriangleMesh mesh1;
if ( !CGAL::read_OFF(filename1, mesh1) ) {
if ( !CGAL::Polygon_mesh_processing::IO::read_polygon_mesh(filename1, mesh1) ) {
std::cerr << filename1 << " is not a valid off file.\n";
exit(1);
}
TriangleMesh mesh2;
if ( !CGAL::read_OFF(filename2, mesh2) ) {
if ( !CGAL::Polygon_mesh_processing::IO::read_polygon_mesh(filename2, mesh2) ) {
std::cerr << filename2 << " is not a valid off file.\n";
exit(1);
}

View File

@ -49,7 +49,7 @@ bool Polyhedron_demo_gocad_plugin::canLoad(QFileInfo) const {
QList<Scene_item*>
Polyhedron_demo_gocad_plugin::load(QFileInfo fileinfo, bool& ok, bool add_to_scene) {
// Open file
std::ifstream in(fileinfo.filePath().toUtf8());
if(!in) {
@ -57,8 +57,8 @@ Polyhedron_demo_gocad_plugin::load(QFileInfo fileinfo, bool& ok, bool add_to_sce
ok = false;
return QList<Scene_item*>();
}
CGAL::Timer t;
t.start();
// Try to read GOCAD file in a surface_mesh
@ -73,8 +73,8 @@ Polyhedron_demo_gocad_plugin::load(QFileInfo fileinfo, bool& ok, bool add_to_sce
}
SMesh& P = * const_cast<SMesh*>(item->polyhedron());
std::string name, color;
if(! read_GOCAD(in, name, color, P))
std::pair<std::string,std::string> name_and_color;
if(! CGAL::read_GOCAD(in, name_and_color, P))
{
std::cerr << "Error: Invalid polyhedron" << std::endl;
delete item;
@ -84,12 +84,12 @@ Polyhedron_demo_gocad_plugin::load(QFileInfo fileinfo, bool& ok, bool add_to_sce
t.stop();
std::cerr << "Reading took " << t.time() << " sec." << std::endl;
if(name.size() == 0){
if(name_and_color.first.size() == 0){
item->setName(fileinfo.baseName());
} else {
item->setName(name.c_str());
item->setName(name_and_color.first.c_str());
}
QColor qcolor(color.c_str());
QColor qcolor(name_and_color.second.c_str());
if(qcolor.isValid())
{
item->setColor(qcolor);
@ -114,14 +114,14 @@ save(QFileInfo fileinfo,QList<CGAL::Three::Scene_item*>& items)
// This plugin supports polyhedrons
const Scene_surface_mesh_item* sm_item =
qobject_cast<const Scene_surface_mesh_item*>(item);
if(!sm_item)
return false;
std::ofstream out(fileinfo.filePath().toUtf8());
out.precision (std::numeric_limits<double>::digits10 + 2);
SMesh* poly = const_cast<SMesh*>(sm_item->polyhedron());
write_GOCAD(out, qPrintable(fileinfo.baseName()), *poly);
CGAL::write_GOCAD(out, qPrintable(fileinfo.baseName()), *poly);
items.pop_front();
return true;

View File

@ -222,7 +222,7 @@ bool read_PLY(std::istream& is,
{
std::vector<std::pair<unsigned int, unsigned int> > dummy_pui;
std::vector<std::pair<float, float> > dummy_pf;
return IO::internal::read_PLY(is, points, polygons, dummy_pui, std::back_inserter(fcolors), std::back_inserter(vcolors), dummy_pf, verbose);
return IO::internal::read_PLY(is, points, polygons, std::back_inserter(dummy_pui), std::back_inserter(fcolors), std::back_inserter(vcolors), std::back_inserter(dummy_pf), verbose);
}