I have a set of rectangle tiles, each of them with different shapes on them. One tile could for example contain the texture of a circle, another a rectangle, or maybe even a polygon.
These shapes do not fill up the whole tile, instead they are somewhere on the texture. One tile could for example just contain a small rectangle in the top-right corner. The other parts of the tiles are empty or transparent, i.e. these other pixels have an alpha value of 0.
Now I need to calcuate the "center of gravity" (CoG) within each tile. I know that is not be the best term to describe it, but I don't know of any better. With CoG in this context I mean the spot on the tile that is the center point of the shapes, i.e. those parts of the tiles that are not transparent.
For example, if the tile has one small rectangle in the top-right corner, then the CoG as I mean it would be in the center of the rectangle. In this case thus that CoG would not be in the center of the tile, but also somewhere in the top-right corner.
Important is that fact that the color of the shapes do not count. I am solely interested in the transparent vs. non-transparent pixels/areas on the tile.
Is there any "best practice" to calculate what I am looking for?