modified getCenter with 3 components (z=0) in 2D case