本文整理匯總了Python中mathutils.Quaternion.y方法的典型用法代碼示例。如果您正苦於以下問題:Python Quaternion.y方法的具體用法?Python Quaternion.y怎麽用?Python Quaternion.y使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類mathutils.Quaternion
的用法示例。
在下文中一共展示了Quaternion.y方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: angle_between_nor
# 需要導入模塊: from mathutils import Quaternion [as 別名]
# 或者: from mathutils.Quaternion import y [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 y [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