trimesh
trimesh copied to clipboard
transform_inertia: add translation contribution
Hi, I'm working on a design project and I need to compute the inertia tensor of some meshes, but not w.r.t. their center of mass (CoM), with respect to a different frame, with the origin not overlapped with the CoM.
Given a mesh, seems to me that the property moment_inertia is the inertia tensor computed w.r.t. a frame with the axes aligned with the global frame and the origin in the CoM of the mesh, right?
The method transform_inertia only project the inertia matrix in a new frame. Would be very useful to write a method that computes the inertia matrix w.r.t an arbitrary origin applying the parallel axis theorem.
I'd be glad to contribute to this improvement if you think it is worthwhile and you are not already working on it.
Regards DC
That would be awesome, PR's welcome! Yeah as you mentioned transform_inertia just applies the rotation.
With the inertia stuff my main concern is with tests given that my intuitive understanding isn't great haha. A few undergrad-textbook-examples as unit tests and simple sanity checks would be really nice.
Ok great! I implemented an example to translate it, now I have to organize everything in a simple function and, as you said, find an example to validate the method. I'll do a PR as soon as I have time to work more on it.