Solution (source code)

= Solution

Write $r=(x_1,x_2,x_3)^T$ for position relative to the <centroid>. The <inertia tensor> there is
$$
\boxed{(J_G)_{ij}=\int_A\rho\bigl(|r|^2\delta_{ij}-x_ix_j\bigr)\,dV.}
$$
In particular its diagonal entries integrate the squares of distances from the corresponding axes, and its off-diagonal entries are the negative products of coordinates.

Insert $\mathbf v_Q=\mathbf v_G+\boldsymbol\omega\times r$ into $T=\tfrac12\int_A\rho|\mathbf v_Q|^2\,dV$. The cross term vanishes because $\int_A\rho r\,dV=0$. Using $|\boldsymbol\omega\times r|^2=|\boldsymbol\omega|^2|r|^2-(\boldsymbol\omega\cdot r)^2$ gives
$$
\boxed{T=\frac12m|\mathbf v_G|^2+\frac12\boldsymbol\omega^TJ_G\boldsymbol\omega.}
$$
If $a$ is the <vector> from $G$ to $O$, positions relative to $O$ are $r-a$. Expanding the defining tensor <integral> with this <substitution> again removes the terms <linear> in $r$. Thus the tensor <parallel axis theorem> is
$$
\boxed{J_O=J_G+m\bigl(|a|^2I-aa^T\bigr),\quad (J_O)_{ij}=(J_G)_{ij}+m(|a|^2\delta_{ij}-a_ia_j).}
$$
Since $O$ is fixed, $\mathbf v_G=\boldsymbol\omega\times(-a)$, so $m|\mathbf v_G|^2=m\boldsymbol\omega^T(|a|^2I-aa^T)\boldsymbol\omega$. <Substitution> into the <energy> decomposition yields
$$
\boxed{T=\frac12\boldsymbol\omega^TJ_O\boldsymbol\omega.}
$$