blenderのaddonである Export-Paper-Model-from-Blender において fitting_matrix()として回転行列が実装されていたので、振り返り。(メモ)
Export-Paper-Model-from-Blender の unfolder.py で実装されている fitting_matrix(v1, v2)
def fitting_matrix(v1, v2): """Get a matrix that rotates v1 to the same direction as v2""" return (1 / v1.length_squared) * M.Matrix(( (v1.x*v2.x + v1.y*v2.y, v1.y*v2.x - v1.x*v2.y), (v1.x*v2.y - v1.y*v2.x, v1.x*v2.x + v1.y*v2.y)))
回転行列振り返り
まず、回転行列とは以下
上記ある cosθ、sinθ は、内積や外積から導入できますが、 その内積や外積の定義は以下の通りです
or