Change generate triangles from image algo to take the average position