mirror of https://github.com/CGAL/cgal
Various IO compilation fixes
This commit is contained in:
parent
31044f8e1e
commit
d5d8cca92b
|
|
@ -1,11 +1,12 @@
|
|||
#include <CGAL/Simple_cartesian.h>
|
||||
#include <CGAL/Surface_mesh.h>
|
||||
|
||||
#include <CGAL/boost/graph/Euler_operations.h>
|
||||
#include <CGAL/Real_timer.h>
|
||||
#include <CGAL/IO/polygon_soup_io.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <CGAL/IO/OFF_reader.h>
|
||||
#include <CGAL/boost/graph/Euler_operations.h>
|
||||
|
||||
#include <CGAL/Real_timer.h>
|
||||
|
||||
typedef CGAL::Simple_cartesian<double> Kernel;
|
||||
typedef CGAL::Surface_mesh<Kernel::Point_3> Mesh;
|
||||
|
|
@ -25,39 +26,50 @@ int main(int argc, char** argv)
|
|||
{
|
||||
{
|
||||
std::cout << "Reading from stream\n";
|
||||
Mesh m;
|
||||
CGAL::Real_timer timer;
|
||||
timer.start();
|
||||
std::ifstream in((argc>1) ? argv[1] : "data/genus3.off");
|
||||
in >> m;
|
||||
timer.stop();
|
||||
|
||||
Mesh m;
|
||||
const char* filename = (argc>1) ? argv[1] : "data/genus3.off";
|
||||
CGAL::read_polygon_mesh(filename, m);
|
||||
|
||||
std::cout << " is_valid? " << CGAL::is_valid_polygon_mesh(m) << "\n";
|
||||
std::cout << "Total time: " << timer.time() << std::endl << std::endl;
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
|
||||
{
|
||||
std::cout << "Reading from soup + iterative add_face\n";
|
||||
Mesh m;
|
||||
|
||||
CGAL::Real_timer timer;
|
||||
timer.start();
|
||||
std::ifstream in((argc>1) ? argv[1] : "data/blobby.off");
|
||||
|
||||
const char* filename = (argc>1) ? argv[1] : "data/blobby.off";
|
||||
std::vector<Kernel::Point_3> points;
|
||||
std::vector<std::array<std::size_t, 3> > faces_ids;
|
||||
std::vector<std::array<Mesh::Vertex_index, 3> > triangles;
|
||||
CGAL::read_OFF(in, points, faces_ids);
|
||||
convert_to_vertex_triples(faces_ids, triangles);
|
||||
CGAL::read_polygon_soup(filename, points, faces_ids);
|
||||
std::cout << " Read soup: " << timer.time() << std::endl;
|
||||
|
||||
std::vector<std::array<Mesh::Vertex_index, 3> > triangles;
|
||||
convert_to_vertex_triples(faces_ids, triangles);
|
||||
|
||||
Mesh m;
|
||||
m.reserve(static_cast<Mesh::size_type>(points.size()),
|
||||
static_cast<Mesh::size_type>(3*triangles.size()/2),
|
||||
static_cast<Mesh::size_type>(triangles.size()));
|
||||
for (const Kernel::Point_3& pt : points)
|
||||
m.add_vertex(pt);
|
||||
|
||||
CGAL::Real_timer subtimer;
|
||||
subtimer.start();
|
||||
|
||||
for (const std::array<Mesh::Vertex_index, 3>& t : triangles)
|
||||
CGAL::Euler::add_face(t, m);
|
||||
|
||||
subtimer.stop();
|
||||
timer.stop();
|
||||
|
||||
std::cout << " is_valid? " << CGAL::is_valid_polygon_mesh(m) << "\n";
|
||||
std::cout << " time for iterative add_face: " << subtimer.time() << std::endl;
|
||||
std::cout << "Total time: " << timer.time() << std::endl << std::endl;
|
||||
|
|
@ -65,26 +77,35 @@ int main(int argc, char** argv)
|
|||
////////////////////////////////
|
||||
{
|
||||
std::cout << "Reading from soup + add_faces\n";
|
||||
Mesh m;
|
||||
|
||||
CGAL::Real_timer timer;
|
||||
timer.start();
|
||||
std::ifstream in((argc>1) ? argv[1] : "data/blobby.off");
|
||||
|
||||
const char* filename = (argc>1) ? argv[1] : "data/blobby.off";
|
||||
|
||||
std::vector<Kernel::Point_3> points;
|
||||
std::vector<std::array<std::size_t, 3> > faces_ids;
|
||||
std::vector<std::array<Mesh::Vertex_index, 3> > triangles;
|
||||
CGAL::read_OFF(in, points, faces_ids);
|
||||
convert_to_vertex_triples(faces_ids, triangles);
|
||||
CGAL::read_polygon_soup(filename, points, faces_ids);
|
||||
std::cout << " Read soup: " << timer.time() << std::endl;
|
||||
|
||||
std::vector<std::array<Mesh::Vertex_index, 3> > triangles;
|
||||
convert_to_vertex_triples(faces_ids, triangles);
|
||||
|
||||
Mesh m;
|
||||
m.reserve(static_cast<Mesh::size_type>(points.size()),
|
||||
static_cast<Mesh::size_type>(3*triangles.size()/2),
|
||||
static_cast<Mesh::size_type>(triangles.size()));
|
||||
for (const Kernel::Point_3& pt : points)
|
||||
m.add_vertex(pt);
|
||||
|
||||
CGAL::Real_timer subtimer;
|
||||
subtimer.start();
|
||||
|
||||
CGAL::Euler::add_faces(triangles, m);
|
||||
|
||||
subtimer.stop();
|
||||
timer.stop();
|
||||
|
||||
std::cout << " is_valid? " << CGAL::is_valid_polygon_mesh(m) << "\n";
|
||||
std::cout << " time for add_faces: " << subtimer.time() << std::endl;
|
||||
std::cout << "Total time: " << timer.time() << std::endl;
|
||||
|
|
|
|||
|
|
@ -350,7 +350,7 @@ void test_bgl_OFF(const char* filename)
|
|||
//@todo test multi objects in a single file
|
||||
|
||||
// test wrong inputs
|
||||
std::cerr<<"Error text is expected to follow."<<std::endl;
|
||||
std::cerr << "Error text is expected to follow." << std::endl;
|
||||
ok = CGAL::read_OFF("data/mesh_that_doesnt_exist.off", fg);
|
||||
assert(!ok);
|
||||
ok = CGAL::read_OFF("data/invalid_cut.off", fg); // cut in half
|
||||
|
|
@ -363,7 +363,7 @@ void test_bgl_OFF(const char* filename)
|
|||
assert(!ok);
|
||||
ok = CGAL::read_OFF("data/pig.stl", fg);
|
||||
assert(!ok);
|
||||
std::cerr<<"No more error text from here."<<std::endl;
|
||||
std::cerr << "No more error text from here." << std::endl;
|
||||
}
|
||||
|
||||
template<typename Mesh, typename K>
|
||||
|
|
@ -398,10 +398,8 @@ void test_bgl_OBJ(const std::string filename)
|
|||
assert(ok);
|
||||
assert(are_equal_meshes(fg, fg2));
|
||||
}
|
||||
// Test NPs
|
||||
typedef typename K::Vector_3 Vector;
|
||||
typedef typename boost::property_map<Mesh, CGAL::dynamic_vertex_property_t<Vector> >::type VertexNormalMap;
|
||||
|
||||
// Test NPs
|
||||
CGAL::clear(fg);
|
||||
ok = CGAL::read_OBJ("data/sphere.obj", fg);
|
||||
assert(ok);
|
||||
|
|
@ -432,7 +430,7 @@ void test_bgl_OBJ(const std::string filename)
|
|||
}
|
||||
|
||||
// test wrong inputs
|
||||
std::cerr<<"Error text is expected to follow."<<std::endl;
|
||||
std::cerr << "Error text is expected to follow." << std::endl;
|
||||
ok = CGAL::read_OBJ("data/mesh_that_doesnt_exist.obj", fg);
|
||||
assert(!ok);
|
||||
ok = CGAL::read_OBJ("data/invalid_cut.obj", fg); // invalid vertex ids
|
||||
|
|
@ -441,7 +439,7 @@ void test_bgl_OBJ(const std::string filename)
|
|||
assert(!ok);
|
||||
ok = CGAL::read_OBJ("data/pig.stl", fg);
|
||||
assert(!ok);
|
||||
std::cerr<<"No more error text from here."<<std::endl;
|
||||
std::cerr << "No more error text from here." << std::endl;
|
||||
}
|
||||
|
||||
template<class Mesh>
|
||||
|
|
@ -606,8 +604,6 @@ void test_bgl_STL(const std::string filename)
|
|||
assert(filename != "data/pig.stl" || (num_vertices(fg) == 8642 && num_faces(fg) == 16848));
|
||||
assert(filename != "data/pig.stl" || cpoints.size() == 8642);
|
||||
|
||||
|
||||
|
||||
// write with STL
|
||||
{
|
||||
std::ofstream os("tmp.stl");
|
||||
|
|
@ -631,7 +627,7 @@ void test_bgl_STL(const std::string filename)
|
|||
assert(num_vertices(fg) == num_vertices(fg2) && num_faces(fg) == num_faces(fg2));
|
||||
}
|
||||
|
||||
std::cerr<<"Error text is expected to follow."<<std::endl;
|
||||
std::cerr << "Error text is expected to follow." << std::endl;
|
||||
ok = CGAL::read_STL("data/mesh_that_doesnt_exist.stl", fg);
|
||||
assert(!ok);
|
||||
ok = CGAL::read_STL("data/invalid_cut.stl", fg); // cut in half
|
||||
|
|
@ -642,7 +638,7 @@ void test_bgl_STL(const std::string filename)
|
|||
assert(!ok);
|
||||
ok = CGAL::read_STL("data/full.off", fg);
|
||||
assert(!ok);
|
||||
std::cerr<<"No more error text from here."<<std::endl;
|
||||
std::cerr << "No more error text from here." << std::endl;
|
||||
}
|
||||
|
||||
template<class Mesh>
|
||||
|
|
@ -678,7 +674,7 @@ void test_bgl_GOCAD(const char* filename)
|
|||
|
||||
// write with PM
|
||||
{
|
||||
ok = CGAL::write_polygon_mesh("tmp.ts", fg);
|
||||
ok = CGAL::write_polygon_mesh("tmp.ts", fg, CGAL::parameters::stream_precision(10));
|
||||
assert(ok);
|
||||
|
||||
Mesh fg2;
|
||||
|
|
@ -708,8 +704,7 @@ void test_bgl_GOCAD(const char* filename)
|
|||
assert(num_faces(fg2) == 24191);
|
||||
}
|
||||
|
||||
|
||||
std::cerr<<"Error text is expected to follow."<<std::endl;
|
||||
std::cerr << "Error text is expected to follow." << std::endl;
|
||||
ok = CGAL::read_GOCAD("data/mesh_that_doesnt_exist.ts", fg);
|
||||
assert(!ok);
|
||||
ok = CGAL::read_GOCAD("data/invalid_cut.ts", fg); // cut in half
|
||||
|
|
@ -720,7 +715,7 @@ void test_bgl_GOCAD(const char* filename)
|
|||
assert(!ok);
|
||||
ok = CGAL::read_GOCAD("data/full.off", fg);
|
||||
assert(!ok);
|
||||
std::cerr<<"No more error text from here."<<std::endl;
|
||||
std::cerr << "No more error text from here." << std::endl;
|
||||
}
|
||||
|
||||
#ifdef CGAL_USE_VTK
|
||||
|
|
@ -731,7 +726,8 @@ void test_bgl_VTP(const char* filename,
|
|||
Mesh fg;
|
||||
bool ok = CGAL::read_VTP(filename, fg);
|
||||
assert(ok);
|
||||
assert(filename != "data/bones.vtp" || (num_vertices(fg) == 2154 && num_faces(fg) == 4204));
|
||||
assert(std::string(filename) != "data/bones.vtp" ||
|
||||
(num_vertices(fg) == 2154 && num_faces(fg) == 4204));
|
||||
|
||||
// write with VTP
|
||||
{
|
||||
|
|
@ -782,9 +778,6 @@ void test_bgl_VTP(const char* filename,
|
|||
assert(are_equal_meshes(fg, get(CGAL::vertex_point, fg), fg2, vpm2, vim1, vim2));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// write with VTP
|
||||
{
|
||||
std::ofstream os("tmp.vtp");
|
||||
|
|
@ -813,11 +806,10 @@ void test_bgl_VTP(const char* filename,
|
|||
ok = CGAL::read_polygon_mesh("tmp.vtp", fg2);
|
||||
assert(ok);
|
||||
assert(are_equal_meshes(fg, fg2));
|
||||
|
||||
}
|
||||
|
||||
// test wrong inputs
|
||||
std::cerr<<"Error text is expected to follow."<<std::endl;
|
||||
std::cerr << "Error text is expected to follow." << std::endl;
|
||||
ok = CGAL::read_VTP("data/mesh_that_doesnt_exist.vtp", fg);
|
||||
assert(!ok);
|
||||
ok = CGAL::read_VTP("data/invalid_cut.vtp", fg); // cut in half
|
||||
|
|
@ -832,10 +824,9 @@ void test_bgl_VTP(const char* filename,
|
|||
assert(!ok);
|
||||
ok = CGAL::read_VTP("corrupted_bin.vtp", fg);
|
||||
assert(!ok);
|
||||
std::cerr<<"No more error text from here."<<std::endl;
|
||||
std::cerr << "No more error text from here." << std::endl;
|
||||
}
|
||||
|
||||
|
||||
#endif // CGAL_USE_VTK
|
||||
|
||||
int main(int argc, char** argv)
|
||||
|
|
|
|||
|
|
@ -1,23 +1,21 @@
|
|||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
#include <CGAL/Polyhedron_3.h>
|
||||
#include <CGAL/Surface_mesh.h>
|
||||
|
||||
#include <CGAL/convex_hull_3.h>
|
||||
|
||||
#include <vector>
|
||||
#include <fstream>
|
||||
|
||||
|
||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
|
||||
typedef CGAL::Polyhedron_3<K> Polyhedron_3;
|
||||
typedef K::Point_3 Point_3;
|
||||
typedef CGAL::Surface_mesh<Point_3> Surface_mesh;
|
||||
|
||||
typedef K::Point_3 Point_3;
|
||||
typedef CGAL::Surface_mesh<Point_3> Surface_mesh;
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
std::ifstream in( (argc>1)? argv[1] : "data/cross.off");
|
||||
const char* filename = (argc>1)? argv[1] : "data/cross.off";
|
||||
|
||||
Surface_mesh poly;
|
||||
if(!in || !(in >> poly))
|
||||
if(!CGAL::read_polygon_mesh(filename, poly))
|
||||
{
|
||||
std::cerr<<"Could not find a correct input file."<<std::endl;
|
||||
return 1;
|
||||
|
|
|
|||
|
|
@ -6,10 +6,7 @@
|
|||
|
||||
#include <CGAL/convex_hull_3.h>
|
||||
#include <CGAL/Timer.h>
|
||||
|
||||
#include <CGAL/IO/OFF_reader.h>
|
||||
#include <CGAL/IO/STL_reader.h>
|
||||
#include <CGAL/IO/OBJ_reader.h>
|
||||
#include <CGAL/IO/polygon_soup_io.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
|
@ -24,51 +21,15 @@ typedef K::Point_3 Point_3;
|
|||
typedef CGAL::Surface_mesh<Point_3> Surface_mesh;
|
||||
typedef typename boost::graph_traits<Surface_mesh>::vertex_descriptor vertex_descriptor;
|
||||
|
||||
template <typename Point>
|
||||
bool read_mesh(const std::string filename,
|
||||
std::vector<Point>& points)
|
||||
{
|
||||
std::ifstream in(filename.c_str());
|
||||
if(!in.good())
|
||||
{
|
||||
// std::cerr << "Error: can't read file at " << filename << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<std::vector<std::size_t> > unused_faces;
|
||||
|
||||
std::string fn(filename);
|
||||
if(fn.substr(fn.find_last_of(".") + 1) == "stl")
|
||||
{
|
||||
if(!CGAL::read_STL(in, points, unused_faces))
|
||||
return false;
|
||||
}
|
||||
else if(fn.substr(fn.find_last_of(".") + 1) == "obj")
|
||||
{
|
||||
if(!CGAL::read_OBJ(in, points, unused_faces))
|
||||
return false;
|
||||
}
|
||||
else if(fn.substr(fn.find_last_of(".") + 1) == "off")
|
||||
{
|
||||
if(!CGAL::read_OFF(in, points, unused_faces))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// std::cerr << "Error: unsupported file format: " << filename << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void bench_finding_obb(const std::string filename,
|
||||
const int iter)
|
||||
{
|
||||
CGAL::Timer timer;
|
||||
|
||||
std::vector<Point_3> points;
|
||||
read_mesh(filename, points);
|
||||
std::vector<std::vector<std::size_t> > unused_faces;
|
||||
|
||||
CGAL::read_polygon_soup(filename, points, unused_faces);
|
||||
|
||||
std::vector<Point_3> ch_points;
|
||||
std::array<Point_3, 8> obb_points1;
|
||||
|
|
|
|||
|
|
@ -432,8 +432,6 @@ void oriented_bounding_box(const PolygonMesh& pmesh,
|
|||
#endif
|
||||
)
|
||||
{
|
||||
namespace PMP = CGAL::Polygon_mesh_processing;
|
||||
|
||||
using CGAL::parameters::choose_parameter;
|
||||
using CGAL::parameters::get_parameter;
|
||||
|
||||
|
|
|
|||
|
|
@ -344,7 +344,7 @@ bool read_PLY(std::istream& is, CGAL::Point_set_3<Point, Vector>& point_set)
|
|||
template <typename Point, typename Vector, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
|
||||
bool read_PLY(const char* fname,
|
||||
CGAL::Point_set_3<Point, Vector>& point_set,
|
||||
const std::string& comments,
|
||||
std::string& comments,
|
||||
const CGAL_BGL_NP_CLASS& np)
|
||||
{
|
||||
const bool binary = CGAL::parameters::choose_parameter(CGAL::parameters::get_parameter(np, internal_np::use_binary_mode), true);
|
||||
|
|
@ -363,7 +363,7 @@ bool read_PLY(const char* fname,
|
|||
}
|
||||
|
||||
template <typename Point, typename Vector>
|
||||
bool read_PLY(const char* fname, CGAL::Point_set_3<Point, Vector>& point_set, const std::string& comments)
|
||||
bool read_PLY(const char* fname, CGAL::Point_set_3<Point, Vector>& point_set, std::string& comments)
|
||||
{
|
||||
return read_PLY(fname, point_set, comments, parameters::all_default());
|
||||
}
|
||||
|
|
@ -371,17 +371,19 @@ bool read_PLY(const char* fname, CGAL::Point_set_3<Point, Vector>& point_set, co
|
|||
template <typename Point, typename Vector, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
|
||||
bool read_PLY(const char* fname, CGAL::Point_set_3<Point, Vector>& point_set, const CGAL_BGL_NP_CLASS& np)
|
||||
{
|
||||
return read_PLY(fname, point_set, std::string(), np);
|
||||
std::string unused_comments;
|
||||
return read_PLY(fname, point_set, unused_comments, np);
|
||||
}
|
||||
|
||||
template <typename Point, typename Vector>
|
||||
bool read_PLY(const char* fname, CGAL::Point_set_3<Point, Vector>& point_set)
|
||||
{
|
||||
return read_PLY(fname, point_set, std::string(), parameters::all_default());
|
||||
std::string unused_comments;
|
||||
return read_PLY(fname, point_set, unused_comments, parameters::all_default());
|
||||
}
|
||||
|
||||
template <typename Point, typename Vector>
|
||||
bool read_PLY(const std::string& fname, CGAL::Point_set_3<Point, Vector>& point_set, const std::string& comments)
|
||||
bool read_PLY(const std::string& fname, CGAL::Point_set_3<Point, Vector>& point_set, std::string& comments)
|
||||
{
|
||||
return read_PLY(fname.c_str(), point_set, comments, parameters::all_default());
|
||||
}
|
||||
|
|
@ -389,13 +391,15 @@ bool read_PLY(const std::string& fname, CGAL::Point_set_3<Point, Vector>& point_
|
|||
template <typename Point, typename Vector, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
|
||||
bool read_PLY(const std::string& fname, CGAL::Point_set_3<Point, Vector>& point_set, const CGAL_BGL_NP_CLASS& np)
|
||||
{
|
||||
return read_PLY(fname.c_str(), point_set, std::string(), np);
|
||||
std::string unused_comments;
|
||||
return read_PLY(fname.c_str(), point_set, unused_comments, np);
|
||||
}
|
||||
|
||||
template <typename Point, typename Vector>
|
||||
bool read_PLY(const std::string& fname, CGAL::Point_set_3<Point, Vector>& point_set)
|
||||
{
|
||||
return read_PLY(fname.c_str(), point_set, std::string(), parameters::all_default());
|
||||
std::string unused_comments;
|
||||
return read_PLY(fname.c_str(), point_set, unused_comments, parameters::all_default());
|
||||
}
|
||||
|
||||
#ifndef CGAL_NO_DEPRECATED_CODE
|
||||
|
|
|
|||
|
|
@ -3,7 +3,10 @@
|
|||
#include <CGAL/Point_set_3.h>
|
||||
#include <CGAL/IO/read_points.h>
|
||||
#include <CGAL/IO/write_points.h>
|
||||
#include <CGAL/boost/graph/io.h> // Just to try and create ambiguities
|
||||
|
||||
// Just to try and create ambiguities
|
||||
#include <CGAL/boost/graph/io.h>
|
||||
#include <CGAL/IO/io.h>
|
||||
|
||||
#include <CGAL/property_map.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
#ifdef CGAL_PMP_REMOVE_DEGENERATE_FACES_DEBUG
|
||||
#include <CGAL/Polygon_mesh_processing/polygon_soup_to_polygon_mesh.h>
|
||||
#include <CGAL/IO/OFF_reader.h>
|
||||
#include <CGAL/IO/OFF.h>
|
||||
#endif
|
||||
|
||||
#include <boost/algorithm/minmax_element.hpp>
|
||||
|
|
|
|||
|
|
@ -16,15 +16,16 @@ typedef Reconstruction::Facet_const_iterator Facet_iterator;
|
|||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
if (argc!=2){
|
||||
if (argc != 2)
|
||||
{
|
||||
std::cerr << "Error, no input file provided\n";
|
||||
return 1;
|
||||
}
|
||||
// Read the data.
|
||||
std::vector<Point> points;
|
||||
std::ifstream in(argv[1]);
|
||||
|
||||
std::cerr << "Reading " << std::flush;
|
||||
if( !in || !CGAL::read_points( in, std::back_inserter( points ) ) ) {
|
||||
std::vector<Point> points;
|
||||
if(!CGAL::read_points(argv[1], std::back_inserter(points)))
|
||||
{
|
||||
std::cerr << "Error: cannot read file" << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
|
@ -33,6 +34,7 @@ int main(int argc, char** argv)
|
|||
std::cerr << "Reconstruction ";
|
||||
CGAL::Timer t;
|
||||
t.start();
|
||||
|
||||
// Construct the mesh in a scale space.
|
||||
Reconstruction reconstruct (points.begin(), points.end());
|
||||
reconstruct.increase_scale(4);
|
||||
|
|
|
|||
|
|
@ -23,17 +23,16 @@ typedef Reconstruction::Facet_const_iterator Facet_iterator;
|
|||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
if (argc!=2){
|
||||
if (argc != 2)
|
||||
{
|
||||
std::cerr << "Error, no input file provided\n";
|
||||
return 1;
|
||||
}
|
||||
// Read the data.
|
||||
Point_set points;
|
||||
std::ifstream in(argv[1]);
|
||||
std::cerr << "Reading " << std::flush;
|
||||
in >> points;
|
||||
|
||||
if (points.empty())
|
||||
// Read the data.
|
||||
std::cerr << "Reading " << std::flush;
|
||||
Point_set points;
|
||||
if(!CGAL::read_point_set(argv[1], points))
|
||||
{
|
||||
std::cerr << "Error: cannot read file" << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
|
|
|
|||
|
|
@ -32,16 +32,15 @@ void dump_reconstruction(const Reconstruction& reconstruct, std::string name)
|
|||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
// Read the data.
|
||||
std::vector<Point> points;
|
||||
if (argc!=2){
|
||||
if (argc != 2)
|
||||
{
|
||||
std::cerr << "Error, no input file provided\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::ifstream in(argv[1]);
|
||||
std::cout << "Reading " << std::flush;
|
||||
if( !in || !CGAL::read_points(in, std::back_inserter(points)))
|
||||
std::vector<Point> points;
|
||||
if(!CGAL::read_points(argv[1], std::back_inserter(points)))
|
||||
{
|
||||
std::cerr << "Error: cannot read file" << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
|
|
|
|||
|
|
@ -28,11 +28,9 @@ int main(int argc, char* argv[])
|
|||
return 1;
|
||||
}
|
||||
|
||||
// Read the data.
|
||||
std::vector<Point> points;
|
||||
std::ifstream in(argv[1]);
|
||||
std::cerr << "Reading " << std::flush;
|
||||
if(!in || !CGAL::read_points(in, std::back_inserter(points)))
|
||||
std::vector<Point> points;
|
||||
if(!CGAL::read_points(argv[1], std::back_inserter(points)))
|
||||
{
|
||||
std::cerr << "Error: cannot read file" << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
|
|
@ -42,6 +40,7 @@ int main(int argc, char* argv[])
|
|||
|
||||
Timer t;
|
||||
t.start();
|
||||
|
||||
// Construct the mesh in a scale space.
|
||||
Reconstruction reconstruct(points.begin(), points.end() );
|
||||
Smoother smoother(10, 200 );
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ bool read_OBJ(std::istream& is,
|
|||
{
|
||||
if(!first_o)
|
||||
{
|
||||
if(maxi == offset_idx -1 && mini == offset_idx + 1)
|
||||
if(maxi == static_cast<int>(offset_idx -1 ) && mini == static_cast<int>(offset_idx + 1))
|
||||
{
|
||||
if(verbose)
|
||||
std::cerr << "No face detected." << std::endl;
|
||||
|
|
@ -158,7 +158,7 @@ bool read_OBJ(std::istream& is,
|
|||
std::cout<<"WARNING: normals were found in this file, but were discarded."<<std::endl;
|
||||
if(tex_found && verbose)
|
||||
std::cout<<"WARNING: textures were found in this file, but were discarded."<<std::endl;
|
||||
if(maxi == offset_idx -1 && mini == offset_idx + 1)
|
||||
if(maxi == static_cast<int>(offset_idx - 1) && mini == static_cast<int>(offset_idx + 1))
|
||||
{
|
||||
if(verbose)
|
||||
std::cerr << "No face detected." << std::endl;
|
||||
|
|
|
|||
|
|
@ -347,6 +347,7 @@ public:
|
|||
|
||||
void scan_texture(float& x, float& y, float& w)
|
||||
{
|
||||
w = 1;
|
||||
if(has_textures())
|
||||
{
|
||||
if(binary())
|
||||
|
|
@ -946,10 +947,7 @@ public:
|
|||
|
||||
//if the value is of float type, convert it into an int
|
||||
if(is_float)
|
||||
{
|
||||
const char* s = color_info.c_str();
|
||||
rgb[index] = static_cast<unsigned char>(atof(color_info.c_str())*255);
|
||||
}
|
||||
|
||||
//else stores the value
|
||||
else
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ void fill_point(const double x, const double y, const double z, const double w,
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static std::string get_file_extension(const std::string fname)
|
||||
static inline std::string get_file_extension(const std::string fname)
|
||||
{
|
||||
std::string::size_type dot(fname.rfind("."));
|
||||
if(dot == std::string::npos)
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ struct Surface_fixture_3 {
|
|||
|
||||
struct Cube_fixture
|
||||
{
|
||||
Cube_fixture() { CGAL::read_polygon_mesh(m, "cube.off"); }
|
||||
Cube_fixture() { CGAL::read_polygon_mesh("cube.off", m); }
|
||||
|
||||
Sm m;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,15 @@
|
|||
#include <CGAL/Simple_cartesian.h>
|
||||
#include <CGAL/Surface_mesh.h>
|
||||
#include <fstream>
|
||||
|
||||
#include <CGAL/Curves_on_surface_topology.h>
|
||||
#include <CGAL/Path_on_surface.h>
|
||||
#include <CGAL/squared_distance_3.h>
|
||||
#include <CGAL/draw_face_graph_with_paths.h>
|
||||
|
||||
using Mesh =CGAL::Surface_mesh<CGAL::Simple_cartesian<double>::Point_3>;
|
||||
using Path_on_surface=CGAL::Surface_mesh_topology::Path_on_surface<Mesh>;
|
||||
#include <fstream>
|
||||
|
||||
using Mesh = CGAL::Surface_mesh<CGAL::Simple_cartesian<double>::Point_3>;
|
||||
using Path_on_surface = CGAL::Surface_mesh_topology::Path_on_surface<Mesh>;
|
||||
|
||||
double cycle_length(const Mesh& mesh, const Path_on_surface& cycle)
|
||||
{ // Compute the length of the given cycle.
|
||||
|
|
@ -31,14 +33,13 @@ int main(int argc, char* argv[])
|
|||
{
|
||||
std::string filename(argc==1?"data/3torus.off":argv[1]);
|
||||
bool draw=(argc<3?false:(std::string(argv[2])=="-draw"));
|
||||
std::ifstream inp(filename);
|
||||
if (inp.fail())
|
||||
|
||||
Mesh sm;
|
||||
if(!CGAL::read_polygon_mesh(filename, sm))
|
||||
{
|
||||
std::cout<<"Cannot read file '"<<filename<<"'. Exiting program"<<std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
Mesh sm;
|
||||
inp>>sm;
|
||||
std::cout<<"File '"<<filename<<"' loaded. Finding edge-width of the mesh..."<<std::endl;
|
||||
|
||||
CGAL::Surface_mesh_topology::Curves_on_surface_topology<Mesh> cst(sm, true);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
#include <CGAL/Linear_cell_complex_for_combinatorial_map.h>
|
||||
#include <CGAL/Polyhedron_3.h>
|
||||
#include <CGAL/Surface_mesh.h>
|
||||
|
||||
#include <CGAL/boost/graph/io.h>
|
||||
#include <CGAL/Linear_cell_complex_constructors.h>
|
||||
#include <CGAL/Curves_on_surface_topology.h>
|
||||
#include <CGAL/Path_on_surface.h>
|
||||
#include <CGAL/Face_graph_wrapper.h>
|
||||
|
|
@ -40,13 +42,13 @@ void test(const FaceGraph& mesh, bool draw, const char* title)
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
std::string file=(argc==1?"data/elephant.off":argv[1]);
|
||||
bool draw=(argc>2?std::string(argv[2])=="-draw":false);
|
||||
const char* file = (argc == 1) ? "data/elephant.off" : argv[1];
|
||||
bool draw = (argc>2) ? std::string(argv[2])=="-draw" : false;
|
||||
seed=static_cast<unsigned int>(CGAL::get_default_random().get_int(0,INT_MAX));
|
||||
|
||||
{
|
||||
LCC_3_cmap lcc;
|
||||
if (!CGAL::read_polygon_mesh(file, lcc))
|
||||
if (!CGAL::load_off(lcc, file))
|
||||
{
|
||||
std::cout<<"ERROR reading file "<<file<<" for linear cell complex."<<std::endl;
|
||||
exit(EXIT_FAILURE);
|
||||
|
|
|
|||
Loading…
Reference in New Issue