Created
April 20, 2014 18:03
-
-
Save anonymous/11120697 to your computer and use it in GitHub Desktop.
test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
edges_to_polys | |
- input | |
- for every edge in edges | |
- find all vertices that are connected to the verts of this edge. | |
- pile all found verts into edges. | |
- assume an edge will have at most 2 faces associated with it. | |
``` | |
import bpy | |
obj = bpy.context.active_object | |
edges = obj.data.edges | |
verts = obj.data.vertices | |
def verts_from_edge(i): | |
return edges[i].vertices[:] | |
def connected_edge_idxs_from_vert(i): | |
return [e.index for e in edges if i in e.vertices[:]] | |
def verts_attached_to_vert(i): | |
idxs = connected_edge_idxs_from_vert(i) | |
m = [verts_from_edge(vi) for vi in idxs] | |
return [(e2 if e1==i else e1) for e1, e2 in m] | |
k = connected_edge_idxs_from_vert(66) | |
print(k) | |
k2 = verts_attached_to_vert(66) | |
print(k2) | |
``` | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment