source/dcm_transform.py
def matrix_set_rotation(matrix, xrot, yrot, zrot):
    """Set a rotation into the input matrix from 3 angles in degrees"""
    cos_x = math.cos(to_radians(xrot))
    sin_x = math.sin(to_radians(xrot))
    cos_y = math.cos(to_radians(yrot))
    sin_y = math.sin(to_radians(yrot))
    cos_z = math.cos(to_radians(zrot))
    sin_z = math.sin(to_radians(zrot))

    matrix[0][0] = cos_y * cos_z
    matrix[0][1] = (sin_x * sin_y * cos_z) - (cos_x * sin_z)
    matrix[0][2] = (cos_x * sin_y * cos_z) + (sin_x * sin_z)
    matrix[1][0] = cos_y * sin_z
    matrix[1][1] = (sin_x * sin_y * sin_z) + (cos_x * cos_z)
    matrix[1][2] = (cos_x * sin_y * sin_z) - (sin_x * cos_z)
    matrix[2][0] = -sin_y
    matrix[2][1] = sin_x * cos_y
    matrix[2][2] = cos_x * cos_y

    return matrix
Set a rotation into the input matrix from 3 angles in degrees
Set a rotation into the input matrix from 3 angles in degrees
Set a rotation into the input matrix from 3 angles in degrees
def matrix_set_rotation(matrix, xrot, yrot, zrot):
    cos_x = math.cos(to_radians(xrot))
    sin_x = math.sin(to_radians(xrot))
    cos_y = math.cos(to_radians(yrot))
    sin_y = math.sin(to_radians(yrot))
    cos_z = math.cos(to_radians(zrot))
    sin_z = math.sin(to_radians(zrot))
    matrix[0][0] = cos_y * cos_z
    matrix[0][1] = (sin_x * sin_y * cos_z) - (cos_x * sin_z)
    matrix[0][2] = (cos_x * sin_y * cos_z) + (sin_x * sin_z)
    matrix[1][0] = cos_y * sin_z
    matrix[1][1] = (sin_x * sin_y * sin_z) + (cos_x * cos_z)
    matrix[1][2] = (cos_x * sin_y * sin_z) - (sin_x * cos_z)
    matrix[2][0] = -sin_y
    matrix[2][1] = sin_x * cos_y
    matrix[2][2] = cos_x * cos_y
    return matrix
def matrix_set_rotation ( matrix , xrot , yrot , zrot ) : cos_x = math . cos ( to_radians ( xrot ) ) sin_x = math . sin ( to_radians ( xrot ) ) cos_y = math . cos ( to_radians ( yrot ) ) sin_y = math . sin ( to_radians ( yrot ) ) cos_z = math . cos ( to_radians ( zrot ) ) sin_z = math . sin ( to_radians ( zrot ) ) matrix [ 0 ] [ 0 ] = cos_y * cos_z matrix [ 0 ] [ 1 ] = ( sin_x * sin_y * cos_z ) - ( cos_x * sin_z ) matrix [ 0 ] [ 2 ] = ( cos_x * sin_y * cos_z ) + ( sin_x * sin_z ) matrix [ 1 ] [ 0 ] = cos_y * sin_z matrix [ 1 ] [ 1 ] = ( sin_x * sin_y * sin_z ) + ( cos_x * cos_z ) matrix [ 1 ] [ 2 ] = ( cos_x * sin_y * sin_z ) - ( sin_x * cos_z ) matrix [ 2 ] [ 0 ] = - sin_y matrix [ 2 ] [ 1 ] = sin_x * cos_y matrix [ 2 ] [ 2 ] = cos_x * cos_y return matrix
Set a rotation into the input matrix from 3 angles in degrees
Set a rotation into the input matrix from 3 angles in degrees
"""Set a rotation into the input matrix from 3 angles in degrees"""
matrix
xrot
yrot
zrot