glotzerlab / coxeter

Collection of tools to help initialize and manipulate shapes.
https://coxeter.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
22 stars 5 forks source link

"center" should mean Centroid (Center of Mass for shapes with uniform density) #129

Closed bdice closed 3 years ago

bdice commented 4 years ago

Currently the polyhedron.center property appears to be defined as an average of the vertices. However, this does not always coincide with the shape's center of mass: https://bell0bytes.eu/centroid-convex/

https://github.com/glotzerlab/coxeter/blob/0b02755cb0cf9550f1ed3a94b5c9eeed21d25830/coxeter/shapes/polyhedron.py#L474-L477

I recommend the following:

[1] I note that Wikipedia says the center of mass, centroid, and barycenter are synonymous for shapes of uniform density:

While in geometry the word barycenter is a synonym for centroid, in astrophysics and astronomy, the barycenter is the center of mass of two or more bodies that orbit each other. In physics, the center of mass is the arithmetic mean of all points weighted by the local density or specific weight. If a physical object has uniform density, its center of mass is the same as the centroid of its shape.

vyasr commented 4 years ago

Here are my thoughts

bdice commented 4 years ago

If we correctly calculate the center of mass, it should look similar (as an integral) to the inertia tensor computation. The inertia tensor currently isn't implemented for spheroshapes, meaning that we likely don't have a simple method to compute the center of mass, either. Here is a potential reference for computing these quantities for spheropolygons: https://journals.aps.org/pre/abstract/10.1103/PhysRevE.82.056713