create_rotation_matrix_from_vector: Convert Rotation Vector to Rotation Matrix

View source: R/create_rotation_matrix_from_vector.r

create_rotation_matrix_from_vectorR Documentation

Convert Rotation Vector to Rotation Matrix

Description

Converts a 3-element rotation vector (axis-angle representation) into a 3x3 rotation matrix, using Rodrigues' rotation formula. Equivalent to Python's scipy.spatial.transform.Rotation.from_rotvec.

Usage

create_rotation_matrix_from_vector(theta3, in_degrees = FALSE)

Arguments

theta3

A numeric vector of length 3, representing the rotation vector. Its direction specifies the axis of rotation, and its magnitude specifies the angle (in radians by default).

in_degrees

Logical. If TRUE, the elements of theta3 are interpreted as degrees and converted to radians internally. Default is FALSE.

Value

A 3x3 numeric matrix representing the rotation.

References

https://en.wikipedia.org/wiki/Axis-angle_representation#Rotation_vector https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.transform.Rotation.from_rotvec.html

Examples

create_rotation_matrix_from_vector(c(0.5, 0.4, 0.3))
create_rotation_matrix_from_vector(c(30, 0, 0), in_degrees = TRUE)


Kneerav/biomechanics documentation built on July 16, 2025, 4:51 p.m.