I once tried implementing the classical Delaunay triangulation algorithm from scratch and got close to a good solution, but never could iron out some major bugs. I think of it as a testament to the difficulty of algorithms and computational geometry.