bug fixes and support g++

This commit is contained in:
Shepard Liu 2025-07-14 22:09:22 +08:00
parent 30b9a29ee9
commit e70cf9fa17
18 changed files with 150 additions and 173 deletions

View File

@ -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;
}

View File

@ -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;
insert(arr, curves.begin(), curves.end());
print_arrangement_size(arr);
CGAL::draw(arr);
CGAL::draw(arr, "circular_arcs");
return 0;
}

View File

@ -2,11 +2,11 @@
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Arrangement_2.h>
#include <CGAL/Arr_segment_traits_2.h>
#include <CGAL/Arr_non_caching_segment_traits_2.h>
#include <CGAL/draw_arrangement_2.h>
#include <iterator>
using Kernel = CGAL::Exact_predicates_exact_constructions_kernel;
using Traits = CGAL::Arr_segment_traits_2<Kernel>;
using Traits = CGAL::Arr_non_caching_segment_traits_2<Kernel>;
using Point = Traits::Point_2;
using Arrangement_2 = CGAL::Arrangement_2<Traits>;

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -46,6 +46,6 @@ int main() {
insert(arr, pi2);
insert(arr, pi3);
print_arrangement_size(arr); // print the arrangement size
CGAL::draw(arr);
CGAL::draw(arr, "polylines");
return 0;
}

View File

@ -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;
}

View File

@ -51,7 +51,7 @@ int main() {
std::cout << std::endl;
}
CGAL::draw(arr);
CGAL::draw(arr, "unbounded_non_intersecting");
return 0;
}

View File

