How to compute surface- and volume-based center of masses for 3D geometries

Hello

For (closed) 3D surface geometries with triangular mesh, I can think of three different types to compute the “center of mass”:

  1. point-based: center=sum(points)/len(points)
  2. surface-based: center=sum(tri_areas*tri_centers)/sum(areas)
  3. volume-based: center=sum(tetra_volumes*tetra_centers)/sum(volumes)

These three points are generally different. For the first one, I’d use vtkCenterOfMass. But is there a suitable filter to compute the other ones?


For those interested in the formulas:

  • tri_centers: centers of mass of mesh triangles: (p1+p2+p3)/3
  • tri_areas: areas of the mesh triangles
  • tetra_volumes: signed volumes of tetrahedrons consisting of the (oriented) mesh triangle (p1, p2, p3) and an arbitrarily chosen point x (typically the origin (0,0,0), for which the tetra-volumes can be computed as 1/6*det(p1,p2,p3) )
  • tetra_centers represent volumes and centers (p1+p2+p3+x)/4 for these tetrahetrdons
  • * represents elementwise multiplication

If you need center of mass then only method 3 is correct (you just need to change “areas” to “volumes”) and only if density of your material is uniform. If material is non-uniform then you need to do weighted sum of mass.

If you need just some approximate center of a shape then center of bounding box is often good enough and it is very fast to compute (especially because VTK caches bounding box information for each data object, so it is only computed once).

Center of surface cells (2) would only approximate center of gravity if you have a thin shell.

Center of surface points (1) is only related to center of gravity if you work with point clouds (if you have a mesh then a few points can define very large cells, causing huge errors).

Thanks. You’re correct regarding the use of the term “center of mass”. This is a bit misleading about the vtkCenterOfMass filter, which only operates on points. I was wondering if there was already an appropriate filter to achieve this very common task, but by now I think it’s not the case because I’ve also found other people asking for this.

Also thank you for pointing out the mistake, I’ve fixed the formula.

Computing the center of gravity in strict physical sense for meshes is actually not needed that often. It is more commonly needed for images and there are very good filters for that in ITK. They can handle both grayscale and labelmap images and can compute many other important metrics (principal axes, moments, oriented bounding box, etc.).