transformation_matrix¶
-
sknano.core.math.
transformation_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+1)×(n+1) transformation matrix for an affine transformation in n dimensions.
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 vx=ˆx, vy=ˆy, and vz=ˆz, respectively. - anchor_point ({None, array_like}, optional) –
An n-element list or ndarray or
Point
defining the origin of the rotation axis.If
anchor_point
is notNone
andaxis
is aVector
instance, then the origin of the vector defined byVector.p0
will be changed toanchor_point
.If
anchor_point
isNone
, then it defaults to an n-element array of zeros. - degrees (bool, optional) – If
True
, convertangle
from degrees to radians.
Returns: Tmat – n+1×n+1 transformation matrix for an affine transform in n dimensions.
If
axis
isNone
andanchor_point
isNone
, thenTmat
will be a 2D rotation matrix R(θ) that rotates 2D vectors counterclockwise byangle
θ.If
axis
isNone
andanchor_point
is a 2-element sequence, thenRmat
will be a 2D rotation matrix R(θ) about the 2DPoint
anchor_point
byangle
θ.If
axis
is notNone
andanchor_point
isNone
, thenRmat
will be a rotation matrix that gives a rotation around the direction of the vectoraxis
.Return type: ndarray
Notes
- angle (float) – Rotation angle in radians. If