diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/circles.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/circles.cpp index f12cfb5af63..11472775d8b 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/circles.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/circles.cpp @@ -21,14 +21,16 @@ int main() { // Locate the vertex with maximal degree. auto vit = arr.vertices_begin(); Arrangement::Vertex_const_handle v_max = vit; - for (++vit; vit != arr.vertices_end(); ++vit) - if (vit->degree() > v_max->degree()) v_max = vit; + for(++vit; vit != arr.vertices_end(); ++vit) + if(vit->degree() > v_max->degree()) + v_max = vit; // Locate the vertex with maximum degree. std::cout << "The vertex with maximal degree in the arrangement is: " << "v_max = (" << v_max->point() << ") " << "with degree " << v_max->degree() << "." << std::endl; - CGAL::draw(arr); + + CGAL::draw(arr, "circles"); return 0; } diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/circular_arcs.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/circular_arcs.cpp index 11043fb5555..252983822b0 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/circular_arcs.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/circular_arcs.cpp @@ -24,8 +24,7 @@ int main() { // Create a line segment (C4) with the same supporting line (y = x), but // having one endpoint with irrational coordinates. CoordNT sqrt_15 = CoordNT(0, 1, 15); // = sqrt(15) - curves.push_back(Curve(s3.supporting_line(), - Point(3, 3), Point(sqrt_15, sqrt_15))); + curves.push_back(Curve(s3.supporting_line(), Point(3, 3), Point(sqrt_15, sqrt_15))); // Create a circular arc (C5) that is the upper half of the circle centered at // (1, 1) with squared radius 3. Create the circle with clockwise orientation, @@ -51,13 +50,12 @@ int main() { // Create a circular arc (C7) defined by two endpoints and a midpoint, // all having rational coordinates. This arc is the upper right // quarter of a circle centered at the origin with radius 5. - curves.push_back(Curve(Rational_point(0, 5), Rational_point(3, 4), - Rational_point(5, 0))); + curves.push_back(Curve(Rational_point(0, 5), Rational_point(3, 4), Rational_point(5, 0))); // Construct the arrangement of the curves and print its size. - Arrangement arr; + Arrangement arr; insert(arr, curves.begin(), curves.end()); print_arrangement_size(arr); - CGAL::draw(arr); + CGAL::draw(arr, "circular_arcs"); return 0; } diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/draw_arr.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/draw_arr.cpp index 4a94d8b849b..0476648efa9 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/draw_arr.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/draw_arr.cpp @@ -2,11 +2,11 @@ #include #include #include +#include #include -#include using Kernel = CGAL::Exact_predicates_exact_constructions_kernel; -using Traits = CGAL::Arr_segment_traits_2; +using Traits = CGAL::Arr_non_caching_segment_traits_2; using Point = Traits::Point_2; using Arrangement_2 = CGAL::Arrangement_2; diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/ellipses.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/ellipses.cpp index 480b0eefe31..a83c3a69efc 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/ellipses.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/ellipses.cpp @@ -17,14 +17,10 @@ int main() { auto ctr_cv = traits.construct_curve_2_object(); // Insert a full x-major ellipse - CGAL::insert(arr, ctr_cv(1, 4, 0, 0, 0, -16, CGAL::COUNTERCLOCKWISE, - Point(4,0), Point(0,2))); - CGAL::insert(arr, ctr_cv(1, 4, 0, 0, 0, -16, CGAL::COUNTERCLOCKWISE, - Point(0,2), Point(-4,0))); - CGAL::insert(arr, ctr_cv(1, 4, 0, 0, 0, -16, CGAL::COUNTERCLOCKWISE, - Point(-4,0), Point(0,-2))); - CGAL::insert(arr, ctr_cv(1, 4, 0, 0, 0, -16, CGAL::COUNTERCLOCKWISE, - Point(0,-2), Point(4,0))); + CGAL::insert(arr, ctr_cv(1, 4, 0, 0, 0, -16, CGAL::COUNTERCLOCKWISE, Point(4, 0), Point(0, 2))); + CGAL::insert(arr, ctr_cv(1, 4, 0, 0, 0, -16, CGAL::COUNTERCLOCKWISE, Point(0, 2), Point(-4, 0))); + CGAL::insert(arr, ctr_cv(1, 4, 0, 0, 0, -16, CGAL::COUNTERCLOCKWISE, Point(-4, 0), Point(0, -2))); + CGAL::insert(arr, ctr_cv(1, 4, 0, 0, 0, -16, CGAL::COUNTERCLOCKWISE, Point(0, -2), Point(4, 0))); // Insert a full y-major ellipse CGAL::insert(arr, ctr_cv(4, 1, 0, 0, 0, -16)); @@ -39,7 +35,7 @@ int main() { print_arrangement_size(arr); - CGAL::draw(arr); + CGAL::draw(arr, "ellipses"); return 0; } diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/hyperbolas.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/hyperbolas.cpp index 8c165cac9f6..ecc9961adf2 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/hyperbolas.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/hyperbolas.cpp @@ -19,63 +19,46 @@ int main() { // Insert a hyperbolic arc (C1), supported by the hyperbola y = 1/x // (or: xy - 1 = 0) with the endpoints (1/4, 4) and (2, 1/2). // The arc is counterclockwise oriented. - CGAL::insert(arr, ctr_cv(0, 0, 1, 0, 0, -1, CGAL::COUNTERCLOCKWISE, - Point(Rational(1,4), 4), Point(2, Rational(1,2)))); - CGAL::insert(arr, ctr_cv(0, 0, -1, 0, 0, -1, CGAL::CLOCKWISE, - Point(Rational(-1,4), 4), Point(-2, Rational(1,2)))); + CGAL::insert(arr, + ctr_cv(0, 0, 1, 0, 0, -1, CGAL::COUNTERCLOCKWISE, Point(Rational(1, 4), 4), Point(2, Rational(1, 2)))); + CGAL::insert(arr, ctr_cv(0, 0, -1, 0, 0, -1, CGAL::CLOCKWISE, Point(Rational(-1, 4), 4), Point(-2, Rational(1, 2)))); - CGAL::insert(arr, ctr_cv(2, -1, 0, 0, 0, -2, CGAL::COUNTERCLOCKWISE, - Point(3, 4), Point(1, 0))); - CGAL::insert(arr, ctr_cv(2, -1, 0, 0, 0, -2, CGAL::COUNTERCLOCKWISE, - Point(1, 0), Point(3, -4))); - CGAL::insert(arr, ctr_cv(2, -1, 0, 0, 0, -2, CGAL::CLOCKWISE, - Point(-3, 4), Point(-1, 0))); - CGAL::insert(arr, ctr_cv(2, -1, 0, 0, 0, -2, CGAL::CLOCKWISE, - Point(-1, 0), Point(-3, -4))); + CGAL::insert(arr, ctr_cv(2, -1, 0, 0, 0, -2, CGAL::COUNTERCLOCKWISE, Point(3, 4), Point(1, 0))); + CGAL::insert(arr, ctr_cv(2, -1, 0, 0, 0, -2, CGAL::COUNTERCLOCKWISE, Point(1, 0), Point(3, -4))); + CGAL::insert(arr, ctr_cv(2, -1, 0, 0, 0, -2, CGAL::CLOCKWISE, Point(-3, 4), Point(-1, 0))); + CGAL::insert(arr, ctr_cv(2, -1, 0, 0, 0, -2, CGAL::CLOCKWISE, Point(-1, 0), Point(-3, -4))); - CGAL::insert(arr, ctr_cv(-1, 2, 0, 0, 0, -2, CGAL::CLOCKWISE, - Point(4, 3), Point(0, 1))); - CGAL::insert(arr, ctr_cv(-1, 2, 0, 0, 0, -2, CGAL::CLOCKWISE, - Point(0, 1), Point(-4, 3))); - CGAL::insert(arr, ctr_cv(-1, 2, 0, 0, 0, -2, CGAL::COUNTERCLOCKWISE, - Point(4, -3), Point(0, -1))); - CGAL::insert(arr, ctr_cv(-1, 2, 0, 0, 0, -2, CGAL::COUNTERCLOCKWISE, - Point(0, -1), Point(-4, -3))); + CGAL::insert(arr, ctr_cv(-1, 2, 0, 0, 0, -2, CGAL::CLOCKWISE, Point(4, 3), Point(0, 1))); + CGAL::insert(arr, ctr_cv(-1, 2, 0, 0, 0, -2, CGAL::CLOCKWISE, Point(0, 1), Point(-4, 3))); + CGAL::insert(arr, ctr_cv(-1, 2, 0, 0, 0, -2, CGAL::COUNTERCLOCKWISE, Point(4, -3), Point(0, -1))); + CGAL::insert(arr, ctr_cv(-1, 2, 0, 0, 0, -2, CGAL::COUNTERCLOCKWISE, Point(0, -1), Point(-4, -3))); - CGAL::insert(arr, ctr_cv(4, 46, -144, 0, 0, -100, CGAL::COUNTERCLOCKWISE, - Point(-5, 0), + CGAL::insert(arr, ctr_cv(4, 46, -144, 0, 0, -100, CGAL::COUNTERCLOCKWISE, Point(-5, 0), Point(Rational(14, 10), Rational(48, 10)))); - CGAL::insert(arr, ctr_cv(4, 46, -144, 0, 0, -100, CGAL::COUNTERCLOCKWISE, - Point(5, 0), + CGAL::insert(arr, ctr_cv(4, 46, -144, 0, 0, -100, CGAL::COUNTERCLOCKWISE, Point(5, 0), Point(Rational(-14, 10), Rational(-48, 10)))); // 4*x*x + 46*y*y - 144*x*y - 100 - CGAL::insert(arr, ctr_cv(46, 4, -144, 0, 0, -100, CGAL::CLOCKWISE, - Point(0, -5), - Point(Rational(48, 10), Rational(14, 10)))); - CGAL::insert(arr, ctr_cv(46, 4, -144, 0, 0, -100, CGAL::CLOCKWISE, - Point(0, 5), - Point(Rational(-48, 10), Rational(-14, 10)))); + CGAL::insert( + arr, ctr_cv(46, 4, -144, 0, 0, -100, CGAL::CLOCKWISE, Point(0, -5), Point(Rational(48, 10), Rational(14, 10)))); + CGAL::insert( + arr, ctr_cv(46, 4, -144, 0, 0, -100, CGAL::CLOCKWISE, Point(0, 5), Point(Rational(-48, 10), Rational(-14, 10)))); // 46*x*x + 4*y*y - 144*x*y - 100 - CGAL::insert(arr, ctr_cv(4, 46, 144, 0, 0, -100, CGAL::CLOCKWISE, - Point(-5, 0), - Point(Rational(14,10), Rational(-48,10)))); - CGAL::insert(arr, ctr_cv(4, 46, 144, 0, 0, -100, CGAL::CLOCKWISE, - Point(5, 0), - Point(Rational(-14,10), Rational(48,10)))); + CGAL::insert( + arr, ctr_cv(4, 46, 144, 0, 0, -100, CGAL::CLOCKWISE, Point(-5, 0), Point(Rational(14, 10), Rational(-48, 10)))); + CGAL::insert( + arr, ctr_cv(4, 46, 144, 0, 0, -100, CGAL::CLOCKWISE, Point(5, 0), Point(Rational(-14, 10), Rational(48, 10)))); // 4*x*x + 46*y*y + 144*x*y - 100 - CGAL::insert(arr, ctr_cv(46, 4, 144, 0, 0, -100, CGAL::COUNTERCLOCKWISE, - Point(0, -5), - Point(Rational(-48,10), Rational(14,10)))); - CGAL::insert(arr, ctr_cv(46, 4, 144, 0, 0, -100, CGAL::COUNTERCLOCKWISE, - Point(0, 5), - Point(Rational(48,10), Rational(-14,10)))); + CGAL::insert(arr, ctr_cv(46, 4, 144, 0, 0, -100, CGAL::COUNTERCLOCKWISE, Point(0, -5), + Point(Rational(-48, 10), Rational(14, 10)))); + CGAL::insert(arr, ctr_cv(46, 4, 144, 0, 0, -100, CGAL::COUNTERCLOCKWISE, Point(0, 5), + Point(Rational(48, 10), Rational(-14, 10)))); print_arrangement_size(arr); - CGAL::draw(arr); + CGAL::draw(arr, "hyperbolas"); return 0; } diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/linear_conics.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/linear_conics.cpp index 071c118052e..abec7c1dc8b 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/linear_conics.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/linear_conics.cpp @@ -20,8 +20,8 @@ int main() { Point p2(0, -1); Point p3(0, 1); Point p4(1, 0); - Point p5(Rational(1,2),Rational(1,2)); - Point p6(Rational(-1,2),Rational(1,2)); + Point p5(Rational(1, 2), Rational(1, 2)); + Point p6(Rational(-1, 2), Rational(1, 2)); Rat_point rp0(0, 0); Rat_point rp1(1, 0); Rat_point rp2(0, 1); @@ -56,7 +56,7 @@ int main() { print_arrangement_size(arr); - CGAL::draw(arr); + CGAL::draw(arr, "linear_conics"); return 0; } diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/parabolas.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/parabolas.cpp index 7213b06f095..8b1faa498a7 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/parabolas.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/parabolas.cpp @@ -18,62 +18,49 @@ int main() { // x-major // insert the parabola y = x^2; (-1,1)--(1,1) - CGAL::insert(arr, ctr_cv(1, 0, 0, 0, -1, 0, CGAL::COUNTERCLOCKWISE, - Point(-1, 1), Point(1, 1))); + CGAL::insert(arr, ctr_cv(1, 0, 0, 0, -1, 0, CGAL::COUNTERCLOCKWISE, Point(-1, 1), Point(1, 1))); // translated // Insert the parabola y = x^2 - 2x + 2; (1,1)--(2,2) - CGAL::insert(arr, ctr_cv(1, 0, 0, -2, -1, 2, CGAL::COUNTERCLOCKWISE, - Point(1, 1), Point(2, 2))); - CGAL::insert(arr, ctr_cv(1, 0, 0, 2, -1, 2, CGAL::COUNTERCLOCKWISE, - Point(-2, 2), Point(-1, 1))); + CGAL::insert(arr, ctr_cv(1, 0, 0, -2, -1, 2, CGAL::COUNTERCLOCKWISE, Point(1, 1), Point(2, 2))); + CGAL::insert(arr, ctr_cv(1, 0, 0, 2, -1, 2, CGAL::COUNTERCLOCKWISE, Point(-2, 2), Point(-1, 1))); // rotated // Insert the parabola y = x^2 rotated clockwise about theta, such that // sin(theta) = 0.6, cos(theta) = 0.8 - CGAL::insert(arr, ctr_cv(16, 9, -24, -15, -20, 0, CGAL::COUNTERCLOCKWISE, - Point(Rational(-2,10), Rational(14,10)), - Point(Rational(14,10), Rational(2,10)))); - CGAL::insert(arr, ctr_cv(16, 9, 24, 15, -20, 0, CGAL::CLOCKWISE, - Point(Rational(2,10), Rational(14,10)), - Point(Rational(-14,10), Rational(2,10)))); - CGAL::insert(arr, ctr_cv(16, 9, 24, -15, 20, 0, CGAL::COUNTERCLOCKWISE, - Point(Rational(14,10), Rational(-2,10)), - Point(Rational(-2,10), Rational(-14,10)))); - CGAL::insert(arr, ctr_cv(16, 9, -24, 15, 20, 0, CGAL::COUNTERCLOCKWISE, - Point(Rational(2,10), Rational(-14,10)), - Point(Rational(-14,10), Rational(-2,10)))); + CGAL::insert(arr, ctr_cv(16, 9, -24, -15, -20, 0, CGAL::COUNTERCLOCKWISE, Point(Rational(-2, 10), Rational(14, 10)), + Point(Rational(14, 10), Rational(2, 10)))); + CGAL::insert(arr, ctr_cv(16, 9, 24, 15, -20, 0, CGAL::CLOCKWISE, Point(Rational(2, 10), Rational(14, 10)), + Point(Rational(-14, 10), Rational(2, 10)))); + CGAL::insert(arr, ctr_cv(16, 9, 24, -15, 20, 0, CGAL::COUNTERCLOCKWISE, Point(Rational(14, 10), Rational(-2, 10)), + Point(Rational(-2, 10), Rational(-14, 10)))); + CGAL::insert(arr, ctr_cv(16, 9, -24, 15, 20, 0, CGAL::COUNTERCLOCKWISE, Point(Rational(2, 10), Rational(-14, 10)), + Point(Rational(-14, 10), Rational(-2, 10)))); // 16*x*x+9*y*y-24*x*y-15*x-20*y - CGAL::insert(arr, ctr_cv(9, 16, -24, -20, -15, 0, CGAL::COUNTERCLOCKWISE, - Point(Rational(2,10), Rational(14,10)), - Point(Rational(14,10), Rational(-2,10)))); - CGAL::insert(arr, ctr_cv(9, 16, 24, -20, 15, 0, CGAL::CLOCKWISE, - Point(Rational(2,10), Rational(-14,10)), - Point(Rational(14,10), Rational(2,10)))); - CGAL::insert(arr, ctr_cv(9, 16, 24, 20, -15, 0, CGAL::COUNTERCLOCKWISE, - Point(Rational(-14,10), Rational(-2,10)), - Point(Rational(-2,10), Rational(14,10)))); - CGAL::insert(arr, ctr_cv(9, 16, -24, 20, 15, 0, CGAL::COUNTERCLOCKWISE, - Point(Rational(-2,10), Rational(-14,10)), - Point(Rational(-14,10), Rational(2,10)))); + CGAL::insert(arr, ctr_cv(9, 16, -24, -20, -15, 0, CGAL::COUNTERCLOCKWISE, Point(Rational(2, 10), Rational(14, 10)), + Point(Rational(14, 10), Rational(-2, 10)))); + CGAL::insert(arr, ctr_cv(9, 16, 24, -20, 15, 0, CGAL::CLOCKWISE, Point(Rational(2, 10), Rational(-14, 10)), + Point(Rational(14, 10), Rational(2, 10)))); + CGAL::insert(arr, ctr_cv(9, 16, 24, 20, -15, 0, CGAL::COUNTERCLOCKWISE, Point(Rational(-14, 10), Rational(-2, 10)), + Point(Rational(-2, 10), Rational(14, 10)))); + CGAL::insert(arr, ctr_cv(9, 16, -24, 20, 15, 0, CGAL::COUNTERCLOCKWISE, Point(Rational(-2, 10), Rational(-14, 10)), + Point(Rational(-14, 10), Rational(2, 10)))); // 9*x*x+16*y*y-24*x*y+20*x+15*y // rotated & translated - CGAL::insert(arr, ctr_cv(16, 9, -24, -23, -14, 36, CGAL::COUNTERCLOCKWISE, - Point(Rational(8,10), Rational(24,10)), - Point(Rational(24,10), Rational(12,10)))); - CGAL::insert(arr, ctr_cv(16, 9, 24, 23, -14, 36, CGAL::CLOCKWISE, - Point(Rational(-8,10), Rational(24,10)), - Point(Rational(-24,10), Rational(12,10)))); + CGAL::insert(arr, ctr_cv(16, 9, -24, -23, -14, 36, CGAL::COUNTERCLOCKWISE, Point(Rational(8, 10), Rational(24, 10)), + Point(Rational(24, 10), Rational(12, 10)))); + CGAL::insert(arr, ctr_cv(16, 9, 24, 23, -14, 36, CGAL::CLOCKWISE, Point(Rational(-8, 10), Rational(24, 10)), + Point(Rational(-24, 10), Rational(12, 10)))); // 16*x*x+9*y*y-24*x*y-23*x-14*y+36 print_arrangement_size(arr); - CGAL::draw(arr); + CGAL::draw(arr, "parabolas"); return 0; } diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polylines.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polylines.cpp index 51fa18d82c8..1320b164323 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polylines.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/polylines.cpp @@ -45,7 +45,7 @@ int main() { insert(arr, pi1); insert(arr, pi2); insert(arr, pi3); - print_arrangement_size(arr); // print the arrangement size - CGAL::draw(arr); + print_arrangement_size(arr); // print the arrangement size + CGAL::draw(arr, "polylines"); return 0; } diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/rational_functions.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/rational_functions.cpp index df0c5f19bab..37f6d094eba 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/rational_functions.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/rational_functions.cpp @@ -57,7 +57,7 @@ int main() { insert(arr, arcs.begin(), arcs.end()); print_arrangement(arr); - CGAL::draw(arr); + CGAL::draw(arr, "rational_functions"); return 0; } diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/unbounded_non_intersecting.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/unbounded_non_intersecting.cpp index 2246f44bb96..132c4948bd3 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/unbounded_non_intersecting.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/unbounded_non_intersecting.cpp @@ -51,7 +51,7 @@ int main() { std::cout << std::endl; } - CGAL::draw(arr); + CGAL::draw(arr, "unbounded_non_intersecting"); return 0; } diff --git a/Arrangement_on_surface_2/include/CGAL/Draw_aos/Arr_approximate_point_2_at_x.h b/Arrangement_on_surface_2/include/CGAL/Draw_aos/Arr_approximate_point_2_at_x.h index 71fe4de2d56..2141826219e 100644 --- a/Arrangement_on_surface_2/include/CGAL/Draw_aos/Arr_approximate_point_2_at_x.h +++ b/Arrangement_on_surface_2/include/CGAL/Draw_aos/Arr_approximate_point_2_at_x.h @@ -2,12 +2,12 @@ #define CGAL_DRAW_AOS_ARR_APPROXIMATE_POINT_2_AT_X_H #include -#include "CGAL/number_utils.h" -#include "CGAL/Arr_rational_function_traits_2.h" -#include "CGAL/Draw_aos/Arr_construct_curve_end.h" -#include "CGAL/Draw_aos/Arr_construct_segments.h" -#include "CGAL/Draw_aos/Arr_approximate_point_2.h" -#include "CGAL/Draw_aos/type_utils.h" +#include +#include +#include +#include +#include +#include namespace CGAL { namespace draw_aos { @@ -89,20 +89,19 @@ class Arr_approximate_point_2_at_x> using X_monotone_curve_2 = typename Traits_adaptor::X_monotone_curve_2; using FT = typename Traits_adaptor::FT; using Approx_point = typename Arr_approximation_geometry_traits::Approx_point; - using Construct_curve_end = Arr_construct_curve_end; public: - Arr_approximate_point_2_at_x(const Geom_traits& traits) - : m_cst_curve_end(traits) {} + Arr_approximate_point_2_at_x(const Geom_traits&) + : to_ft() {} std::optional operator()(const X_monotone_curve_2& curve, FT x) const { - std::optional min_end = m_cst_curve_end(curve, ARR_MIN_END); - if(min_end.has_value() && x < min_end->x()) { - return std::nullopt; - } - std::optional max_end = m_cst_curve_end(curve, ARR_MAX_END); - if(max_end.has_value() && x > max_end->x()) { - return std::nullopt; + FT xmin = curve.left_parameter_space_in_x() == ARR_INTERIOR ? curve.left_x() + : to_ft(std::numeric_limits::lowest()); + FT xmax = curve.right_parameter_space_in_x() == ARR_INTERIOR ? curve.right_x() + : to_ft(std::numeric_limits::max()); + + if(x < xmin || x > xmax) { + return std::nullopt; // x is out of bounds } using Bound = typename Geom_traits::Bound; @@ -115,7 +114,7 @@ public: } private: - const Construct_curve_end m_cst_curve_end; + const Construct_coordinate to_ft; }; } // namespace draw_aos diff --git a/Arrangement_on_surface_2/include/CGAL/Draw_aos/Arr_bounded_approximate_curve_2.h b/Arrangement_on_surface_2/include/CGAL/Draw_aos/Arr_bounded_approximate_curve_2.h index d6a780ef8be..fbc839a9d3e 100644 --- a/Arrangement_on_surface_2/include/CGAL/Draw_aos/Arr_bounded_approximate_curve_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Draw_aos/Arr_bounded_approximate_curve_2.h @@ -8,11 +8,10 @@ #include #include -#include "CGAL/Arr_enums.h" -#include "CGAL/Draw_aos/Arr_approximate_point_2_at_x.h" -#include "CGAL/Draw_aos/Arr_render_context.h" -#include "CGAL/Draw_aos/type_utils.h" -#include "CGAL/basic.h" +#include +#include +#include +#include namespace CGAL { namespace draw_aos { @@ -50,6 +49,7 @@ class Arr_bounded_approximate_curve_2_impl const Intersections_vector& bottom_inters, Polyline_geom& polyline) : Arr_context_delegator(ctx) + , to_ft() , curve(curve) , m_approx_pt_at_x(approx_pt_at_x) , top_inters(top_inters) diff --git a/Arrangement_on_surface_2/include/CGAL/Draw_aos/Arr_bounded_approximate_face_2.h b/Arrangement_on_surface_2/include/CGAL/Draw_aos/Arr_bounded_approximate_face_2.h index 9f2d6190b30..9bb295ffeb3 100644 --- a/Arrangement_on_surface_2/include/CGAL/Draw_aos/Arr_bounded_approximate_face_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Draw_aos/Arr_bounded_approximate_face_2.h @@ -10,13 +10,13 @@ #include -#include "CGAL/Arr_enums.h" -#include "CGAL/Bbox_2.h" -#include "CGAL/Draw_aos/Arr_bounded_approximate_curve_2.h" -#include "CGAL/Draw_aos/Arr_bounded_approximate_point_2.h" -#include "CGAL/Draw_aos/Arr_bounded_face_triangulator.h" -#include "CGAL/Draw_aos/Arr_render_context.h" -#include "CGAL/Draw_aos/type_utils.h" +#include +#include +#include +#include +#include +#include +#include namespace CGAL { @@ -212,7 +212,7 @@ class Arr_bounded_approximate_face_2 using Bounded_render_context = Arr_bounded_render_context; using Triangulator = Arr_bounded_face_triangulator; - using Patch_boundary = Patch_boundary; + using Patch = Patch_boundary; using Simplifier = Colinear_simplifier; struct Left_to_right_tag @@ -236,13 +236,13 @@ private: using Insert_iterator = boost::function_output_iterator>; Execution_context(const Bounded_render_context& ctx, - const Patch_boundary& patch_boundary, + const Patch& patch, Output_iterator out_it, const Bounded_approximate_point_2& bounded_approx_pt, const Bounded_approximate_curve_2& bounded_approx_curve) : Arr_context_delegator(ctx) , base_out_it(out_it) - , patch_boundary(patch_boundary) + , patch(patch) , bounded_approx_pt(bounded_approx_pt) , bounded_approx_curve(bounded_approx_curve) { this->out_it = boost::make_function_output_iterator(std::function([this](Approx_point pt) { @@ -257,7 +257,7 @@ private: } if(passed_fictitious_edge && last_pt.has_value()) { - this->patch_boundary(last_pt.value(), pt, base_out_it); + this->patch(last_pt.value(), pt, base_out_it); } passed_fictitious_edge = false; @@ -280,7 +280,7 @@ private: std::optional last_pt, first_pt; bool passed_fictitious_edge{false}; Output_iterator base_out_it; - const Patch_boundary& patch_boundary; + const Patch& patch; }; private: @@ -419,9 +419,9 @@ private: if constexpr(Unbounded) { if(ctx.first_pt.has_value()) { - ctx.patch_boundary(ctx.last_pt.value(), ctx.first_pt.value(), ctx.base_out_it); + ctx.patch(ctx.last_pt.value(), ctx.first_pt.value(), ctx.base_out_it); } else { - ctx.patch_boundary(ctx.base_out_it); + ctx.patch(ctx.base_out_it); } } } @@ -431,7 +431,7 @@ public: const Bounded_approximate_point_2& bounded_approx_pt, const Bounded_approximate_curve_2& bounded_approx_curve) : m_ctx(ctx) - , m_patch_boundary(ctx.bbox()) + , m_patch(ctx.bbox()) , m_bounded_approx_pt(bounded_approx_pt) , m_bounded_approx_curve(bounded_approx_curve) {} @@ -468,8 +468,8 @@ public: auto triangulator = Triangulator(m_ctx); auto simplifier = Simplifier(triangulator.insert_iterator(), m_ctx.bbox()); - auto ctx = Execution_context(m_ctx, m_patch_boundary, simplifier.insert_iterator(), m_bounded_approx_pt, - m_bounded_approx_curve); + auto ctx = + Execution_context(m_ctx, m_patch, simplifier.insert_iterator(), m_bounded_approx_pt, m_bounded_approx_curve); if(fh->is_unbounded()) { approximate_ccb(ctx, fh->outer_ccb()); @@ -486,7 +486,7 @@ private: const Bounded_render_context& m_ctx; const Bounded_approximate_point_2& m_bounded_approx_pt; const Bounded_approximate_curve_2& m_bounded_approx_curve; - const Patch_boundary m_patch_boundary; + const Patch m_patch; }; } // namespace draw_aos diff --git a/Arrangement_on_surface_2/include/CGAL/Draw_aos/Arr_bounded_renderer.h b/Arrangement_on_surface_2/include/CGAL/Draw_aos/Arr_bounded_renderer.h index 8ee79ebd442..98030b55f5c 100644 --- a/Arrangement_on_surface_2/include/CGAL/Draw_aos/Arr_bounded_renderer.h +++ b/Arrangement_on_surface_2/include/CGAL/Draw_aos/Arr_bounded_renderer.h @@ -209,7 +209,8 @@ public: return cache; } - Execution_context ctx(Arr_bounded_render_context(m_ctx, m_bbox, cache)); + Bounded_render_context bounded_ctx(m_ctx, m_bbox, cache); + Execution_context ctx(bounded_ctx); auto top = ctx->cst_horizontal_segment(to_ft(ctx->ymax()), to_ft(ctx->xmin()), to_ft(ctx->xmax())); auto bottom = ctx->cst_horizontal_segment(to_ft(ctx->ymin()), to_ft(ctx->xmin()), to_ft(ctx->xmax())); diff --git a/Arrangement_on_surface_2/include/CGAL/Draw_aos/Arr_construct_segments.h b/Arrangement_on_surface_2/include/CGAL/Draw_aos/Arr_construct_segments.h index 80195c95f2d..d3d179bb9b3 100644 --- a/Arrangement_on_surface_2/include/CGAL/Draw_aos/Arr_construct_segments.h +++ b/Arrangement_on_surface_2/include/CGAL/Draw_aos/Arr_construct_segments.h @@ -59,7 +59,14 @@ public: template class Arr_construct_segment_impl { - static_assert(false, "Not implemented yet!"); + using Geom_traits = GeomTraits; + using X_monotone_curve_2 = typename Traits_adaptor::X_monotone_curve_2; + using FT = typename Traits_adaptor::FT; + +public: + Arr_construct_segment_impl(const GeomTraits&) { CGAL_assertion_msg(false, "Not implemented yet"); } + + X_monotone_curve_2 operator()(FT, FT, FT, FT) const {} }; template @@ -109,6 +116,7 @@ class Arr_construct_vertical_segment> using X_monotone_curve_2 = typename Traits_adaptor::X_monotone_curve_2; using Construct_x_monotone_curve_2 = typename Geom_traits::Construct_x_monotone_curve_2; using FT = typename Traits_adaptor::FT; + using Bound = typename Geom_traits::Bound; using Polynomial_1 = typename Geom_traits::Polynomial_1; public: @@ -123,11 +131,12 @@ public: Polynomial_1 x0_num(CORE::numerator(x0.lower())); Polynomial_1 x0_denum(CORE::denominator(x0.lower())); double k = 100; - double xmin = ymin.to_double() / k + x0.to_double(); - double xmax = ymax.to_double() / k + x0.to_double(); + Bound xmin = ymin.lower() / k + x0.lower(); + Bound xmax = ymax.lower() / k + x0.lower(); Polynomial_1 p_num = x0_num * k * x - k * x0_denum; Polynomial_1 p_denum = x0_denum; - return cst_x_curve(p_num, p_denum, xmin, xmax); + auto cv = cst_x_curve(p_num, p_denum, FT(xmin), FT(xmax)); + return cv; } }; diff --git a/Arrangement_on_surface_2/include/CGAL/Draw_aos/Arr_render_context.h b/Arrangement_on_surface_2/include/CGAL/Draw_aos/Arr_render_context.h index 54ac11a3054..79ff791f464 100644 --- a/Arrangement_on_surface_2/include/CGAL/Draw_aos/Arr_render_context.h +++ b/Arrangement_on_surface_2/include/CGAL/Draw_aos/Arr_render_context.h @@ -64,7 +64,8 @@ class Arr_bounds_context_mixin protected: Arr_bounds_context_mixin(const Bbox_2& bbox) - : m_bbox(bbox) {} + : m_bbox(bbox) + , to_ft() {} public: double xmin() const { return m_bbox.xmin(); } diff --git a/Arrangement_on_surface_2/include/CGAL/Draw_aos/type_utils.h b/Arrangement_on_surface_2/include/CGAL/Draw_aos/type_utils.h index 0dd41e29f00..778bdb8676e 100644 --- a/Arrangement_on_surface_2/include/CGAL/Draw_aos/type_utils.h +++ b/Arrangement_on_surface_2/include/CGAL/Draw_aos/type_utils.h @@ -1,16 +1,14 @@ #ifndef CGAL_DRAW_AOS_TYPE_UTILS_H #define CGAL_DRAW_AOS_TYPE_UTILS_H -#include "CGAL/Arr_polycurve_traits_2.h" -#include "CGAL/Arr_polyline_traits_2.h" -#include "CGAL/Cartesian.h" #include +#include +#include +#include #include #include #include #include -#include -#include #include #include #include @@ -115,6 +113,23 @@ public: using Approximate_point_2 = typename Geom_traits::Approximate_point_2; }; +template +struct Traits_adaptor> + : public Traits_adaptor_base> +{ +private: + using Geom_traits = Arr_non_caching_segment_traits_2; + +public: + constexpr static bool Has_unbounded_curves = false; + constexpr static double Approximation_sizing_factor = 1.0; + using FT = typename Kernel::FT; + using Approximate_2 = typename Geom_traits::Approximate_2; + using Approximate_number_type = typename Geom_traits::Approximate_number_type; + using Approximate_kernel = typename Geom_traits::Approximate_kernel; + using Approximate_point_2 = typename Geom_traits::Approximate_point_2; +}; + template struct Traits_adaptor> : public Traits_adaptor_base> @@ -204,20 +219,6 @@ public: using Approximate_point_2 = typename Geom_traits::Approximate_point_2; }; -template -struct Traits_adaptor> - : public Traits_adaptor_base> -{ - static_assert(false, "Approximate_2 not yet modeled by this geometry traits class."); -}; - -template -struct Traits_adaptor> - : public Traits_adaptor_base> -{ - static_assert(false, "Approximate_2 not yet modeled by this geometry traits class."); -}; - template struct Traits_adaptor> : public Traits_adaptor_base> diff --git a/Arrangement_on_surface_2/include/CGAL/draw_arrangement_2.h b/Arrangement_on_surface_2/include/CGAL/draw_arrangement_2.h index c87cf6805ed..7812116c3e4 100644 --- a/Arrangement_on_surface_2/include/CGAL/draw_arrangement_2.h +++ b/Arrangement_on_surface_2/include/CGAL/draw_arrangement_2.h @@ -630,7 +630,7 @@ void draw(const CGAL_ARR_TYPE& aos, const char* title = "2D Arrangement on Surfa CGAL::Random random((size_t(vh.ptr()))); return get_random_color(random); }; - auto viewer = draw_aos::Arr_viewer(app.activeWindow(), aos, gso, "Arrangement Viewer"); + auto viewer = draw_aos::Arr_viewer(app.activeWindow(), aos, gso, title); viewer.show(); app.exec(); }