voronoi icon indicating copy to clipboard operation
voronoi copied to clipboard

An infinite loop in the function `jcv_boxshape_fillgaps`(line 1236 in jc_voronoi.h)

Open YoungCapta1n opened this issue 1 year ago • 7 comments

Love your library and it is very efficient. I run the jcv_diagram_generate using Double floating point precision from the following points (On ubuntu 22.04, Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz with 16Gb of RAM) 13.5000000000000000000000000000000000000000, 4.00000000000000000000000000000000000000000000000000 8.5000000000000000000000000000000000000000, 0.00000000000000022204460492503130808472633361816406 13.5000000000000000000000000000000000000000, 3.50000000000000000000000000000000000000000000000000 8.5000000000000000000000000000000000000000, 0.50000000000000022204460492503130808472633361816406 13.5000000000000000000000000000000000000000, 3.00000000000000000000000000000000000000000000000000 8.5000000000000000000000000000000000000000, 1.00000000000000000000000000000000000000000000000000 13.5000000000000000000000000000000000000000, 2.50000000000000000000000000000000000000000000000000 8.5000000000000000000000000000000000000000, 1.50000000000000022204460492503130808472633361816406 13.5000000000000000000000000000000000000000, 1.99999999999999977795539507496869191527366638183594 8.5000000000000000000000000000000000000000, 2.00000000000000000000000000000000000000000000000000 13.5000000000000000000000000000000000000000, 1.50000000000000000000000000000000000000000000000000 8.5000000000000000000000000000000000000000, 2.50000000000000000000000000000000000000000000000000 13.5000000000000000000000000000000000000000, 0.99999999999999977795539507496869191527366638183594 8.5000000000000000000000000000000000000000, 3.00000000000000000000000000000000000000000000000000 13.5000000000000000000000000000000000000000, 0.49999999999999977795539507496869191527366638183594 8.5000000000000000000000000000000000000000, 3.50000000000000000000000000000000000000000000000000 13.5000000000000000000000000000000000000000, 0.00000000000000000000000000000000000000000000000000 8.5000000000000000000000000000000000000000, 4.00000000000000000000000000000000000000000000000000 13.0000000000000000000000000000000000000000, 0.00000000000000000000000000000000000000000000000000 9.0000000000000000000000000000000000000000, 4.00000000000000000000000000000000000000000000000000 12.5000000000000000000000000000000000000000, 0.00000000000000000000000000000000000000000000000000 9.5000000000000000000000000000000000000000, 4.00000000000000000000000000000000000000000000000000 12.0000000000000000000000000000000000000000, 0.00000000000000000000000000000000000000000000000000 10.0000000000000000000000000000000000000000, 4.00000000000000000000000000000000000000000000000000 11.5000000000000000000000000000000000000000, 0.00000000000000000000000000000000000000000000000000 10.5000000000000000000000000000000000000000, 4.00000000000000000000000000000000000000000000000000 11.0000000000000000000000000000000000000000, 0.00000000000000000000000000000000000000000000000000 11.0000000000000000000000000000000000000000, 4.00000000000000000000000000000000000000000000000000 10.5000000000000000000000000000000000000000, 0.00000000000000000000000000000000000000000000000000 11.5000000000000000000000000000000000000000, 4.00000000000000000000000000000000000000000000000000 10.0000000000000000000000000000000000000000, 0.00000000000000000000000000000000000000000000000000 12.0000000000000000000000000000000000000000, 4.00000000000000000000000000000000000000000000000000 9.5000000000000000000000000000000000000000, 0.00000000000000000000000000000000000000000000000000 12.5000000000000000000000000000000000000000, 4.00000000000000000000000000000000000000000000000000 9.0000000000000000000000000000000000000000, 0.00000000000000022204460492503130808472633361816406 13.0000000000000000000000000000000000000000, 4.00000000000000000000000000000000000000000000000000 However, An infinite loop occurs in the function jcv_boxshape_fillgaps(line 1236 in jc_voronoi.h), resulting in an error in 2d voronoi generation. Thanks!

YoungCapta1n avatar Jun 12 '23 10:06 YoungCapta1n

I have also stumbled upon this issue with the following points: 1.5484909, -0.21024238 1.5413352, -0.21024236 1.5378445, -0.21024236 1.5343539, -0.21024235 1.5308806, -0.19333011 and a rectangular clip from (-4,-4) to (4,4) Upping the precision from float to double does not resolve the problem.

Initial investigation leads me to believe there is something wrong in the generation of the breachline in this case.

Wambomango avatar Jun 30 '23 12:06 Wambomango

First of all, I wanted to thank you for this great initiative and excellent work.

I have a similar (if not the same) issue, where the program infinitely loops within jcv_fillgaps(). Subsequently, more and more memory is allocated within each loop iteration, ultimately killing the program or freezing the OS.

I've attached a .csv file with points (x,y) and I used {{0,0},{7339,4984}} as a rectangular bounding box (x,y). I used the default settings (i.e. float).

points(16521).csv

14RS avatar Jul 11 '23 16:07 14RS

I also want to add that this issue does not occur for me in version 0.7, but is present now in jc_voronoi.h version 0.9.

14RS avatar Jul 12 '23 08:07 14RS

Thanks for the info!

Yes, I seem to have broken something in 0.9 (I need better tests apparently). Hopefully, I can schedule some time this weekend to fix it.

JCash avatar Jul 12 '23 08:07 JCash

I was wondering if there is any further development on the look-out. If so, I'd be more than willing to help out and do some testing.

14RS avatar Sep 06 '23 17:09 14RS

If I can do anything to help too I will. In my program I generate the diagram from a set of random points and this issue seems to appear about 5-10% of time

finnwrt avatar Sep 06 '23 20:09 finnwrt

I got the same issue, anyone knows how to fix it? Thanks!

ericheee111 avatar Aug 09 '24 06:08 ericheee111