I’m working on a project where I want to make an image of a greyhound with a mosaic of sheet metal pieces. To give it some liveliness, I wanted the sheet metal pieces to be loosely suspended and able to move with the breeze. As I prepared files for the CNC machine, I quickly realized that I would need to find the center of gravity for each of the 63 individual parts … which is not something I wanted to do by hand. I searched for ways to do it in Illustrator and while Illustrator did have two distinct “centers” for different kinds of shapes, neither was the actual centroid. The only “easy” way was to export individual shapes from illustrator, import each shape into CAD software, then back to Illustrator. No way – that process would be too laborious and any design changes would require me to repeat the whole process. I then found an equation that generally described the center of gravity of an irregular polygon, taught myself how to script in Adobe Illustrator, and voila!