Add compute triangle centroid function.