began work on triangulation and helper functions