Skip to content

Instantly share code, notes, and snippets.

@zeffii
Forked from anonymous/arrow_as_script_node.py
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zeffii/1a2e88e7346ee8a4c9ae to your computer and use it in GitHub Desktop.
Save zeffii/1a2e88e7346ee8a4c9ae to your computer and use it in GitHub Desktop.
def sv_main(height=1.0, tail_len=0.5, tail_width=0.2, head_len=1.0):
in_sockets = [
['s', 'height', height],
['s', 'tail_len', tail_len],
['s', 'tail_width', tail_width],
['s', 'head_len', head_len]]
a = head_len
b = height/2
c = tail_width/2
d = tail_len
verts = []
add_vert = lambda x, y: verts.append((x, y, 0))
full_arrow = [
[a,0],[0,b],[0,c],[-d,c],[-d,-c],[0,-c],[0,-b]]
if 0.0 in (tail_width, tail_len):
full_arrow = [[a,0],[0,b],[0,-b]]
faces = [[0,1,2]]
else:
faces = [[0,6,1],[2,3,4,5]]
for xy in full_arrow:
add_vert(*xy)
out_sockets = [
['v', 'Verts', [verts]],
['s', 'Faces', [faces]]
]
return in_sockets, out_sockets
@enzyme69
Copy link

enzyme69 commented May 7, 2014

Another great example. Elegant Python and Sverchok code.

Thanks so much Zeffii!

@enzyme69
Copy link

enzyme69 commented May 7, 2014

Wishlist:

  1. Arrow Segment
  2. Arrow Generation Variations, via List

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment