Transformations (qcip_tools.transformations
)
API documentation
Transformation (matrices) manipulation.
Constructed on top of transforms3d for the most part.
- class qcip_tools.transformations.ImmutableRotatable
- rotate_around_axis(axis, angle, is_normalized=False, in_degree=False)
Create a axis-angle rotation matrix
- Parameters:
axis (numpy.ndarray) – axis
angle (float) – rotation angle (in degree)
is_normalized (bool) – is the axis already normalized?
in_degree (bool) – is the angle in degree ?
- Return type:
- rotate_euler(psi, theta, chi, axes='sxyz', in_degree=False)
Rotate via Euler angle
- Parameters:
psi (float) – first rotation angle
theta (float) – second rotation angle
chi (float) – third rotation angle
axes (str) – axes
in_degree (bool) – is the angle in degree ?
- Return type:
- class qcip_tools.transformations.ImmutableScalable
- scale(x, y, z)
Create a translation matrix
- Parameters:
x (float) – scale x
y – scale y
y – float
z (float) – scale z
- Return type:
- scale_uniform(factor)
Scale by a given factor
- Parameters:
factor (float) – scale x
- Return type:
- class qcip_tools.transformations.ImmutableTransformable
Transformation for non-mutable objects
- class qcip_tools.transformations.ImmutableTranslatable
Translatable objects
- translate(x, y, z)
Translate object
- Parameters:
x (float) – translation x
y – translation y
y – float
z (float) – translation z:
- Return type:
- class qcip_tools.transformations.MutableRotatable
- rotate_around_axis_self(axis, angle, is_normalized=False, in_degree=False)
Create a axis-angle rotation matrix
- Parameters:
axis (numpy.ndarray) – axis
angle (float) – rotation angle (in degree)
is_normalized (bool) – is the axis already normalized?
in_degree (bool) – is the angle in degree ?
- rotate_euler_self(psi, theta, chi, axes='sxyz', in_degree=False)
Rotate via Euler angle
- Parameters:
psi (float) – first rotation angle
theta (float) – second rotation angle
chi (float) – third rotation angle
axes (str) – axes
in_degree (bool) – is the angle in degree ?
- class qcip_tools.transformations.MutableScalable
- scale_self(x, y, z)
Create a translation matrix
- Parameters:
x (float) – scale x
y – scale y
y – float
z (float) – scale z
- scale_uniform_self(factor)
Scale by a given factor
- Parameters:
factor (float) – scale x
- class qcip_tools.transformations.MutableTransformable
Transformation for mutable objects
- class qcip_tools.transformations.MutableTranslatable
Translatable objects
- translate_self(x, y, z)
Translate object
- Parameters:
x (float) – translation x
y – translation y
y – float
z (float) – translation z:
- class qcip_tools.transformations.TransformationMatrix
4x4 matrix to represent a transformation
- static identity()
Create identity 4x4 matrix
- Return type:
numpy.ndarray
- static rotate_around_axis(axis, angle, is_normalized=False, in_degree=False)
Create a axis-angle rotation matrix
- Parameters:
axis (numpy.ndarray) – axis
angle (float) – rotation angle (in degree)
is_normalized (bool) – is the axis already normalized?
in_degree (bool) – is the angle in degree ?
- Return type:
numpy.ndarray
- static rotate_euler(psi, theta, chi, axes='sxyz', in_degree=False)
Rotate via Euler angle
- Parameters:
psi (float) – first rotation angle
theta (float) – second rotation angle
chi (float) – third rotation angle
axes (str) – axes
in_degree (bool) – is the angle in degree ?
- Return type:
numpy.ndarray
- static rotate_matrix(tensor, rotation_matrix)
Return a rotated tensor
Warning
To much magic here, will be deprecated at some point.
- Parameters:
tensor (numpy.ndarray) – the tensor to be rotated
psi (float) – Rotation around the Z axis (in degree)
theta (float) – rotation around the y’ axis (in degree)
chi (float) – Rotation around the z’’ axis (in degree)
- Return type:
numpy.ndarray
- static rotation_matrix_from_vectors(vec1, vec2)
Find the rotation matrix that aligns vec1 to vec2 :param vec1: A 3d “source” vector :param vec2: A 3d “destination” vector :return mat: A transform matrix (3x3) which when applied to vec1, aligns it with vec2.
- static scale(x, y, z)
Create a translation matrix
- Parameters:
x (float) – scale x
y – scale y
y – float
z (float) – scale z
- Return type:
numpy.ndarray
- static scale_uniform(factor)
Scale by a given factor
- Parameters:
factor (float) – scale x
- Return type:
numpy.ndarray
- static translate(x, y, z)
Create a translation matrix
- Parameters:
x (float) – translation x
y – translation y
y – float
z (float) – translation z:
- Return type:
numpy.ndarray