mirror of https://github.com/CGAL/cgal
example takes input filenames as parameters
This commit is contained in:
parent
27d34d9e75
commit
e49813c5ef
|
|
@ -46,11 +46,11 @@ std::istream& read_soup(
|
||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main() {
|
int main(int,char** argv) {
|
||||||
std::vector<Point_3> points;
|
std::vector<Point_3> points;
|
||||||
std::vector< std::vector<std::size_t> > polygons;
|
std::vector< std::vector<std::size_t> > polygons;
|
||||||
|
|
||||||
std::ifstream input("data/elephant_soup.off");
|
std::ifstream input(argv[0]);
|
||||||
if ( !input || !read_soup(input, points, polygons)){
|
if ( !input || !read_soup(input, points, polygons)){
|
||||||
std::cerr << "Error: can not read file.";
|
std::cerr << "Error: can not read file.";
|
||||||
return 1;
|
return 1;
|
||||||
|
|
@ -64,7 +64,7 @@ int main() {
|
||||||
CGAL::Polygon_soup_to_polyhedron_3<Polyhedron::HalfedgeDS, Point_3> builder(points, polygons);
|
CGAL::Polygon_soup_to_polyhedron_3<Polyhedron::HalfedgeDS, Point_3> builder(points, polygons);
|
||||||
poly.delegate(builder);
|
poly.delegate(builder);
|
||||||
|
|
||||||
std::ofstream out("data/elephant_oriented.off");
|
std::ofstream out("oriented.off");
|
||||||
out << poly;
|
out << poly;
|
||||||
out.close();
|
out.close();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,13 +27,12 @@ void test(const char* file_name) {
|
||||||
std::cerr << file_name << " passed the test." << std::endl;
|
std::cerr << file_name << " passed the test." << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main() {
|
int main(int argc, char** argv) {
|
||||||
std::vector<std::string> files;
|
|
||||||
files.push_back("data/elephant.off");
|
files.push_back("data/elephant.off");
|
||||||
files.push_back("data/camel.off");
|
files.push_back("data/camel.off");
|
||||||
|
|
||||||
for(std::vector<std::string>::iterator it = files.begin(); it != files.end(); ++it) {
|
for(int i=1;i<argc;++i) {
|
||||||
test(it->c_str());
|
test(argv[i]);
|
||||||
}
|
}
|
||||||
std::cerr << "All done." << std::endl;
|
std::cerr << "All done." << std::endl;
|
||||||
}
|
}
|
||||||
|
|
@ -127,8 +127,8 @@ void from_file(const char* file_name, std::vector<Point>& points) {
|
||||||
in.close();
|
in.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
int main() {
|
int main(int, char** argv) {
|
||||||
std::ifstream input("data/elephant.off");
|
std::ifstream input(argv[1]);
|
||||||
Polyhedron poly;
|
Polyhedron poly;
|
||||||
if ( !input || !(input >> poly) || poly.empty() ){
|
if ( !input || !(input >> poly) || poly.empty() ){
|
||||||
std::cerr << "Error: can not read file.";
|
std::cerr << "Error: can not read file.";
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,8 @@ typedef K::Triangle_3 Triangle;
|
||||||
typedef CGAL::Polyhedron_3<K> Polyhedron;
|
typedef CGAL::Polyhedron_3<K> Polyhedron;
|
||||||
typedef Polyhedron::Facet_const_handle Facet_const_handle;
|
typedef Polyhedron::Facet_const_handle Facet_const_handle;
|
||||||
|
|
||||||
int main() {
|
int main(int, char** argv) {
|
||||||
std::ifstream input("data/camel.off");
|
std::ifstream input(argv[1]);
|
||||||
Polyhedron poly;
|
Polyhedron poly;
|
||||||
if ( !input || !(input >> poly) || poly.empty() ){
|
if ( !input || !(input >> poly) || poly.empty() ){
|
||||||
std::cerr << "Error: can not read file.";
|
std::cerr << "Error: can not read file.";
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue