Created
May 13, 2014 11:11
-
-
Save zeffii/7805bb123c47ef7d7d7c to your computer and use it in GitHub Desktop.
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
import numpy as np | |
def sv_main(verts=[]): | |
in_sockets = [['v', 'Verts', verts]] | |
out_sockets = [['v', 'Verts', []], ['s', 'Edges', []]] | |
if not verts: | |
return in_sockets, out_sockets | |
# get numpy array for fastness | |
nv = np.array(verts) | |
bbox = [] | |
for dim in range(3): | |
bbox.extend([nv[:,dim].min(), nv[:,dim].max()]) | |
# order is important | |
x = 1,1,0,0,1,1,0,0 | |
y = 3,2,2,3,3,2,2,3 | |
z = 4,4,4,4,5,5,5,5 | |
verts_out = [tuple(bbox[i] for i in j) for j in zip(x,y,z)] | |
edges_out = [ | |
(0,1),(1,2),(2,3),(3,0), # bottom edges | |
(4,5),(5,6),(6,7),(7,4), # top edges | |
(0,4),(1,5),(2,6),(3,7) # sides | |
] | |
out_sockets[0][2] = [verts_out] | |
out_sockets[1][2] = [edges_out] | |
return in_sockets, out_sockets | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment