In my code, I have a hierarchy of components and to postprocess some operation I need a way to get a bounding box local to the parent.
In my most simple case, the parent component is empty and incluse a cube (which is another component). If I rotate the parent, without ever touching the cube, the cube bounding box stay aligned with the world axis.
Is there any way to get the bounding box which uses the axis of the parent ?
Here is the code, I used to check the behavior, here the parent is simply rotated 45° from the origin.
(0..7).map{ |i| cube.bounds.corner(i)}
[Point3d(-0.707107, -0.707107, -0.5), Point3d(0.707107, -0.707107, -0.5), Point3d(-0.707107, 0.707107, -0.5), Point3d(0.707107, 0.707107, -0.5), Point3d(-0.707107, -0.707107, 0.5), Point3d(0.707107, -0.707107, 0.5), Point3d(-0.707107, 0.707107, 0.5), Point3d(0.707107, 0.707107, 0.5)]
Here, for the unit cube, the x & y bounds should be either -0.5 or 0.5.