rotation.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:blmath 作者: bodylabs 项目源码 文件源码
def euler(xyz, order='xyz', units='deg'):
    if not hasattr(xyz, '__iter__'):
        xyz = [xyz]
    if units == 'deg':
        xyz = np.radians(xyz)
    r = np.eye(3)
    for theta, axis in zip(xyz, order):
        c = np.cos(theta)
        s = np.sin(theta)
        if axis == 'x':
            r = np.dot(np.array([[1, 0, 0], [0, c, -s], [0, s, c]]), r)
        if axis == 'y':
            r = np.dot(np.array([[c, 0, s], [0, 1, 0], [-s, 0, c]]), r)
        if axis == 'z':
            r = np.dot(np.array([[c, -s, 0], [s, c, 0], [0, 0, 1]]), r)
    return r
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号