Day 9
(2.5)
折り紙 – 山折り谷折りで立体化
#origami#triangle#center#parametric

✅ Inputs
- `size`: float – 正方形の一辺の長さ
- `fold_depth`: float – 0〜0.5 の範囲で、辺の中点を中心にどれだけ寄せるか(折り込みの深さ)
✅ Outputs
- `results`: list of `Brep` – 谷折りされた8枚の三角面からなる立体構造
✅ Code
import Rhino.Geometry as rg
import math
center_height = fold_depth * size
p0 = rg.Point3d(0, 0, 0)
p1 = rg.Point3d(size, 0, 0)
p2 = rg.Point3d(size, size, 0)
p3 = rg.Point3d(0, size, 0)
center = rg.Point3d(size / 2, size / 2, center_height)
mid_bottom = rg.Point3d(size / 2, 0 + fold_depth * size, 0)
mid_right = rg.Point3d(size - fold_depth * size, size / 2, 0)
mid_top = rg.Point3d(size / 2, size - fold_depth * size, 0)
mid_left = rg.Point3d(0 + fold_depth * size, size / 2, 0)
corners = [p0, p1, p2, p3]
midpoints = [mid_bottom, mid_right, mid_top, mid_left]
results = []
for i in range(4):
c0 = corners[i]
c1 = corners[(i + 1) % 4]
m = midpoints[i]
tri1 = rg.Brep.CreateFromCornerPoints(center, m, c0, 0.001)
results.append(tri1)
tri2 = rg.Brep.CreateFromCornerPoints(c1, center, m, 0.001)
results.append(tri2)