In a forgoing post
https://community.wolfram.com/groups/-/m/t/2332921
the moment of inertia of a triangle in R2 rotating around a point was calculated.
Here a method is given to do this in R3, the triangle rotating around an axis thru x4 and with direction b
(* square of distance of a point p to an axis thru x and direction b *)
Clear[dist]
dist2[p_, x_, b_] := Module[{aa, fL, vB},
aa = p - x;
fL = b.aa/(b.b);
vB = p - x - b fL;
vB.vB]
(* Moment of Inertia of a triangle given by x1, x2, x3 with respect to axis thru x4 and direction b *)
Clear[fMI]
fMI[x1_, x2_, x3_, x4_, b_] := Module[{d2, d3, fe},
d2 = x2 - x1;
d3 = x3 - x1;
fe = Cross[d2, d3];
fe = Sqrt[fe.fe]; (*surface-element of Triangle*)
Integrate[ fe dist2[x1 + u d2 + v d3, x4, b], {v, 0, 1}, {u, 0, 1 - v}]
]
Check with the result of forgoing post
fMI[{4, 1, 0}, {1, 3, 0}, {2, 7, 0}, {.5, 5, 9}, {0, 0, 3}]