Calculating Center of Mass in an Unbounded 2D Environment

We study the behavior of simple, 2D, self-organizing primitives that interact and move in an unbounded environment to create aggregated shapes. Each primitive is represented by a disk and a unit point mass. In order to compare the aggregated shape produced by the primitives to other shapes, the centers of mass of the two shapes must be aligned. We present an algorithm for calculating the center of mass (COM) for a set of point masses that are distributed in an unbounded 2D environment. The algorithm calculates the centroid for each coordinate component separately by forming two "orthogonal" tubes, calculating a center of mass in 3D for each tube and then projecting the 3D COM back onto the tubes, in order to produce the 2D COM of the points.