Vector3 RotateAround( Vector3& center, Rotation& rot )

book_4_sparkGenerated
code_blocksInput

Description

The RotateAround method rotates the current Vector3 instance around a specified center point by a given rotation. This method is useful for rotating a point in 3D space around another point, which is a common operation in graphics and physics simulations.

Usage

To use the RotateAround method, you need to provide a reference to a Vector3 representing the center of rotation and a Rotation object that defines the rotation to be applied. The method returns a new Vector3 that represents the position of the original vector after the rotation.

Example

Vector3 point = new Vector3(1, 0, 0);
Vector3 center = new Vector3(0, 0, 0);
Rotation rotation = Rotation.FromAxis(Vector3.Up, 90);

Vector3 rotatedPoint = point.RotateAround(ref center, ref rotation);
// rotatedPoint is now approximately (0, 0, 1)