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;
|
||||
}
|
||||
|
||||
int main() {
|
||||
int main(int,char** argv) {
|
||||
std::vector<Point_3> points;
|
||||
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)){
|
||||
std::cerr << "Error: can not read file.";
|
||||
return 1;
|
||||
|
|
@ -64,7 +64,7 @@ int main() {
|
|||
CGAL::Polygon_soup_to_polyhedron_3<Polyhedron::HalfedgeDS, Point_3> builder(points, polygons);
|
||||
poly.delegate(builder);
|
||||
|
||||
std::ofstream out("data/elephant_oriented.off");
|
||||
std::ofstream out("oriented.off");
|
||||
out << poly;
|
||||
out.close();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,13 +27,12 @@ void test(const char* file_name) {
|
|||
std::cerr << file_name << " passed the test." << std::endl;
|
||||
}
|
||||
|
||||
int main() {
|
||||
std::vector<std::string> files;
|
||||
int main(int argc, char** argv) {
|
||||
files.push_back("data/elephant.off");
|
||||
files.push_back("data/camel.off");
|
||||
|
||||
for(std::vector<std::string>::iterator it = files.begin(); it != files.end(); ++it) {
|
||||
test(it->c_str());
|
||||
for(int i=1;i<argc;++i) {
|
||||
test(argv[i]);
|
||||
}
|
||||
std::cerr << "All done." << std::endl;
|
||||
}
|
||||
|
|
@ -127,8 +127,8 @@ void from_file(const char* file_name, std::vector<Point>& points) {
|
|||
in.close();
|
||||
}
|
||||
|
||||
int main() {
|
||||
std::ifstream input("data/elephant.off");
|
||||
int main(int, char** argv) {
|
||||
std::ifstream input(argv[1]);
|
||||
Polyhedron poly;
|
||||
if ( !input || !(input >> poly) || poly.empty() ){
|
||||
std::cerr << "Error: can not read file.";
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@ typedef K::Triangle_3 Triangle;
|
|||
typedef CGAL::Polyhedron_3<K> Polyhedron;
|
||||
typedef Polyhedron::Facet_const_handle Facet_const_handle;
|
||||
|
||||
int main() {
|
||||
std::ifstream input("data/camel.off");
|
||||
int main(int, char** argv) {
|
||||
std::ifstream input(argv[1]);
|
||||
Polyhedron poly;
|
||||
if ( !input || !(input >> poly) || poly.empty() ){
|
||||
std::cerr << "Error: can not read file.";
|
||||
|
|
|
|||
Loading…
Reference in New Issue