I wanted to isolate my issue to the recursive pair algorithm by (reasonably) confirming the correctness of my triangle-triangle intersection code. Turns out there is a package called CGAL which contains a metric ton of graphics related content. I wrote an executable which runs a specified number of tests on random triangles and compares the CGAL algorithm with yours. If there is an inconsistency, it will display the triangles in the igl viewer so you can see the case for yourself.
Just save the code into a new cpp file on the level of distance.cpp, intersect.cpp, rays.cpp. Then:
Make sure you go online and install CGAL (I used brew install cgal since I'm on mac)
Make sure to add the 3 lines shown to your cmake lists file.
Make sure to re-run the cmake command in your build directory (and then make)
Let me know if something doesn't work as it should
I suggest people to increase their test size to a really large number. It depends on your intersection implementation, but I got inconstancies at around 1e6 or 1e7.
I wanted to isolate my issue to the recursive pair algorithm by (reasonably) confirming the correctness of my triangle-triangle intersection code. Turns out there is a package called CGAL which contains a metric ton of graphics related content. I wrote an executable which runs a specified number of tests on random triangles and compares the CGAL algorithm with yours. If there is an inconsistency, it will display the triangles in the igl viewer so you can see the case for yourself.
Just save the code into a new cpp file on the level of distance.cpp, intersect.cpp, rays.cpp. Then:
brew install cgal
since I'm on mac)cmake
command in your build directory (and thenmake
) Let me know if something doesn't work as it shouldCMAKE LINES:
CODE: