CGAL::insert on an Arrangement_2< Arr_Bezier_curve_traits_2 > will occasionally violate an assertion. I can't state certainly what the problematic scenarios have in common, but they often seem to involve one curve terminating in the middle of another. I've put together a minimal example. For me (Windows 8.1, MSVC2015 running in QtCreator, CGAL 4.14), this fails in debug mode at the assertion of line 234 in No_intersection_surface_sweep_2_impl.h:

CGAL_assertion((m_statusLine.size() == 0)); 

In release mode, my whole system hangs until I can manage to kill the offending process.

Can anyone reproduce this? Am I doing something wrong, or is this a bug? There have been bugs with inserting Bezier curves into arrangements before—see this thread concerning a since-fixed problem in an earlier CGAL version.

main.cpp:

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

#include <sstream>

using NtTraits = CGAL::CORE_algebraic_number_traits;
using Rational = NtTraits::Rational;
using Algebraic = NtTraits::Algebraic;
using RationalKernel = CGAL::Cartesian< Rational >;
using AlgebraicKernel = CGAL::Cartesian< Algebraic >;
using ArrTraits = CGAL::Arr_Bezier_curve_traits_2< RationalKernel,
AlgebraicKernel, NtTraits >;
using BezierCurve2 = ArrTraits::Curve_2;
using Arrangement = CGAL::Arrangement_2< ArrTraits >;

int main()
{
    // Change 10.1 to 10 and problem goes away.
    const std::string curvesData =
                "2            \
                2 -10 0 10.1 0 \
                2 10 10 10 0 ";

    std::istringstream stream( curvesData );
    std::vector< BezierCurve2 > curvesToInsert;
    size_t numCurves = 0;
    stream >> numCurves;
    for( size_t i = 0; i < numCurves; i++ ) {
        BezierCurve2 curve;
        stream >> curve;
        curvesToInsert.push_back( curve );
    }

    Arrangement arr;
    // Assertion violation here.
    CGAL::insert( arr, curvesToInsert.begin(), curvesToInsert.end() );
    return 0;
}

0 Answers