def edge_length(self, vertex_list):
#find distance between two points. numpy required. need to rework this so numpy not required
vtx_p=cmds.xform(vertex_list,q=True,t=True,ws=True)
'''
this is numpy version. reuse for machines with numpy for quicker calculations:
vtx_p_array_a = np.array([[vtx_p[0]], [vtx_p[1]], [vtx_p[2]]])
vtx_p_array_b = np.array([[vtx_p[3]], [vtx_p[4]], [vtx_p[5]]])
dist = np.linalg.norm(vtx_p_array_a-vtx_p_array_b)
'''
dist = math.sqrt((vtx_p[3] - vtx_p[0])**2 + (vtx_p[4] - vtx_p[1])**2 + (vtx_p[5] - vtx_p[2])**2)
return dist
评论列表
文章目录