starting to write my own triangulation method