本文整理汇总了Python中mathutils.Quaternion.z方法的典型用法代码示例。如果您正苦于以下问题:Python Quaternion.z方法的具体用法?Python Quaternion.z怎么用?Python Quaternion.z使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mathutils.Quaternion
的用法示例。
在下文中一共展示了Quaternion.z方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: angle_between_nor
# 需要导入模块: from mathutils import Quaternion [as 别名]
# 或者: from mathutils.Quaternion import z [as 别名]
def angle_between_nor(nor_orig, nor_result):
angle = math.acos(nor_orig.dot(nor_result))
axis = nor_orig.cross(nor_result).normalized()
q = Quaternion()
q.x = axis.x * math.sin(angle / 2)
q.y = axis.y * math.sin(angle / 2)
q.z = axis.z * math.sin(angle / 2)
q.w = math.cos(angle / 2)
return q
示例2: _arc_segment
# 需要导入模块: from mathutils import Quaternion [as 别名]
# 或者: from mathutils.Quaternion import z [as 别名]
def _arc_segment(v_1, v_2):
ELorigin = bpy.context.scene.objects['ELorigin']
ELground = bpy.context.scene.objects['ELground']
v = v_2 - v_1
d = v.length
ELorigin.location = Vector((0, 0, 0))
ELground.location = Vector((0, 0, -d))
v_L = ELground.location - ELorigin.location
q = Quaternion()
c = Vector.cross(v_L, v)
q.x = c.x
q.y = c.y
q.z = c.z
q.w = sqrt((v_L.length ** 2) * (v.length ** 2)) + \
Vector.dot(v_L, v)
q.normalize()
euler = q.to_euler()
bpy.ops.object.runfslg_operator()
laALL = bpy.context.scene.objects['laALL']
laALL.name = 'lARC'
laALL.rotation_euler = euler
laALL.location = v_1
bpy.context.active_object.select = False
laALL.select = True
bpy.ops.object.transform_apply(location=True, rotation=True, scale=True)
laALL.select = False
bpy.context.active_object.select = True
return laALL