static Matrix CreateRotation( Rotation rot )
static Matrix CreateRotation( Vector3 angles )

book_4_sparkGenerated
code_blocksInput

Description

The Matrix.CreateRotation method creates a rotation matrix from a given Rotation object. This method is useful for transforming objects in 3D space by applying a rotation defined by the Rotation parameter.

Usage

To use the CreateRotation method, pass a Rotation object that defines the desired rotation. The method will return a Matrix that represents this rotation, which can then be used to transform other objects or combine with other transformations.

Example

// Example of using Matrix.CreateRotation
Rotation rotation = new Rotation(0, 90, 0); // Define a rotation of 90 degrees around the Y-axis
Matrix rotationMatrix = Matrix.CreateRotation(rotation);

// Use the rotationMatrix to transform a vector or another matrix
Vector3 transformedVector = rotationMatrix.Transform(new Vector3(1, 0, 0));
// transformedVector will now be (0, 0, -1) after the rotation