mirror of https://github.com/CGAL/cgal
Factorize code generating filenames out of examples
This commit is contained in:
parent
9fa445f217
commit
ad5ae27c42
|
|
@ -120,8 +120,9 @@ int main(int argc, char** argv)
|
|||
std::string ps_name = std::string(ps_filename);
|
||||
ps_name = ps_name.substr(ps_name.find_last_of("/") + 1, ps_name.length() - 1);
|
||||
ps_name = ps_name.substr(0, ps_name.find_last_of("."));
|
||||
std::string output_name = ts_name + "_" + ss_name + "_" + ps_name + "_" + std::to_string(static_cast<int>(relative_alpha))
|
||||
+ "_" + std::to_string(static_cast<int>(relative_offset)) + ".off";
|
||||
std::string output_name = ts_name + "_" + ss_name + "_" + ps_name + "_"
|
||||
+ std::to_string(static_cast<int>(relative_alpha)) + "_"
|
||||
+ std::to_string(static_cast<int>(relative_offset)) + ".off";
|
||||
std::cout << "Writing to " << output_name << std::endl;
|
||||
CGAL::IO::write_polygon_mesh(output_name, wrap, CGAL::parameters::stream_precision(17));
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,19 @@
|
|||
#ifndef CGAL_ALPHA_WRAP_3_EXAMPLES_OUTPUT_HELPER_H
|
||||
#define CGAL_ALPHA_WRAP_3_EXAMPLES_OUTPUT_HELPER_H
|
||||
|
||||
#include <string>
|
||||
|
||||
std::string generate_output_name(std::string input_name,
|
||||
const double alpha,
|
||||
const double offset)
|
||||
{
|
||||
input_name = input_name.substr(input_name.find_last_of("/") + 1, input_name.length() - 1);
|
||||
input_name = input_name.substr(0, input_name.find_last_of("."));
|
||||
std::string output_name = input_name
|
||||
+ "_" + std::to_string(static_cast<int>(alpha))
|
||||
+ "_" + std::to_string(static_cast<int>(offset)) + ".off";
|
||||
|
||||
return output_name;
|
||||
}
|
||||
|
||||
#endif // CGAL_ALPHA_WRAP_3_EXAMPLES_OUTPUT_HELPER_H
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
#include "output_helper.h"
|
||||
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
#include <CGAL/Surface_mesh.h>
|
||||
|
||||
|
|
@ -53,11 +55,7 @@ int main(int argc, char** argv)
|
|||
std::cout << "Took " << t.time() << " s." << std::endl;
|
||||
|
||||
// Save the result
|
||||
std::string input_name = std::string(filename);
|
||||
input_name = input_name.substr(input_name.find_last_of("/") + 1, input_name.length() - 1);
|
||||
input_name = input_name.substr(0, input_name.find_last_of("."));
|
||||
std::string output_name = input_name + "_" + std::to_string(static_cast<int>(relative_alpha))
|
||||
+ "_" + std::to_string(static_cast<int>(relative_offset)) + ".off";
|
||||
const std::string output_name = generate_output_name(filename, relative_alpha, relative_offset);
|
||||
std::cout << "Writing to " << output_name << std::endl;
|
||||
CGAL::IO::write_polygon_mesh(output_name, wrap, CGAL::parameters::stream_precision(17));
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#define CGAL_AW3_TIMER
|
||||
|
||||
#include "output_helper.h"
|
||||
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
#include <CGAL/Surface_mesh.h>
|
||||
|
||||
|
|
@ -69,12 +71,7 @@ int main(int argc, char** argv)
|
|||
std::cout << " Result: " << num_vertices(wrap) << " vertices, " << num_faces(wrap) << " faces" << std::endl;
|
||||
std::cout << " Elapsed time: " << t.time() << " s." << std::endl;
|
||||
|
||||
std::string input_name = std::string(filename);
|
||||
input_name = input_name.substr(input_name.find_last_of("/") + 1, input_name.length() - 1);
|
||||
input_name = input_name.substr(0, input_name.find_last_of("."));
|
||||
std::string output_name = input_name
|
||||
+ "_" + std::to_string(static_cast<int>(relative_alphas[i]))
|
||||
+ "_" + std::to_string(static_cast<int>(relative_offset)) + ".off";
|
||||
const std::string output_name = generate_output_name(filename, relative_alphas[i], relative_offset);
|
||||
std::cout << "Writing to " << output_name << std::endl;
|
||||
CGAL::IO::write_polygon_mesh(output_name, wrap, CGAL::parameters::stream_precision(17));
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
#include "output_helper.h"
|
||||
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
#include <CGAL/Surface_mesh.h>
|
||||
|
||||
|
|
@ -56,12 +58,7 @@ int main(int argc, char** argv)
|
|||
std::cout << "Took " << t.time() << " s." << std::endl;
|
||||
|
||||
// Save the result
|
||||
std::string input_name = std::string(filename);
|
||||
input_name = input_name.substr(input_name.find_last_of("/") + 1, input_name.length() - 1);
|
||||
input_name = input_name.substr(0, input_name.find_last_of("."));
|
||||
std::string output_name = input_name
|
||||
+ "_" + std::to_string(static_cast<int>(relative_alpha))
|
||||
+ "_" + std::to_string(static_cast<int>(relative_offset)) + ".off";
|
||||
const std::string output_name = generate_output_name(filename, relative_alpha, relative_offset);
|
||||
std::cout << "Writing to " << output_name << std::endl;
|
||||
CGAL::IO::write_polygon_mesh(output_name, wrap, CGAL::parameters::stream_precision(17));
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
#include "output_helper.h"
|
||||
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
#include <CGAL/Surface_mesh.h>
|
||||
|
||||
|
|
@ -63,12 +65,7 @@ int main(int argc, char** argv)
|
|||
std::cout << "Took " << t.time() << " s." << std::endl;
|
||||
|
||||
// Save the result
|
||||
std::string input_name = std::string(filename);
|
||||
input_name = input_name.substr(input_name.find_last_of("/") + 1, input_name.length() - 1);
|
||||
input_name = input_name.substr(0, input_name.find_last_of("."));
|
||||
std::string output_name = input_name
|
||||
+ "_" + std::to_string(static_cast<int>(relative_alpha))
|
||||
+ "_" + std::to_string(static_cast<int>(relative_offset)) + ".off";
|
||||
const std::string output_name = generate_output_name(filename, relative_alpha, relative_offset);
|
||||
std::cout << "Writing to " << output_name << std::endl;
|
||||
CGAL::IO::write_polygon_mesh(output_name, wrap, CGAL::parameters::stream_precision(17));
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
#include "output_helper.h"
|
||||
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
#include <CGAL/Surface_mesh.h>
|
||||
|
||||
|
|
@ -113,12 +115,7 @@ int main(int argc, char** argv)
|
|||
auto dt = aw3.triangulation();
|
||||
|
||||
// Save the result
|
||||
std::string input_name = std::string(filename);
|
||||
input_name = input_name.substr(input_name.find_last_of("/") + 1, input_name.length() - 1);
|
||||
input_name = input_name.substr(0, input_name.find_last_of("."));
|
||||
std::string output_name = input_name
|
||||
+ "_" + std::to_string(static_cast<int>(relative_alpha))
|
||||
+ "_" + std::to_string(static_cast<int>(relative_offset)) + ".off";
|
||||
const std::string output_name = generate_output_name(filename, relative_alpha, relative_offset);
|
||||
std::cout << "Writing to " << output_name << std::endl;
|
||||
CGAL::IO::write_polygon_mesh(output_name, wrap, CGAL::parameters::stream_precision(17));
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
#include "output_helper.h"
|
||||
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
#include <CGAL/Surface_mesh.h>
|
||||
|
||||
|
|
@ -64,11 +66,7 @@ int main(int argc, char** argv)
|
|||
std::cout << "Took " << t.time() << " s." << std::endl;
|
||||
|
||||
// Save the result
|
||||
std::string input_name = std::string(filename);
|
||||
input_name = input_name.substr(input_name.find_last_of("/") + 1, input_name.length() - 1);
|
||||
input_name = input_name.substr(0, input_name.find_last_of("."));
|
||||
std::string output_name = input_name + "_cavity_" + std::to_string(static_cast<int>(relative_alpha))
|
||||
+ "_" + std::to_string(static_cast<int>(relative_offset)) + ".off";
|
||||
const std::string output_name = generate_output_name(filename, relative_alpha, relative_offset);
|
||||
std::cout << "Writing to " << output_name << std::endl;
|
||||
CGAL::IO::write_polygon_mesh(output_name, wrap, CGAL::parameters::stream_precision(17));
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue