rotation_matrix¶
-
sknano.core.math.
rotation_matrix
(angle=None, axis=None, anchor_point=None, rot_point=None, from_vector=None, to_vector=None, degrees=False, verbose=False, **kwargs)[source] [edit on github][source]¶ Generate an \(n\times n\) rotation matrix.
New in version 0.3.0.
Parameters: - angle (float) – Rotation angle in radians. If
degrees
isTrue
,angle
will be converted to radians from degrees. The sense of the rotation is defined by the right hand rule: If your right-hand’s thumb points along theaxis
, then your fingers wrap around the axis in the positive sense of the rotation angle. - axis ({None, array_like, str}, optional) – An \(n\)-element array_like sequence defining the \(n\)
components of the rotation axis or the string
x
,y
, orz
representing the \(x, y, z\) axes of a Cartesian coordinate system in 3D with unit vectors \(\mathbf{v}_x=\mathbf{\hat{x}}\), \(\mathbf{v}_y=\mathbf{\hat{y}}\), and \(\mathbf{v}_z=\mathbf{\hat{z}}\), respectively. - anchor_point (
Point
, optional) – - rot_point (
Point
, optional) – - to_vector (from_vector,) –
- degrees (bool, optional) – If
True
, convertangle
from degrees to radians.
Returns: Rmat – If
axis
isNone
thenRmat
will be a \(2D\) rotation matrix \(R(\theta)\) that rotates \(2D\) vectors counterclockwise byangle
\(\theta\).If
axis
is notNone
thenRmat
will be a rotation matrix that gives a rotation around the direction of the vectoraxis
.Return type: - angle (float) – Rotation angle in radians. If