09_TriangleStrip.py

Feb 02, 2010 10:18






size(300, 300)
background(0.5)
from math import cos, sin, radians

x = WIDTH/2
y = HEIGHT/2
outerRad = 96
innerRad = 63
px = 0
py = 0
angle = 0
pts = 122
rot = 360.0/pts

outer = []
iner = []

fill(0.2)
for i in range(0, pts):

px = x + cos(radians(angle))*outerRad
py = y + sin(radians(angle))*outerRad
angle += rot

outer.append((px, py))

px = x + cos(radians(angle))*innerRad
py = y + sin(radians(angle))*innerRad

angle += rot

iner.append((px, py))

for i in range(1, pts):
stroke(0.2)
line(outer[i-1][0], outer[i-1][1], outer[i][0], outer[i][1])
line(iner[i-1][0], iner[i-1][1], iner[i][0], iner[i][1])
line(outer[i][0], outer[i][1], iner[i][0], iner[i][1])
line(outer[i][0], outer[i][1], iner[i-1][0], iner[i-1][1])

nodebox

Previous post Next post
Up