add centroid computation, currently unused