# why does the MomentOfInertia behave differently for ConvexHullMesh and ConvexHullRegion

I have a list of points of a convex polyhedron for which I need to compute the eigenvectors of the Moment of Inertia matrix. But, it seems like the built-in MomentOfInertia behave very differently for ConvexHullMesh and ConvexHullRegion

pts3 = {{0.90000000000000002228., 0.45000000000000001118., 0.58.}, {0.67500000000000004448., 0.83971143170299744628., 0.58.}, {0.22500000000000000568., 0.83971143170299744628., 0.58.}, {0, 0.45000000000000001118., 0.58.}, {0.22500000000000000568., 0.0602885682970022438., 0.58.}, {0.67500000000000004448., 0.0602885682970022438., 0.58.}, {0.90000000000000002228., 0.45000000000000001118., 0.18.}, {0.67500000000000004448., 0.0602885682970022438., 0.18.}, {0.22500000000000000568., 0.0602885682970022438., 0.18.}, {0, 0.45000000000000001118.,0.18.}, {0.22500000000000000568., 0.83971143170299744628., 0.18.}, {0.67500000000000004448., 0.83971143170299744628., 0.18.}};

(*plotting function*)
plt[region_, eigvec_, cent_] := Show[region,Graphics3D[{{Green, Thick, InfiniteLine[cent, #] &/@ eigvec},
{Opacity[0.4], Red, Hyperplane[#, cent] & /@ eigvec}}, ImageSize -> Small]]

(*using convexhullmesh *)
reg1 = ConvexHullMesh[pts3];
cent1 = RegionCentroid@reg1;
{eigval1, eigvec1} = Eigensystem@MomentOfInertia@reg1;

plt[reg1, eigvec1, cent1]


(*using convexhullregion*)
reg2 = ConvexHullRegion[pts3];
cent2 = RegionCentroid@reg2;
{eigval2, eigvec2} = Eigensystem@MomentOfInertia@reg2;

plt[Region@reg2, eigvec2, cent2]


Observe the orientation of the cutting planes; they look very different for the two cases. I think I can use DiscretizeRegion@ConvexHullMesh[pts3] to make the cutting planes in the first case to look like the latter. However, I am confused as to why MomentOfInertia is behaving differently in the two cases? Is this a bug?

• MMA version 12.3.0 I get twice the same symmetric picture. Commented Dec 7, 2021 at 14:43
• @DanielHuber I am using Mathematica 12.3.1 for Microsoft Window (64-Bit) (June 19,2021) Commented Dec 7, 2021 at 14:44
• @AliHashmi Yes ConvexHullRegion was introduced with v12.2. I only recognized that Show[reg2] doesn't work, I changed it to Show[Region[reg2]] : Commented Dec 7, 2021 at 16:19
• It's not an artefact I think: The body has more than 3 symmtry axes, concerning the inertia that means complete rotational symmetry. Every pair of eigenvectors might be arbitrarily rotated! Commented Dec 7, 2021 at 21:23
• @UlrichNeumann's answer seems like the correct one. But if you are looking for a more 'natural' looking eigen system, you can turn your almost regular extruded hexagon into a regular and exact hexagon through RootApproximant[N[pts3]]. Commented Dec 8, 2021 at 12:48

It's not an artefact, Mathematica result is ok for both cases!

The hexagon plane (perpendicular to {0,0,1} ) has six axes of symmetry. That means, concerning the inertia , the body is rotationally symmetrical!

J1 = MomentOfInertia@reg1;
{eigval1, eigvec1} = Eigensystem@J1;

J2 = MomentOfInertia@reg2;
{eigval2, eigvec2} = Eigensystem@J2;


The second and third eigenvalues are identical, which confirms mentioned rotational symmetry of the two regions

That's why rotation of the eigenvectors around {0,0,1} gives a new set of equivalent eigenvectors

rot1 = RotationMatrix[\[CurlyPhi], eigvec1[[1]]] // Chop;
ev1rot = eigvec1 . rm // Chop; (* new eigenvectors*)
(J1 . Transpose[#] - Transpose[#] . DiagonalMatrix[eigval1]) &[ev1rot] // Chop;
(*{{0, 0, 0}, {0, 0, 0}, {0, 0, 0}}*)


Same is true for reg2.

That's why the different appearing eigenvectors eigvec1, eigvec2 fullfill the eigensystem of both regions:

(J2 . Transpose[#] - Transpose[#] . DiagonalMatrix[eigval1]) &[eigvec1] // Chop
(*{{0, 0, 0}, {0, 0, 0}, {0, 0, 0}}*)

(J1 . Transpose[#] - Transpose[#] . DiagonalMatrix[eigval1]) &[eigvec2] // Chop
(*{{0, 0, 0}, {0, 0, 0}, {0, 0, 0}}*)

• I understand your point. However, should not the eigensystem output the same result for convexhullmesh and convexhullregion, unless of course the two represent very different underlying objects? Commented Dec 8, 2021 at 12:50
• I don't think so. convexhullmeshand convexhullregion don't know from each other. Both return a correct eigensystem, unfortunately the eigenvectors are different in this case Commented Dec 8, 2021 at 13:22

A workaround is to threshold values near zero in the inertia matrix.

principleVectors[reg_] := Eigensystem[Threshold[MomentOfInertia[reg]]]

Max[Abs[principleVectors[reg1] - principleVectors[reg2]]]

3.81639*10^-17

• thanks. makes sense now. I think it is the small values of the off-diagonal entries that is making Eigensystem return different values. Btw, if you use reg1 = DiscretizeRegion@ConvexHullMesh[pts3] and reg2 = DiscretizeRegion@BoundaryMeshRegion@ConvexHullRegion[pts3]  the off-diagonal entries of the matrix are significantly large and therefore Eigensystem returns approx the same eigenvectors Commented Dec 8, 2021 at 9:16