def _mat3_to_vec_roll(mat):
"""
Function to convert a 3x3 rotation matrix to a rotation axis and a roll angle along this axis
Python port of the C function defined in armature.c
Thanks to blenderartists.org user vida_vida
:param mat:
:return:
"""
from ..properties.globals import global_properties
vec = mat.col[1] * global_properties.bone_length.get(bpy.context.scene)
vecmat = _vec_roll_to_mat3(mat.col[1], 0)
vecmatinv = vecmat.inverted()
rollmat = vecmatinv * mat
roll = math.atan2(rollmat[0][2], rollmat[2][2])
return vec, roll
评论列表
文章目录