Skip to content

Comment on Finding the World's Economic Center of Gravityparent

Comments

Maybe project the x/y coordinates onto a unit sphere, then find the center of mass in spherical coordinates, then convert those spherical coordinates to the relevant 2d coordinate system you're using, discarding the radius (but keeping it for the information it provides).

See also: https://en.wikipedia.org/wiki/Directional_statistics

That's exactly how it's done, for what it worth (though you use 3D cartesian coordinates instead of spherical coordinates).

Treat each point on the sphere as a 3D unit vector, weight as appropriate, and the center of mass is the sum of all of the vectors.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.