本文整理汇总了Python中mathutils.Vector.zero方法的典型用法代码示例。如果您正苦于以下问题:Python Vector.zero方法的具体用法?Python Vector.zero怎么用?Python Vector.zero使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mathutils.Vector
的用法示例。
在下文中一共展示了Vector.zero方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: calc_custtangents
# 需要导入模块: from mathutils import Vector [as 别名]
# 或者: from mathutils.Vector import zero [as 别名]
def calc_custtangents(vertlength, uv_vertcoords, uvverts_list, vindexlist2, vindices, me_normals):
me_tangents = []
me_binormals = []
for i in range(len(me_normals)):
tan = (uvverts_list[i] - (
me_normals[i] * me_normals[i].dot(uvverts_list[i])
)).normalized()
me_tangents.append(tan)
me_binormals.append(me_normals[i].cross(tan))
tempvect = Vector((0.0, 0.0, 0.0))
smoothlist = [[], [], [], []]
vertstoremove = []
new_tangents = [v for v in me_tangents]
for i in range(vertlength):
# Gather Loop
# - slow - checks the index list for uv islands each vert is part of
for j in vindexlist2:
if vindices[j] == i:
vertstoremove.append(j)
if len(smoothlist[0]) > 0:
if check_uvvertdist(uv_vertcoords[j], uv_vertcoords[smoothlist[0][0]], 0.01):
smoothlist[0].append(j)
else:
if len(smoothlist[1]) > 0:
if check_uvvertdist(uv_vertcoords[j], uv_vertcoords[smoothlist[1][0]], 0.01):
smoothlist[1].append(j)
else:
if len(smoothlist[2]) > 0:
if check_uvvertdist(uv_vertcoords[j], uv_vertcoords[smoothlist[2][0]], 0.01):
smoothlist[2].append(j)
else:
smoothlist[3].append(j)
else:
smoothlist[2].append(j)
else:
smoothlist[1].append(j)
else:
smoothlist[0].append(j)
# calculation time tweak: remove indices that won't come up again for less iterations in successive passes
for k in vertstoremove:
vindexlist2.remove(k)
# actual smoothing is done here:
smooth_vertcusttangents(tempvect, smoothlist, me_normals, me_tangents, me_binormals, new_tangents)
# reset vars for next iteration
smoothlist = [[], [], [], []]
vertstoremove = []
tempvect.zero()
me_tangents = [v for v in new_tangents]
return me_tangents, me_binormals
示例2: vectorFrom2Points
# 需要导入模块: from mathutils import Vector [as 别名]
# 或者: from mathutils.Vector import zero [as 别名]
def vectorFrom2Points(origin, dest, module = None):
""" Returns a |Vector| form 2 points in the space.
:param origin: Point A
:type origin: |Vector|
:param dest: Point B
:type dest: |Vector|
:param float module: If setted, the returned vector will have this maxium lenght. The new lenght will never be greater than the original.
"""
vec = Vector((dest.x - origin.x, dest.y - origin.y, dest.z - origin.z))
if not module: return vec
l = vec.length
if l < 0.0125: return vec.zero()
if l < module: return vec
vec = vec / l
if module == 1: return vec
else: return vec * module