There were actually two issues here:
1. The dimension reported for armatures were often wildly incorrect,
including negative values and zero!
2. The dimensions reported for objects are supposed to be invariant with
rotation, representing the dimensions along the object's local axes.
However, armature objects' reported dimensions changed with rotation.
The respective causes were:
1. `BKE_armature_min_max()` was using an incorrect formula (acknowledged
in a comment) for transforming the bounding box between spaces. This
worked fine for some of the places that `BKE_armature_min_max()` was
called, since they just reverse the transform using the same(!)
erroneous formula, but it didn't work for others.
2. `BKE_armature_min_max()` first computed the bounds in world space,
and then transformed them into object space, rather than computing
them in object space directly like the respective functions for other
object types. Even when done correctly, this causes the reported
dimension to vary with rotation.
This PR fixes these issues by simply computing the armature bounding box
in object space directly instead.
There is one place in the code base that was directly using the
world-space bounds: `view3d_calc_minmax_selected()`. However, for every
object type other than armatures, it takes the object-space bounds and
transforms them (with an incorrect formula!) to world space. So this PR
also changes `view3d_calc_minmax_selected()`'s armature code to do the
same, except with a correct formula.
Note that the reason for using the correct transform formula (departing
from other object types) is that the world-space bounds for armatures
were already correct prior to this PR due to being computed in that
space. Therefore using the incorrect formula has the potential to
introduce regressions in this case.
Pull Request: https://projects.blender.org/blender/blender/pulls/137961