The Rotate
method of the BBox
struct is used to rotate the bounding box by a specified rotation. This method modifies the bounding box to reflect the new orientation after applying the given rotation.
The Rotate
method of the BBox
struct is used to rotate the bounding box by a specified rotation. This method modifies the bounding box to reflect the new orientation after applying the given rotation.
To use the Rotate
method, you need to have an instance of BBox
and a Rotation
object that specifies the desired rotation. The method will return a new BBox
that represents the rotated bounding box.
// Create a BBox instance BBox boundingBox = new BBox(new Vector3(-1, -1, -1), new Vector3(1, 1, 1)); // Define a rotation Rotation rotation = Rotation.FromAxis(Vector3.Up, 45); // Rotate 45 degrees around the Y-axis // Rotate the bounding box BBox rotatedBox = boundingBox.Rotate(ref rotation); // Use the rotated bounding box Vector3 newCenter = rotatedBox.Center; System.Console.WriteLine($"New Center: {newCenter}");