Hi,
I get some weird results when using RegionCentroid[]
and MomentOfInertia[]
to calculate center of mass and inertial tensor of a polyhedron.
First, I create a simple tetrahedron and calculate its properties:
tetra = Tetrahedron[{{0, 0, 0}, {5, 0, 0}, {0, 4, 0}, {0, 0, 3}}]
N[RegionCentroid[tetra] ]
N[MomentOfInertia[tetra]]
and the results are correct:
{1.25, 1., 0.75}
{{9.375, 2.5, 1.875}, {2.5, 12.75, 1.5}, {1.875, 1.5, 15.375}}
But if I mesh a Tetrahedron using MeshRegion
:
tetramesh = MeshRegion[{{0, 0, 0}, {5, 0, 0}, {0, 4, 0}, {0, 0, 3}}, Polygon[{{1, 3, 2}, {1, 2, 4}, {2, 3, 4}, {1, 4, 3}}]];
N[RegionCentroid[tetramesh] ]
N[MomentOfInertia[tetramesh]]
The results are totally wrong:
{1.39904, 1.06571, 0.732373}
{{58.2105, 15.9348, 11.5785}, {15.9348, 78.5599, 9.29808}, {11.5785, 9.29808, 94.7576}}
I also tries another mesh method:
tetramesh2 = MeshRegion[{{0, 0, 0}, {5, 0, 0}, {0, 4, 0}, {0, 0, 3}}, Tetrahedron[{1, 2, 3, 4}]];
N[RegionCentroid[tetramesh2]]
N[MomentOfInertia[tetramesh2]]
And this time, center of mass is correct while inertial tensor is wrong:
{1.25, 1., 0.75}
{{9.06636, 2.31481, 1.73611}, {2.31481, 12.3302, 1.38889}, {1.73611, 1.38889, 14.8688}}
I don't know why there outputs are totally different.
And I want to use Mathematica to calculate the center of mass and inertial tensor of any polyhedrons (import .obj file). But after I try this, I wonder if I can get the right answer.
Please help.