added base for triangulation functions, to be done server-side