semi-metric triangles implementations