/// <summary> /// Transforms the bounding box into the space given by orientation and position. /// </summary> /// <param name="position"></param> /// <param name="orientation"></param> /// <param name="result"></param> internal void InverseTransform(ref FPVector position, ref FPMatrix orientation) { FPVector.Subtract(ref max, ref position, out max); FPVector.Subtract(ref min, ref position, out min); FPVector center; FPVector.Add(ref max, ref min, out center); center.x *= FP.Half; center.y *= FP.Half; center.z *= FP.Half; FPVector halfExtents; FPVector.Subtract(ref max, ref min, out halfExtents); halfExtents.x *= FP.Half; halfExtents.y *= FP.Half; halfExtents.z *= FP.Half; FPVector.TransposedTransform(ref center, ref orientation, out center); FPMatrix abs; FPMath.Absolute(ref orientation, out abs); FPVector.TransposedTransform(ref halfExtents, ref abs, out halfExtents); FPVector.Add(ref center, ref halfExtents, out max); FPVector.Subtract(ref center, ref halfExtents, out min); }