Skip to contents

Generates a 3x3 rotation matrix for rotating points in 3D space around the x, y, or z axis by a specified angle in degrees.

Usage

create_rotation_matrix(angle_deg, axis)

Arguments

angle_deg

Numeric. The rotation angle in degrees.

axis

Character. The axis of rotation: "x", "y", or "z".

Value

A 3x3 numeric matrix representing the rotation.

Examples

create_rotation_matrix(90, "z")
#>              [,1]          [,2] [,3]
#> [1,] 6.123032e-17 -1.000000e+00    0
#> [2,] 1.000000e+00  6.123032e-17    0
#> [3,] 0.000000e+00  0.000000e+00    1