Day 4
(2)

波打つ球体リング

#sphere#wave#circle#sin#polar
波打つ球体リングのサムネイル

✅ Inputs

count      : int型     球の数(例:24)
radius     : float型   円の半径(例:10.0)
size       : float型   各球の半径(例:1.0)
amplitude  : float型   Z方向の振幅(例:2.0)
frequency  : float型   Sin波の周波数(例:2.0)

✅ Outputs

results    : List[Sphere] 円周上に波打つように配置された球体のリスト
import Rhino.Geometry as rg
import math

spheres = []

angle_step = 360.0 / count

for i in range(count):
    angle_deg = i * angle_step
    angle_rad = math.radians(angle_deg)

    x = radius * math.cos(angle_rad)
    y = radius * math.sin(angle_rad)
    z = math.sin(angle_rad * frequency) * amplitude

    center = rg.Point3d(x, y, z)
    sphere = rg.Sphere(center, size)
    spheres.append(sphere)

results = spheres