mesh_carver.py 文件源码

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

项目:bpy_lambda 作者: bcongdon 项目源码 文件源码
def RBenVe(Object, Dir):
    ObjectV = Object.normalized()
    DirV = Dir.normalized()
    cosTheta = ObjectV.dot(DirV)
    rotationAxis = mathutils.Vector((0.0, 0.0, 0.0))
    if (cosTheta < -1 + 0.001):
        v = mathutils.Vector((0.0, 1.0, 0.0))
        rotationAxis = ObjectV.cross(v)
        rotationAxis = rotationAxis.normalized()
        q = mathutils.Quaternion()
        q.w = 0.0
        q.x = rotationAxis.x
        q.y = rotationAxis.y
        q.z = rotationAxis.z
        return q
    rotationAxis = ObjectV.cross(DirV)
    s = math.sqrt((1.0 + cosTheta) * 2.0)
    invs = 1 / s
    q = mathutils.Quaternion()
    q.w = s * 0.5
    q.x = rotationAxis.x * invs
    q.y = rotationAxis.y * invs
    q.z = rotationAxis.z * invs
    return q
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号