diff --git a/Mesh_3/examples/Mesh_3/data/hybrid_example.polylines.txt b/Mesh_3/examples/Mesh_3/data/hybrid_example.polylines.txt new file mode 100755 index 00000000000..fdf1a1d4b05 --- /dev/null +++ b/Mesh_3/examples/Mesh_3/data/hybrid_example.polylines.txt @@ -0,0 +1,15 @@ +2 -1 -1 -1 1 -1 -1 +2 -1 -1 -1 -1 1 -1 +2 -1 -1 -1 -1 -1 1 +2 1 -1 -1 1 1 -1 +2 1 -1 -1 1 -1 1 +2 -1 1 -1 1 1 -1 +2 -1 1 -1 -1 1 1 +2 -1 -1 1 1 -1 1 +2 -1 -1 1 -1 1 1 +2 1 1 -1 1 1 0 +2 -1 1 1 0 1 1 +2 1 -1 1 1 0 1 +21 0 1 1 0.05 0.68775 1 0.1 0.56411 1 0.15 0.473217 1 0.2 0.4 1 0.25 0.338562 1 0.3 0.285857 1 0.35 0.240066 1 0.4 0.2 1 0.45 0.164835 1 0.5 0.133975 1 0.55 0.106971 1 0.6 0.0834849 1 0.65 0.0632503 1 0.7 0.0460608 1 0.75 0.0317542 1 0.8 0.0202041 1 0.85 0.011314 1 0.9 0.00501256 1 0.95 0.00125078 1 1 0 1 +21 1 1 0 1 0.68775 0.05 1 0.56411 0.1 1 0.473217 0.15 1 0.4 0.2 1 0.338562 0.25 1 0.285857 0.3 1 0.240066 0.35 1 0.2 0.4 1 0.164835 0.45 1 0.133975 0.5 1 0.106971 0.55 1 0.0834849 0.6 1 0.0632503 0.65 1 0.0460608 0.7 1 0.0317542 0.75 1 0.0202041 0.8 1 0.011314 0.85 1 0.00501256 0.9 1 0.00125078 0.95 1 0 1 +21 0 1 1 0.05 1 0.68775 0.1 1 0.56411 0.15 1 0.473217 0.2 1 0.4 0.25 1 0.338562 0.3 1 0.285857 0.35 1 0.240066 0.4 1 0.2 0.45 1 0.164835 0.5 1 0.133975 0.55 1 0.106971 0.6 1 0.0834849 0.65 1 0.0632503 0.7 1 0.0460608 0.75 1 0.0317542 0.8 1 0.0202041 0.85 1 0.011314 0.9 1 0.00501256 0.95 1 0.00125078 1 1 0 diff --git a/Mesh_3/examples/Mesh_3/mesh_hybrid_mesh_domain.cpp b/Mesh_3/examples/Mesh_3/mesh_hybrid_mesh_domain.cpp index e9f2dde4eaa..da57b7c9cec 100644 --- a/Mesh_3/examples/Mesh_3/mesh_hybrid_mesh_domain.cpp +++ b/Mesh_3/examples/Mesh_3/mesh_hybrid_mesh_domain.cpp @@ -17,6 +17,9 @@ // Ouput #include +// Read 1D features from input file +#include "read_polylines.h" + // Sphere Domain typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef K::FT FT; @@ -215,50 +218,16 @@ int main() Domain domain(sphere_domain, polyhedron_domain); + // Read polyline features + const char* lines_fname = "data/hybrid_example.polylines.txt"; std::vector > featured_curves; - featured_curves.resize(15); - featured_curves[ 0].push_back(Point(-1, -1, -1)); - featured_curves[ 0].push_back(Point( 1, -1, -1)); - featured_curves[ 1].push_back(Point(-1, -1, -1)); - featured_curves[ 1].push_back(Point(-1, 1, -1)); - featured_curves[ 2].push_back(Point(-1, -1, -1)); - featured_curves[ 2].push_back(Point(-1, -1, 1)); - - featured_curves[ 3].push_back(Point( 1, -1, -1)); - featured_curves[ 3].push_back(Point( 1, 1, -1)); - featured_curves[ 4].push_back(Point( 1, -1, -1)); - featured_curves[ 4].push_back(Point( 1, -1, 1)); - - featured_curves[ 5].push_back(Point(-1, 1, -1)); - featured_curves[ 5].push_back(Point( 1, 1, -1)); - featured_curves[ 6].push_back(Point(-1, 1, -1)); - featured_curves[ 6].push_back(Point(-1, 1, 1)); - - featured_curves[ 7].push_back(Point(-1, -1, 1)); - featured_curves[ 7].push_back(Point( 1, -1, 1)); - featured_curves[ 8].push_back(Point(-1, -1, 1)); - featured_curves[ 8].push_back(Point(-1, 1, 1)); - - featured_curves[ 9].push_back(Point( 1, 1, -1)); - featured_curves[ 9].push_back(Point( 1, 1, 0)); - featured_curves[10].push_back(Point(-1, 1, 1)); - featured_curves[10].push_back(Point( 0, 1, 1)); - featured_curves[11].push_back(Point( 1, -1, 1)); - featured_curves[11].push_back(Point( 1, 0, 1)); - - featured_curves[12].push_back(Point(0, 1, 1)); - featured_curves[13].push_back(Point(1, 1, 0)); - featured_curves[14].push_back(Point(0, 1, 1)); - for(double x = 0.05; x < 0.98; x+=0.05) { - const double y = 1 - CGAL::sqrt(1 - CGAL::square(x - 1)); - featured_curves[12].push_back(Point(x, y, 1)); - featured_curves[13].push_back(Point(1, y, x)); - featured_curves[14].push_back(Point(x, 1, y)); + if (!read_polylines(lines_fname, featured_curves)) + { // see file "read_polylines.h" + std::cerr << "Error: Cannot read file " << lines_fname << std::endl; + return false; } - featured_curves[12].push_back(Point(1, 0, 1)); - featured_curves[13].push_back(Point(1, 0, 1)); - featured_curves[14].push_back(Point(1, 1, 0)); + // Add features for protection domain.add_features(featured_curves.begin(), featured_curves.end()); // Criteria