# Moment of Inertia for Hexahedron region

I've been going crazy about a problem that I think it has no solution, since I found nothing on the Internet about it.

I would like to compute the tensor of inertia of a region. The region is the following:

coordinates = {{6.31, 4, 4.84}, {8.01, 2, 2.87}, {14.7, 7,
4.31}, {13.03, 9, 6.31}, {10, 4, 8}, {14, 2, 8}, {19, 7, 8}, {15,
9, 8}};
reg = Region[Hexahedron[coordinates]];


So it basically is a kind of distorted hexahedron.

I have no problem on obtaining its volume via:

Volume[reg]


or using:

RegionMoment[reg, {0, 0, 0}]


But I cannot compute any other geometrical property for this region. Nor using the specific command:

MomentOfInertia[reg]


Neither with:

RegionMoment[reg,{x1,x2,x3}]


In which "x1,x2,x3" is any number not equal to zero.

Is there a way to compute this inertia tensor or it is just impossible using the region?

• Welcome to Mathematica StackExchange! The problem is in your coordinates because your points that are supposed to form a face are not coplanar. For example, the first four points that make one face: CoplanarPoints[coordinates[[1 ;; 4]]] gives False. You cannot form a planar face of a polyhedron with vertices that do not lie on the same plane. Fix your coordinates, then everything should work as expected :) You can also see an error if you try discretizing your hexahedron: DiscretizeRegion[reg]. Jun 8, 2023 at 16:18
• Try: MomentOfInertia[ConvexHullRegion@reg] where reg = Hexahedron[coordinates];
– Syed
Jun 8, 2023 at 16:24
• Or even more directly MomentOfInertia[ConvexHullRegion@coordinates] Jun 8, 2023 at 16:26
• @Domen: What's kind of surprising is that Volume and RegionMoment give a result when applied to reg, even though they should have the same kind of ambiguity due to the points being non-planar. Jun 8, 2023 at 17:28

• We note that in Mathematica,the moment of inertia matrix respect to the center of the region instead of origin {0,0,0}.
Clear[reg];
reg = ConvexHullRegion[coordinates];
centroid = RegionCentroid[reg];
result1 =
Integrate[{{y^2 + z^2, -x*y, -x*z}, {-y*x,
x^2 + z^2, -y*z}, {-z*x, -z*y, x^2 + y^2}} /.
Thread[{x, y, z} -> {x, y, z} - centroid], {x, y, z} ∈
reg]


• Same as MomentOfInertia.
MomentOfInertia[reg]


For the region:

coordinates = {{6.31, 4, 4.84}, {8.01, 2, 2.87}, {14.7, 7,
4.31}, {13.03, 9, 6.31}, {10, 4, 8}, {14, 2, 8}, {19, 7, 8}, {15,
9, 8}};
reg = Region[Hexahedron[coordinates]];


The tensor of inertia is, for a constant mass density of 1, by definition:

r={x,y,z}
Integrate[r.r IdentityMatrix[3] - Outer[Times, r, r], {x, y, z} \[Element] reg]

{{7135.49, -6870.52, -8078.25}, {-6870.52,
20480.5, -3380.59}, {-8078.25, -3380.59, 19432.5}}


If the mass density: rho is different from 1, we have to multiply the above by rho. If rho is a function of x,y,z, we have to bring rho inside the integral.

One approach is to use exact arithmetic.

coordinates = {{6.31, 4, 4.84}, {8.01, 2, 2.87}, {14.7, 7,
4.31}, {13.03, 9, 6.31}, {10, 4, 8}, {14, 2, 8}, {19, 7, 8}, {15,
9, 8}};
reg = Region[Hexahedron[Rationalize[coordinates]]];

N[MomentOfInertia[reg]]

{{365.489, -199.579, -143.502},
{-199.579, 640.881, -45.8962}, {-143.502, -45.8962, 755.691}}


The call to RegionMoment at {x1, x2, x3} seems to hang with this approach though.