def edges_matrix_normal(vertices, edges, faces, orientation): '''Matrix aligned with edge and edge normal (needs faces)''' origin, track = orientation direction = edges_direction(vertices, edges, out_numpy=False) center = edge_vertex(vertices, edges, origin) bm = bmesh_from_pydata(vertices, edges, faces, normal_update=True) normals = [tuple(face.normal) for face in bm.faces] bm.free() ed_normals = edges_normal(vertices, normals, edges, faces) if track == 'Z': vals = vectors_center_axis_to_matrix(center, direction, ed_normals) if track == 'X': vals = vectors_center_axis_to_matrix(center, ed_normals, direction) return vals
def pols_matrix(vertices, edges, faces, orientation): origin, direc = orientation bm = bmesh_from_pydata(vertices, edges, faces, normal_update=True) normals = [Vector(face.normal) for face in bm.faces] centers = pols_origin_modes_dict[origin][1](bm.faces) tangents = tangent_modes_dict[direc][1](bm.faces) vals = vectors_center_axis_to_matrix(centers, normals, tangents) bm.free() return vals
def edges_matrix_normal(vertices, edges, faces, orientation): ''' Matrix aligned with edge and edge normal (needs faces) vertices: list as [vertex, vertex, ...], being each vertex [float, float, float]. edges: list with edges [[int, int], [int,int]...] faces: list as [polygon, polygon,..], being each polygon [int, int, ...]. orientation: contains origin track and up origin: String that can be First, Center, Last track: String that can be X, Y, Z, -X, -Y or -Z up: String that can be X, Y, Z, -X, -Y or -Z outputs each edge matrix [matrix, matrix, matrix] ''' origin, track = orientation direction = edges_direction(vertices, edges, out_numpy=False) center = edge_vertex(vertices, edges, origin) ed_normals = edges_normal(vertices, edges, faces) if track == 'Z': vals = vectors_center_axis_to_matrix(center, direction, ed_normals) if track == 'X': vals = vectors_center_axis_to_matrix(center, ed_normals, direction) return vals
def pols_matrix(vertices, faces, origin, direc): ''' Matrix aligned with faces vertices: list as [vertex, vertex, ...], being each vertex [float, float, float]. faces: list as [polygon, polygon,..], being each polygon [int, int, ...]. orientation: contains origin and direction origin: String that can be any key of pols_origin_modes_dict direction: String that can be any key of tangent_modes_dict outputs each polygon matrix [matrix, matrix, matrix] ''' bm = bmesh_from_pydata(vertices, [], faces, normal_update=True) normals = [Vector(face.normal) for face in bm.faces] centers = pols_origin_modes_dict[origin][1](bm.faces) tangents = tangent_modes_dict[direc][1](bm.faces) vals = vectors_center_axis_to_matrix(centers, normals, tangents) bm.free() return vals