Refactor everything to accept arrays and polygons tot est for triangles