MilchRatchet / PAL

Polytime Algorithm Libraries
zlib License
0 stars 0 forks source link

Chans algorithm #6

Closed MilchRatchet closed 3 years ago

MilchRatchet commented 3 years ago

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.

MilchRatchet commented 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?

Mathemalsky commented 3 years ago

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.

MilchRatchet commented 3 years ago

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.

MilchRatchet commented 3 years ago

Ok, this was a shitshow. I rewrote the whole algorithm and now it works I think. Could you test it again?

Mathemalsky commented 3 years ago

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.

MilchRatchet commented 3 years ago

I think that is SDL which causes that. The memory is allocated by SDL and I call the free functions provided by SDL.