openvoronoi icon indicating copy to clipboard operation
openvoronoi copied to clipboard

Assertion `check_dist(edge, sl, s3)' failed

Open Rogach opened this issue 10 years ago • 2 comments

The following code results in error:

    ovd::VoronoiDiagram* vd = new ovd::VoronoiDiagram(1,100);

    ovd::Point p1(0.41164403323558574,-0.6789386939364543);
    ovd::Point p2(0.17427452375132169,-0.6522148409835533);
    ovd::Point p3(0.15951277675921582,-0.6538785084950686);
    ovd::Point p4(0.3890141779152667,-0.6928288255549844);
    ovd::Point p5(0.3860913593953006,-0.6919949537598736);
    ovd::Point p6(0.42532972342719244,-0.6914003202947938);
    ovd::Point p7(-0.16212113598677202,-0.6733320323817963);

    int v1 = vd->insert_point_site(p1);
    int v2 = vd->insert_point_site(p2);
    vd->insert_point_site(p3);
    int v4 = vd->insert_point_site(p4);
    int v5 = vd->insert_point_site(p5);
    int v6 = vd->insert_point_site(p6);
    int v7 = vd->insert_point_site(p7);

    vd->insert_line_site(v4, v5);
    vd->insert_line_site(v1, v2);
    vd->insert_line_site(v6, v7);

Here's the output.

Here's the view on the segment being added, after vertex marking was done, but no new vertices were added: first

Here's the view below that line, displaying the problematic edge: second Failure happens when vertex is positioned on (0.102,-1.687)-(0.098,-1.714) edge (red circles mark IN vertices). Problem is, there is no solution lying on that edge (no point equidistant to the shortest segment, lone pointsite and newly added linesite). Maybe the problem is in the way vertices were marked?

Rogach avatar Feb 23 '15 20:02 Rogach

Vertex (0.098,-1.714) is not added because it violates C5 predicate - big face to the right has no adjacent IN vertex - upper vertex is pointsite, can't be IN, and (0.072,-1.868) was not considered yet.

Rogach avatar Feb 24 '15 09:02 Rogach

For the moment, I fixed it by accepting a face if it has a SEPPOINT vertex adjacent to considered vertex (in predicate_c5). It did solve this error and several others (in my relatively small testbed), but maybe I haven't considered some corner cases?

Rogach avatar Feb 24 '15 09:02 Rogach