add getCentroid method