Volumetric center of a polygon

algorithmscentroidgeometrypolygons

Is there a quick and efficient algorithm for calculating the volumetric center (probably the wrong term) of a polygon like that shown in the figure below somewhere around the blue dot? I'm not referring to centroid (approximately the red dot) as the average of points in the polygon, but based on the enclosed space. There won't be holes in this, though a solution which supports holes would also be welcome.

enter image description here

Best Answer

Pick your favorite origin and then the center of mass $\vec{v}_{cm}$ is:

$$\vec{v}_{cm} = \frac{\sum{A_j\vec{v}_j}}{\sum{A_j}}$$

where $A_j$ is the area of the $j$th rectangle and $\vec{v}_j$ is the center of the $j$th rectangle.

This assumes uniform density throughout the rectangles.