Hi all.
I have a problem with computing three local axes x, y and z for OBB (oriented bounding box) in my aplication.

OBB is given with:

struct OBB {
Point c; // OBB center point
Vector u[3]; // Local x-, y-, and z-axes
Vector e; // Positive halfwidth extents of OBB along each axis
};

Vector c changes with moving, vector e has constant values, and vectors u[3] changes with rotaton. I need to calculate, and update in every step values u[0].x, u[0].y, u[0].z,
u[1].x, u[1].y … ,

Suggestion: Keep a world-to-object (or parent-space-to-object) transform matrix with the OBB. Then when the object moves (world-to-obj changes), you just update the transform and leave the rest of the OBB definition alone…

…which by the way gets very, very simple. Since your transform drops you into object space, where the box is aligned with the coordinate axes, and has one corner on the origin, all you need to store besides the world-to-obj transform is the axis length vectors of the box.

As an potential optimization, you may also choose to store the inverse of the world-to-obj transform as well, if you find it would save you time, versus doing a fast inverse to get it everytime you need it. But that’s just a (potential) optimization.