def calc_centroids(triangles):
    """ Calculates the centroids of the of triangles of the convex hull.

    Parameters
    ----------
    triangles : an array of shape (N, 3, 3)
        consisting of N triangles defined by 3 points in 3D

    Returns
    ----------
    centroids : an array of shape (N, 3)
        consisting of the N centroids of the triangles in 3D

    """

    return triangles.sum(axis=1)/3.0