|
|

楼主 |
发表于 2017-11-30 14:49:54
|
显示全部楼层
- #coding=utf-8
- import rhinoscriptsyntax as rs
- from math import sqrt,pi,cos,sin
- width = 70
- height = 70
- nbr_circles = 250
- phi = (sqrt(5) + 1) / 2 - 1 # golden ratio
- golden_angle = phi * 2 * pi # golden ngle
- lg_rad = width * .45;
- lg_area = lg_rad ** 2 * pi
- sm_area = lg_area / nbr_circles # Area of our little circles,if they filled the space entirely
- sm_rad = sqrt(sm_area / pi) # This is related to the equation area = pi r squared
- fudge = 0.5 # Fudge factor, since our circles don't actually fill up space entirely.
- adj_sm_diameter = sm_rad * 2 * fudge
- cx = width / 2
- cy = height / 2
- for i in range(1,nbr_circles):
- angle = i * golden_angle
- cum_area = i * sm_area
- spiral_rad = sqrt(cum_area / pi)
- x = cx + cos(angle) * spiral_rad
- y = cy + sin(angle) * spiral_rad
- #print(x,y)
- #rs.AddCircle((x,y,0),1)
- rs.AddPoint(x,y,0)
复制代码
最终完成了.
|
|