@ -2,12 +2,12 @@
#define CGAL_DRAW_AOS_ARR_APPROXIMATE_POINT_2_AT_X_H
#include <boost/iterator/function_output_iterator.hpp>
#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 <CGAL/Arr_enums.h>
#include <CGAL/number_utils.h>
#include <CGAL/Arr_rational_function_traits_2.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>
namespace CGAL {
namespace draw_aos {
@ -89,20 +89,19 @@ class Arr_approximate_point_2_at_x<Arr_rational_function_traits_2<Kernel>>
using X_monotone_curve_2 = typename Traits_adaptor<Geom_traits>::X_monotone_curve_2;
using FT = typename Traits_adaptor<Geom_traits>::FT;
using Approx_point = typename Arr_approximation_geometry_traits<Geom_traits>::Approx_point;
using Construct_curve_end = Arr_construct_curve_end<Geom_traits>;
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<Approx_point> operator()(const X_monotone_curve_2& curve, FT x) const {
std::optional<Point_2> min_end = m_cst_curve_end(curve, ARR_MIN_END);
if(min_end.has_value() && x < min_end->x()) {
return std::nullopt;
}
std::optional<Point_2> 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<double>::lowest());
FT xmax = curve.right_parameter_space_in_x() == ARR_INTERIOR ? curve.right_x()
: to_ft(std::numeric_limits<double>::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<Geom_traits> to_ft;
};
} // namespace draw_aos

View File

@ -8,11 +8,10 @@
#include <optional>
#include <vector>
#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 <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>
namespace CGAL {
namespace draw_aos {
@ -50,6 +49,7 @@ class Arr_bounded_approximate_curve_2_impl<Arrangement, false>
const Intersections_vector& bottom_inters,
Polyline_geom& polyline)
: Arr_context_delegator<Bounded_render_context>(ctx)
, to_ft()
, curve(curve)
, m_approx_pt_at_x(approx_pt_at_x)
, top_inters(top_inters)

View File

@ -10,13 +10,13 @@
#include <boost/iterator/function_output_iterator.hpp>
#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 <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>
namespace CGAL {
@ -212,7 +212,7 @@ class Arr_bounded_approximate_face_2
using Bounded_render_context = Arr_bounded_render_context<Arrangement>;
using Triangulator = Arr_bounded_face_triangulator<Arrangement>;
using Patch_boundary = Patch_boundary<Geom_traits>;
using Patch = Patch_boundary<Geom_traits>;
using Simplifier = Colinear_simplifier<Geom_traits, typename Triangulator::Insert_iterator>;
struct Left_to_right_tag
@ -236,13 +236,13 @@ private:
using Insert_iterator = boost::function_output_iterator<std::function<void(Approx_point pt)>>;
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<Bounded_render_context>(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<Approx_point> 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<Outer_ccb_tag, true>(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

View File

@ -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()));

View File

@ -59,7 +59,14 @@ public:
template <typename GeomTraits>
class Arr_construct_segment_impl<GeomTraits, false>
{
static_assert(false, "Not implemented yet!");
using Geom_traits = GeomTraits;
using X_monotone_curve_2 = typename Traits_adaptor<Geom_traits>::X_monotone_curve_2;
using FT = typename Traits_adaptor<Geom_traits>::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 <typename GeomTraits>
@ -109,6 +116,7 @@ class Arr_construct_vertical_segment<Arr_rational_function_traits_2<Kernel>>
using X_monotone_curve_2 = typename Traits_adaptor<Geom_traits>::X_monotone_curve_2;
using Construct_x_monotone_curve_2 = typename Geom_traits::Construct_x_monotone_curve_2;
using FT = typename Traits_adaptor<Geom_traits>::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;
}
};

View File

@ -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(); }

View File

@ -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 <type_traits>
#include <CGAL/Arr_non_caching_segment_traits_2.h>
#include <CGAL/Arr_polycurve_traits_2.h>
#include <CGAL/Arr_polyline_traits_2.h>
#include <CGAL/Arr_segment_traits_2.h>
#include <CGAL/Arr_linear_traits_2.h>
#include <CGAL/Arr_circle_segment_traits_2.h>
#include <CGAL/Arr_conic_traits_2.h>
#include <CGAL/Arr_circular_arc_traits_2.h>
#include <CGAL/Arr_Bezier_curve_traits_2.h>
#include <CGAL/Arr_geodesic_arc_on_sphere_traits_2.h>
#include <CGAL/Arr_rational_function_traits_2.h>
#include <CGAL/Arr_algebraic_segment_traits_2.h>
@ -115,6 +113,23 @@ public:
using Approximate_point_2 = typename Geom_traits::Approximate_point_2;
};
template <typename Kernel>
struct Traits_adaptor<Arr_non_caching_segment_traits_2<Kernel>>
: public Traits_adaptor_base<Arr_non_caching_segment_traits_2<Kernel>>
{
private:
using Geom_traits = Arr_non_caching_segment_traits_2<Kernel>;
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 <typename SegmentTraits>
struct Traits_adaptor<Arr_polyline_traits_2<SegmentTraits>>
: public Traits_adaptor_base<Arr_polyline_traits_2<SegmentTraits>>
@ -204,20 +219,6 @@ public:
using Approximate_point_2 = typename Geom_traits::Approximate_point_2;
};
template <typename RatKernel, typename AlgKernel, typename NtTraits>
struct Traits_adaptor<Arr_Bezier_curve_traits_2<RatKernel, AlgKernel, NtTraits>>
: public Traits_adaptor_base<Arr_Bezier_curve_traits_2<RatKernel, AlgKernel, NtTraits>>
{
static_assert(false, "Approximate_2 not yet modeled by this geometry traits class.");
};
template <typename Kernel>
struct Traits_adaptor<Arr_circular_line_arc_traits_2<Kernel>>
: public Traits_adaptor_base<Arr_circular_line_arc_traits_2<Kernel>>
{
static_assert(false, "Approximate_2 not yet modeled by this geometry traits class.");
};
template <typename Kernel>
struct Traits_adaptor<Arr_rational_function_traits_2<Kernel>>
: public Traits_adaptor_base<Arr_rational_function_traits_2<Kernel>>

View File

@ -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();
}