STUDIO TAMA

Rhinoceros & Grasshopper Utilities

Home

GH Sample Files

GH Python Tutorials

Rhino Assets

Books

Blog

Plugins

About

Privacy Policy

Terms of Service

Contact

© 2025 STUDIO TAMA

Day 9

折り紙 – 山折り谷折りで立体化

#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)
← Back to Grasshopper Python Tutorials

License & Terms of Use

ItemAllowedDescription
Integration into your projectsYou are free to use the code as part of your scripts or works, whether for personal or commercial purposes.
Code modification & learning useCustomizing the code for your own learning or specific purposes is very welcome.
Sharing on SNS / showcasingNo permission is required to share images or URLs of your works. Please feel free to showcase them!
Redistribution / republishing×Do not publish the code or files in their entirety as content on your own site or elsewhere.
Reselling as materials/programs×Do not sell the content of this site, either as-is or with only minor modifications, for a fee.
Copyright notice / linkOptionalNot required, but including a link to the source would be greatly appreciated.
Day Day 9 - 折り紙 – 山折り谷折りで立体化 | Grasshopper Python 入門チュートリアル | STUDIO TAMA