CGAL / cgal

The public CGAL repository, see the README below
https://github.com/CGAL/cgal#readme
Other
4.99k stars 1.39k forks source link

Voronoi_Diagram_2 crash on vertex enumeration. #4196

Closed diablohsh closed 5 years ago

diablohsh commented 5 years ago

Issue Details

Voronoi_Diagram_2 crash on vertex enumeration,printing: CGAL error: assertion violation! Expression : is_finite(d) File : D:\artauto\3rd\env_win\include\CGAL/Interval_nt.h Line : 123 Explanation: Refer to the bug-reporting instructions at https://www.cgal.org/bug_report.html

Source Code

include

include

define CGAL_HEADER_ONLY 1

include <CGAL/Exact_predicates_exact_constructions_kernel.h>

include <CGAL/Segment_Delaunay_graph_filtered_traits_2.h>

include <CGAL/Segment_Delaunay_graph_traits_2.h>

include <CGAL/Segment_Delaunay_graph_2.h>

include <CGAL/Segment_Delaunay_graph_adaptation_traits_2.h>

include <CGAL/Segment_Delaunay_graph_adaptation_policies_2.h>

include <CGAL/Voronoi_diagram_2.h>

using namespace std;

typedef CGAL::Exact_predicates_exact_constructions_kernel K; typedef CGAL::Segment_Delaunay_graph_filtered_traits_2 SDGT; typedef CGAL::Segment_Delaunay_graph_2 SDG; typedef CGAL::Segment_Delaunay_graph_adaptation_traits_2 SDGAT; typedef CGAL::Segment_Delaunay_graph_degeneracy_removal_policy_2 SDGAP; typedef CGAL::Voronoi_diagram_2<SDG, SDGAT, SDGAP> VD;

typedef K::FT Num_t; typedef K::Point_2 Point_2; typedef SDGAT::Site_2 Site_2;

int main() { istringstream strm("2frr0ikagt11vzhuiatp/15zs9k98eitpupwj4we80 cw564i7ri1f5t7h4b77/2ucz5b4i8edxrmn1n6yo wyt11sekh6r99rl0ee9/1onott9c4z6xcdezn2sjk cw564i7ri1f5t7h4b77/2ucz5b4i8edxrmn1n6yo wyt11sekh6r99rl0ee9/1onott9c4z6xcdezn2sjk chqyxkl6xqebr0cr54j/2ucz5b4i8edxrmn1n6yo wyt11sekh6r99rl0ee9/1onott9c4z6xcdezn2sjk gsz5ni6mdl19zt1h05s5pl5/6feozp9szezjhy3eg5f9n280 5wleuesqslt5wwyevkd/15zs9k98eitpupwj4we80 mb5z5py08y6isxjvpy1/8j2xfxdip75tavx4xkw0 307s5bh00d/15zs9k98eitpupwj4we80 mb5z5py08y6isxjvpy1/8j2xfxdip75tavx4xkw0 307s5bh00d/15zs9k98eitpupwj4we80 l3zdkx2ak140mc6s7q1/8j2xfxdip75tavx4xkw0 307s5bh00d/15zs9k98eitpupwj4we80 zlknn4izd/8j2xfxdip75tavx4xkw0 5wleuesqslt5wwyevkd/15zs9k98eitpupwj4we80 zlknn4izd/8j2xfxdip75tavx4xkw0 2locfcz37ljuu49hg6dp/15zs9k98eitpupwj4we80 zlknn4izd/8j2xfxdip75tavx4xkw0 2locfcz37ljuu49hg6dp/15zs9k98eitpupwj4we80 176lksvpoy23r90817d/8j2xfxdip75tavx4xkw0 2locfcz37ljuu49hg6dp/15zs9k98eitpupwj4we80 cw564i7ri1f5t7h4b77/2ucz5b4i8edxrmn1n6yo");

vector<Point_2> vecPoint;

for (string line; getline(strm, line, ' ');)
{
    mpq_t x, y;
    mpq_init(x);mpq_init(y);

    mpq_set_str(x, line.c_str(), 36);

    getline(strm, line, ' ');
    mpq_set_str(y, line.c_str(), 36);

    vecPoint.emplace_back(Num_t(x), Num_t(y));
}

vector<Site_2> vecSite;

for (size_t i = 1; i < vecPoint.size(); i++)
    vecSite.push_back(Site_2::construct_site_2(vecPoint[i - 1], vecPoint[i]));

vecSite.push_back(Site_2::construct_site_2(vecPoint.back(), vecPoint.front()));

VD vd;
vd.insert(vecSite.begin(), vecSite.end());

for_each(vd.vertices_begin(), vd.vertices_end(), [&](const VD::Vertex& v)
{
    auto p = v.point();
    cout << p << endl;
});

return 0;

}

Environment

diablohsh commented 5 years ago

Hi all, with the following kernel and traits, the problem is gone.

typedef CGAL::Exact_predicates_exact_constructions_kernel_with_sqrt K; typedef CGAL::Segment_Delaunay_graph_traits_2<K,CGAL::Field_with_sqrt_tag> SDGT; typedef CGAL::Segment_Delaunay_graph_2 SDG; typedef CGAL::Segment_Delaunay_graph_adaptation_traits_2 SDGAT; typedef CGAL::Segment_Delaunay_graph_degeneracy_removal_policy_2 SDGAP; typedef CGAL::Voronoi_diagram_2<SDG, SDGAT, SDGAP> VD;