Skip to content

Instantly share code, notes, and snippets.

@zeffii
Last active May 18, 2016 07:23
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/d06e9a6e62b37d9c45ec2c2fe8374a11 to your computer and use it in GitHub Desktop.
Save zeffii/d06e9a6e62b37d9c45ec2c2fe8374a11 to your computer and use it in GitHub Desktop.
import math
from math import pi as PI
from math import cos, sin
def sv_main(p1=0.3, p2=0.7, vdivs=20, points=200):
verts_out = []
in_sockets = [
['s', 'p1', p1],
['s', 'p2', p2],
['s', 'vdivs', vdivs],
['s', 'points', points]
]
r2=20*p1
r1=10*p2
theta = 1/points
vtheta = 1/vdivs
for v in range(vdivs):
for i in range(points):
t = 2 * PI * (theta * i)
p = PI * ((vtheta*v) - 0.5)
x = r1 * cos(t) * cos(p)
y = r1 * sin(t) * cos(p)
z = r1 * sin(p)
x = x + r2 * cos(t)
y = y + r2 * sin(t)
verts_out.append([x,y,z])
out_sockets = [
['v', 'verts', [verts_out]]
]
return in_sockets, out_sockets
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment