Here is Canvas object wihch demonstrate the problem.

The first section property that must be calculated is the location of the centroid.