Created
May 13, 2014 10:46
-
-
Save zeffii/3e30ff70bb6a4466b05e 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()]) | |
minx, maxx, miny, maxy, minz, maxz = bbox | |
# order is important | |
a = (maxx, maxy, minz) | |
b = (maxx, miny, minz) | |
c = (minx, miny, minz) | |
d = (minx, maxy, minz) | |
e = (maxx, maxy, maxz) | |
f = (maxx, miny, maxz) | |
g = (minx, miny, maxz) | |
h = (minx, maxy, maxz) | |
verts_out = [a,b,c,d,e,f,g,h] | |
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
Try something like this, might have to adjust for order desired order, like bottom first then top