Day 5
(2)
螺旋状に球体を積層する
#curve#sphere#wave

✅ Inputs
- `turns`: int – 螺旋の回転数(例:5)
- `count`: int – 球体の数
- `radius`: float – 螺旋の半径
- `height`: float – 全体の高さ
- `sphere_radius`: float – 各球体の半径
✅ Outputs
- `results`: list of `Sphere` – 螺旋上に配置された球体群
✅ Code
import Rhino.Geometry as rg
import math
angle_total = turns * 2 * math.pi
angle_step = angle_total / (count - 1)
z_step = height / (count - 1)
spheres = []
for i in range(count):
angle = i * angle_step
z = i * z_step
x = math.cos(angle) * radius
y = math.sin(angle) * radius
center = rg.Point3d(x, y, z)
spheres.append(rg.Sphere(center, sphere_radius))
results = spheres