HoleDetection/util.hpp
/**
 * @brief Calculate the coordinates of the centroid of the given points
 * @param pc      A shared pointer to the point cloud under consideration
 * @param indices Indices for the points to consider
 * @return Point
*/
@brief Calculate the coordinates of the centroid of the given points
@param pc      A shared pointer to the point cloud under consideration
@param indices Indices for the points to consider
@return Point
@brief Calculate the coordinates of the centroid of the given points @param pc A shared pointer to the point cloud under consideration @param indices Indices for the points to consider @return Point
Point Centroid(PCRef pc, const std::vector<int>& indices)
{
    float x = 0.0;
    float y = 0.0;
    float z = 0.0;
    for (auto index : indices)
    {
        auto p = (*pc)[index];
        x += p.x;
        y += p.y;
        z += p.z;
    }
    return Point { x / indices.size(), y / indices.size(), z / indices.size() };
}
Point Centroid ( PCRef pc , const std :: vector < int > & indices ) { float x = 0.0 ; float y = 0.0 ; float z = 0.0 ; for ( auto index : indices ) { auto p = ( * pc ) [ index ] ; x += p . x ; y += p . y ; z += p . z ; } return Point { x / indices . size ( ) , y / indices . size ( ) , z / indices . size ( ) } ; }
@brief Calculate the coordinates of the centroid of the given points
 @param pc      A shared pointer to the point cloud under consideration
 @param indices Indices for the points to consider
 @return Point
@brief Calculate the coordinates of the centroid of the given points @param pc A shared pointer to the point cloud under consideration @param indices Indices for the points to consider @return Point