JCash / voronoi

A C implementation for creating 2D voronoi diagrams
MIT License
622 stars 92 forks source link

jcv_fillgaps crashes on specific point configuration #7

Closed kylemcdonald closed 7 years ago

kylemcdonald commented 7 years ago
Assertion failed: (internal->numsites == 1), function jcv_fillgaps, file jc_voronoi.h, line 1125.
fish: './relax -r 10 <test.csv >output…' terminated by signal SIGABRT (Abort)

Example file attached: test.csv.zip

Here is a visualization of where the two problematic points are:

z0btmaaaaasuvork5cyii -1

If I remove either of these points, the problem goes away.

JCash commented 7 years ago

Thanks for the report @kylemcdonald and for the test data!

The problem was that points outside of the bounding box (0,0),(width,height) were never really supported properly, and that was a poor design choice by me.

I've updated the api to take a bounding rectangle (or null) and the function now prunes the input points based on the bounding box.

The documentation was updated with a note about this.

Feel free to test these fixes on the https://github.com/JCash/voronoi/tree/dev branch I'll probably merge into master in a couple of days.

JCash commented 7 years ago

The master branch is now updated with these fixes from dev