Skip to content

Instantly share code, notes, and snippets.

@nortikin
Last active September 30, 2016 14:36
Show Gist options
  • Save nortikin/11110827 to your computer and use it in GitHub Desktop.
Save nortikin/11110827 to your computer and use it in GitHub Desktop.
changed type to 'v' sverchok SN1
def sv_main(num_verts=20, radius=5, limit=32):
# in boilerplate, could be less verbose
in_sockets = [
['s', 'num_verts', num_verts],
['s', 'radius', radius],
['s', 'limit', limit],
]
# arbitrary user code
num_verts_ = min(num_verts, limit) if num_verts > 2 else min(-num_verts, limit)
from math import sin, cos, pi
TWO_PI = 2*pi
v = []
angle = TWO_PI/num_verts_
for i in range(num_verts_):
theta = angle*i
v.append((cos(theta)*radius, sin(theta)*radius, theta*num_verts/100))
# out boilerplate
out_sockets = [
['v', 'Vecs', [v]]
]
return in_sockets, out_sockets
if __name__ == "__main__":
prog2 = sv_main({0},{1})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment