3 ms·
Computational geometry algorithms are often fairly easy to explain, but implementing them robustly in quite tricky. Not only are there many edge cases, you also
by adrianN 15y ago
Computational geometry algorithms are often fairly easy to explain, but implementing them robustly in quite tricky. Not only are there many edge cases, you also need to do your calculations with arbitrary precision (at least sometimes) [1]. You're generally much better off to use some library like CGAL [2] instead of rolling your own.
[1] http://www.mpi-inf.mpg.de/~mehlhorn/ftp/classroomExamplesNonrobustness.pdf http://www.mpi-inf.mpg.de/~mehlhorn/ftp/classroomExamplesNon...
[2] http://www.cgal.org/ http://www.cgal.org/
- helmut_hed 15y agoNot to mention the somewhat less license-encumbered Boost libraries Geometry (http://www.boost.org/doc/libs/1_49_0/libs/geometry/doc/html/index.html http://www.boost.org/doc/libs/1_49_0/libs/geometry/doc/html/...) and Polygon (http://www.boost.org/doc/libs/1_49_0/libs/polygon/doc/index.htm http://www.boost.org/doc/libs/1_49_0/libs/polygon/doc/index....)