cgal icon indicating copy to clipboard operation
cgal copied to clipboard

Arrangement Bézier insertion sometimes throws CGAL::Assertion_exception

Open Yvee1 opened this issue 2 weeks ago • 2 comments

Issue Details

On insertion of specific Bézier curves into an arrangement, CGAL crashes (segfault in release mode, assertion exception in debug mode). I followed the setup used in the manual, so I should be using the right kernels.

Source Code

#include <CGAL/Arr_Bezier_curve_traits_2.h>
#include <CGAL/Cartesian.h>
#include <CGAL/CORE_algebraic_number_traits.h>
#include <CGAL/Arrangement_2.h>

int main() {
    using Nt_traits = CGAL::CORE_algebraic_number_traits;
    using Rational = Nt_traits::Rational;
    using Algebraic = Nt_traits::Algebraic;
    using Rat_kernel = CGAL::Cartesian<Rational>;
    using Alg_kernel = CGAL::Cartesian<Algebraic>;
    using Rat_point = Rat_kernel::Point_2;
    using Traits = CGAL::Arr_Bezier_curve_traits_2<Rat_kernel, Alg_kernel, Nt_traits>;
    using Bezier_curve = Traits::Curve_2;

//    std::vector<Rat_point> controls1({Rat_point(0, 0), Rat_point(1, 2), Rat_point(2, -1), Rat_point(3, 0)}); //works
    std::vector<Rat_point> controls1({Rat_point(0, 0), Rat_point(1, 2), Rat_point(2, -1), Rat_point(-0.19959947101662578, 0.20031960128096571)}); //crashes
    Bezier_curve cgalCurve1(controls1.begin(), controls1.end());

    std::vector<Rat_point> controls2({Rat_point(-2, 6), Rat_point(2, 3 + 1.0/3), Rat_point(3 + 1.0/3, 1.0/3), Rat_point(2, -3)});
    Bezier_curve cgalCurve2(controls2.begin(), controls2.end());

    std::vector<Bezier_curve> curves;
    std::vector<Traits::Point_2> inters;
    Traits traits;

    CGAL::Arrangement_2<Traits> arr;
    CGAL::insert(arr, cgalCurve1);
    CGAL::insert(arr, cgalCurve2);
}

Environment

  • Operating system (Windows/Mac/Linux, 32/64 bits): WSL2 on Windows, 64 bits
  • Compiler: g++
  • CGAL version: 6.0.1-1
  • Boost version: 1.83.0.2

Yvee1 avatar Dec 09 '25 14:12 Yvee1

I would like to work on this issue can you assign it to me?

mariam-29 avatar Dec 09 '25 16:12 mariam-29

Could you assign me this issue?

ItsGunjit avatar Dec 10 '25 17:12 ItsGunjit