|
|
|
Vector Shape - Create Polygon
Added on 2/7/2006
|
Pass the width, height and number of sides to create polygon shapes such as stop signs, pentagons, etc.
vertList = []
sides = integer(sides)
a = max(width, height) / 2.0
b = min(width, height) / 2.0
rad = (360 / float(sides)) * (pi / 180)
radOffset = rad + (90 * (pi / 180))
repeat with i = 1 to sides
t = (i * rad) - radOffset
x = a * cos(t)
y = b * sin(t)
vertList.add([#vertex: point(x, y)])
end repeat
return vertList
end
|
|