-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
Issue Details
I'm using Arr_conic_traits_2 to compute the intersection of two conic arcs. However i only have values in c++ double precision. The violation happens when calling construct curve:
CGAL error: assertion violation!
Expression : side == cv.sign_of_extra_data(target.x(), target.y())
File : /usr/include/CGAL/Arr_conic_traits_2.h
Line : 3403
Explanation:
Refer to the bug-reporting instructions at https://www.cgal.org/bug_report.html
terminate called after throwing an instance of 'CGAL::Assertion_exception'
what(): CGAL ERROR: assertion violation!
Expr: side == cv.sign_of_extra_data(target.x(), target.y())
File: /usr/include/CGAL/Arr_conic_traits_2.h
Line: 3403
Aborted (core dumped)
Looking at the file it seems like the issue is that the points i'm providing lie on different sides of the conic. However checking via geogebra they lie on the same side of the conic. I attached two examples with almost identical conics but one fails and the other succeeds. I acknowledge that this might be a numerical issue with double precision however i checked the curves in geogebra with the same factors that i pass to cgal. I use the variant of construct_curve that takes a conic and two approximate points with their respective conic. As far as i understand it the closest intersection of the conic to the approximation point is used. Above the construct_curve call i commented the relevant geogebra commands.
Source Code
typedef CGAL::CORE_algebraic_number_traits Nt_traits;
typedef Nt_traits::Rational Rational;
typedef Nt_traits::Algebraic Algebraic;
typedef CGAL::Cartesian<Rational> Rat_kernel;
typedef CGAL::Cartesian<Algebraic> Alg_kernel;
typedef CGAL::Arr_conic_traits_2<Rat_kernel, Alg_kernel, Nt_traits> Conic_traits;
typedef Conic_traits::Curve_2 Conic_curve;
typedef Conic_traits::Point_2 Point_2;
typedef CGAL::Arrangement_2<Conic_traits> Arrangement_2;
void cgal_bug_report() {
auto R = [&](double x) { return CGAL::to_rational<Rational>(x); };
Conic_traits traits;
auto construct_curve = traits.construct_curve_2_object();
// Geogebra: Conic({1679.36, 3200, 5564615.705600001, 5471.999999999999, -208676.60799999998, -277100.80000000005}), Point(-902.0168670551287, 395.1301522952306), Conic({1, 1, -979900, 0, -20, -20}), Point(625.2597338570214, -765.6000643980034)))
construct_curve(R(1679.3599999999997), R(3200), R(5471.999999999999), // A, C, B
R(-208676.60799999998), R(-277100.80000000005), R(5564615.705600001), // D, E, F
CGAL::Orientation::CLOCKWISE,
Point_2(R(-902.0168670551287), R(395.1301522952306)),
R(1), R(1), R(0), // A, C, B
R(-20), R(-20), R(-979900), // D, E, F
Point_2(R(625.2597338570214), R(-765.6000643980034)),
R(1), R(1), R(0), // A, C, B
R(-20), R(-20), R(-979900) // D, E, F
);
}
//almost the same conic but working this time.
void cgal_bug_report_working() {
auto R = [&](double x) { return CGAL::to_rational<Rational>(x); };
Conic_traits traits;
auto construct_curve = traits.construct_curve_2_object();
// Geogebra: Conic({1679.36, 3200, 5595877.4081, 5496, -210228.75599999996, -277889.19999999995}), Point(-901.0190050356318, 397.4846738438661), Conic({1, 1, -979900, 0, -20, -20}), Point(623.9900519954263, -766.6055730231748)))
construct_curve(R(1697.6399999999999), R(3200), R(5496), // A, C, B
R(-210228.75599999996), R(-277889.19999999995), R(5595877.4081), // D, E, F
CGAL::Orientation::CLOCKWISE,
Point_2(R(-901.0190050356318), R(397.4846738438661)),
R(1), R(1), R(0), // A, C, B
R(-20), R(-20), R(-979900), // D, E, F
Point_2(R(623.9900519954263), R(-766.6055730231748)),
R(1), R(1), R(0), // A, C, B
R(-20), R(-20), R(-979900) // D, E, F
);
}Environment
- Operating system (Windows/Mac/Linux, 32/64 bits): Linux 64 bit
- Compiler: clang++ 18.1.3 (1ubuntu1)
- Release or debug mode: debug
- Specific flags used (if any): /
- CGAL version: 5.6
- Boost version: 1.83
- Other libraries versions if used (Eigen, TBB, etc.): //