Closed MilchRatchet closed 3 years ago
How did it get stuck? Did it display the Jarvis march result? Did you press Y or N to validate the result?
Ah ok that was the Problem.
I run it 3 times. The first time it crashed with a memory error at PAL/src/CGL/CGL_CONVEXHULL.c:165
. The second time I run it in valgrind and valgrind found a bunch of warnings and errors. The third time I run it again without valgrind and it worked as expected.
So maybe looking for the origin of the valgrind issues seems to be the most promising approach.
I will look into this. I just now realized that I can just use the debugger instead to figure out where things go wrong without having to wait 10sec for each run.
Ok, this was a shitshow. I rewrote the whole algorithm and now it works I think. Could you test it again?
I think there is still a memory leak. Valgrind says there a two times 17 bytes lost in line 9 in the file VLL_SCREEN.c
.
I think that is SDL which causes that. The memory is allocated by SDL and I call the free functions provided by SDL.
This implements Chans algorithm. It works but it rarely crashes. I am unsure why that is as I can't really just throw valgrind at it as it works most of the time.
I also improved the output of the test a bit and the warnings no longer appear.
I noticed that the setcover function signature was not quite
C
conform. I changed it and it seems to still work. Have a look at it though.