You won’t believe it but thats actually a very hard problem to solve algorithmically.
If you want to search further, it is called the “containment under free rotation” problem.
Edit:
There is a tool called trimesh that lets you load in meshes, compute convex hulls, and compute oriented minimum bounding boxes. https://trimesh.org/quick_start.html search for “bounding box” on that page.
You won’t believe it but thats actually a very hard problem to solve algorithmically.
If you want to search further, it is called the “containment under free rotation” problem.
Edit:
There is a tool called
trimesh
that lets you load in meshes, compute convex hulls, and compute oriented minimum bounding boxes. https://trimesh.org/quick_start.html search for “bounding box” on that page.