I'm interested in calculating the "optical alignment" of an icon. For example:
If you're familiar with UI design, you know certain icons, such as the "play" button triangle as demonstrated above, often feel out of place. Even though the rectangular bounds of the icon are technically centered, the icon still doesn't feel centered. This is because of the uneven distribution of the icon's surface area.
What I've tried:
It's funny, when I was researching this before asking, after Googling "volumetric center icon", the first Google result that came up was a question I asked at Mathematics Stack Exchange on this very same topic 2 years ago, with no answer.
On Math SE there is a similar question, but as it uses a JPEG image as its example, the solution that answers are pointing out is to use the pixel grid to calculate the solution. I could of course render the vector icon on HTML5 canvas (I'm a web developer and would ultimately like to do this in JavaScript, even though I'm just tagging this as "algorithm") and count pixels but that would be an ugly approach to say the least.
I'm wondering if there's any algorithm I can use to calculate the volumetric center of a vector icon or even simply the optical alignment (which could be done manually by drawing the smallest circle possible around the icon as shown above, but I'm interested in an automatic approach). I realize this may be a challenging question, because a vector icon could have any number of shapes combined to make it, vector shapes can have holes in them, etc.
Question:
Does anyone know how to write such an algorithm? When it comes to complex math algorithms such as this, I don't know where to begin.
Note: There is this question but it seems to be only asking about polygons, and answers don't address odd curves.