Fixed errors with delaunay triangulation

The delaunay triangulation has not been built completely before. This
has been fixed and also some code has been simplified.