Day 11
(3)
中心から放射する折り紙 – 交互に浮き沈みする風車構造
#curve#polar#3d#origami#windmill

✅ Inputs
- `square_size`: float – 放射構造が収まる正方形のサイズ(中心を原点とする)
- `arc_angle_deg`: float – 各アークの曲げ角度(deg)
- `arc_count`: int – 放射状に配置するアークの数(奇数推奨)
- `z_offset`: float – 交互にZ方向へ持ち上げる高さ(立体感の調整)
✅ Outputs
- `results`: list of `Brep` – Loftでつながれたアーク面群
✅ Code
import Rhino.Geometry as rg
import math
results = []
# 中心
center = rg.Point3d(0, 0, 0)
# 正方形(XY平面、中心原点)
half = square_size / 2
square_corners = [
rg.Point3d(-half, -half, 0),
rg.Point3d(half, -half, 0),
rg.Point3d(half, half, 0),
rg.Point3d(-half, half, 0),
rg.Point3d(-half, -half, 0)
]
square_crv = rg.Polyline(square_corners).ToNurbsCurve()
# Arcを構築
arcs = []
for i in range(arc_count):
angle_rad = i * (2 * math.pi / arc_count)
dir_vec = rg.Vector3d(math.cos(angle_rad), math.sin(angle_rad), 0)
ray_crv = rg.Line(center, dir_vec * 1000).ToNurbsCurve()
intersections = rg.Intersect.Intersection.CurveCurve(ray_crv, square_crv, 0.001, 0.001)
if intersections.Count == 0:
continue
end_pt = intersections[0].PointA
tangent = rg.Vector3d(
math.cos(angle_rad + math.radians(arc_angle_deg)),
math.sin(angle_rad + math.radians(arc_angle_deg)),
0
)
arc = rg.Arc(center, tangent, end_pt)
arcs.append(arc.ToNurbsCurve())
# Z方向交互オフセット
arcs_shifted = []
for i, arc in enumerate(arcs):
copy = arc.DuplicateCurve()
if i % 2 == 1:
copy.Transform(rg.Transform.Translation(0, 0, z_offset))
arcs_shifted.append(copy)
results = []
for i in range(len(arcs_shifted)):
crv_a = arcs_shifted[i]
crv_b = arcs_shifted[(i + 1) % len(arcs_shifted)]
loft = rg.Brep.CreateFromLoft([crv_a, crv_b], rg.Point3d.Unset, rg.Point3d.Unset, rg.LoftType.Normal, False)
if loft: results.append(loft[0])