<style> .reveal, .reveal h1, .reveal h2, .reveal h3, .reveal h4, .reveal h5, .reveal h6 { font-family: "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, "Microsoft JhengHei", Meiryo, sans-serif; } h1, h2, h3, h4, h5, h6 { text-transform: none !important; } .color-yellow{ color: yellow; } .alert { padding: 15px; margin-bottom: 20px; border: 1px solid transparent; border-radius: 4px; text-align: left; padding: 10px 0; } .alert-info { color: #31708f; background-color: #d9edf7; border-color: #bce8f1; } .alert-success { color: #3c763d; background-color: #dff0d8; border-color: #d6e9c6; } .alert-danger { color: #a94442; background-color: #f2dede; border-color: #ebccd1; } .reveal .slides span { text-align: left; display: inline-block; } p, li { font-size: 0.88em !important; } li>p { font-size: 1em !important; } </style> # 2022-12-15 JuliaTokai ###### tags: `JuliaTokai` `prezentation` --- # 紙を編んで曲面を<br>つくろう!(発表版) [堀川 由人, ほりたみゅ, @Hyrodium](https://hyrodium.github.io/ja) ---- こんな曲面をつくる話 ![](https://github.com/hyrodium/ElasticSurfaceEmbedding.jl/blob/v0.0.2/docs/src/img/CatenoidHelicoid.gif?raw=true) ---- ### おしながき * 自己紹介 * 曲面を編む理論 * ElasticSurfaceEmbedding.jl * まとめ --- ## 自己紹介 * 数学がスキ! * 工作がスキ! * Juliaがスキ! * 大学の研究室では弾性論を専攻 ![](https://i.imgur.com/Cu5kgTZ.png =350x) ---- ### 時系列 * 2018-06-xx 理論の大枠が完成 * 2018-07-28 数値計算スクリプト(仮)の完成 * 2018-08-01 懸垂面-常螺旋面の変形模型が完成 * 2019-02-13 修論発表 * —空白期間 (労働, 転職, 結婚, Julia, etc.)— * 2022-11-14 [arXivに論文](https://arxiv.org/abs/2211.06372)公開 * 2022-11-14 [ElasticSurfaceEmbedding.jl](https://github.com/hyrodium/ElasticSurfaceEmbedding.jl)公開 * 2022-12-01 [Julia Advent Calendar 2022の記事](https://zenn.dev/hyrodium/articles/8d873b0118d5c5) * 2022-12-17 [日曜数学AdventCalendar 2022の記事](https://note.com/hyrodium/n/n7b7cf03a7d91) * 2023-07-xx JuliaConで発表予定 --- ## 曲面を編む理論 * 先行研究 * 平面材料の変形 * 問題設定 ---- ### 先行研究① 平面材料から作られる立体形状の例 ![](https://i.imgur.com/81eZYlg.png =313x) ![](https://i.imgur.com/mZzqd0U.png =420x) * 手法: 曲面を可展面で近似してから切出形状を決定 * 問題点: 材料の**繋ぎ目で滑らかにならない** 目的: 可展面近似を用いずに, 高精度に曲面形状を構成 ---- ### 先行研究② ![](https://i.imgur.com/d9WCT94.png =450x) https://www.youtube.com/watch?v=lrr2iKXSYz4 * 手法: 3次元的な材料変形を考慮して切出形状を決定 * 問題点: **隙間が発生**・**外在的な埋込に計算結果が依存** 目的: 2次元弾性体としてモデリングして切出形状を決定 ---- ### 平面材料の変形 : 面外と面内 ![](https://media.giphy.com/media/DBbgzDEBMRQ2lCDc1C/giphy.webp =220x) ![](https://media.giphy.com/media/3d4QFpCTnxbIVho19W/giphy.webp =220x) ![](https://media.giphy.com/media/1BcQS15okiYvn0CAqp/giphy.webp =220x) * 曲面の第一基本形式を * 面外変形: 保つ * 面内変形: 保たない * 通常の折り紙/紙工作では可展面のみを構成可能 * 面外変形: 可展面のみ構成可能 * 面内変形: 可展面以外も構成可能 ---- ### 紙の弾性的性質 具体例: 紙を捩って常螺旋面($K< 0$)が作れる 面外変形のみなら可展面($K=0$) ($K$:Gauss曲率) ![](https://i.imgur.com/zXgiJrL.jpg =600x) * 紙は面内方向にも変形可能. * [面外変形のエネルギー] $\ll$ [面内変形のエネルギー] ---- <!-- .slide: data-transition="none" --> ### 問題設定 1. 曲面を座標に沿って曲面片に分割 1. 平面材料から曲面に変形すると歪エネルギーが発生 1. エネルギー最小の形状を最も自然な切出形状とする ![](https://i.imgur.com/5BgYqyL.png =700x) ---- <!-- .slide: data-transition="none" --> ### 問題設定 1. **曲面を座標に沿って曲面片に分割** 1. 平面材料から曲面に変形すると歪エネルギーが発生 1. エネルギー最小の形状を最も自然な切出形状とする ![](https://i.imgur.com/exm3E7z.png =700x) ---- <!-- .slide: data-transition="none" --> ### 問題設定 1. 曲面を座標に沿って曲面片に分割 1. **平面材料から曲面に変形すると歪エネルギーが発生** 1. エネルギー最小の形状を最も自然な切出形状とする ![](https://i.imgur.com/mYuULoq.png =700x) ---- <!-- .slide: data-transition="none" --> ### 問題設定 1. 曲面を座標に沿って曲面片に分割 1. 平面材料から曲面に変形すると歪エネルギーが発生 1. **エネルギー最小の形状を最も自然な切出形状とする** ![](https://media.giphy.com/media/cPTAy4w4IFugabge1l/giphy.webp =700x) ---- ### 基準状態と現状態 * 基準状態 : 変形前で歪エネルギーが発生していない * 現状態 : 変形後で歪エネルギーが発生している ![](https://media.giphy.com/media/cPTAy4w4IFugabge1l/giphy.webp =350x) ![](https://media.giphy.com/media/8A7t5VLdWWfx1qYkkm/giphy.webp =350x) 「平面材料から曲面片へ変形させた際のエネルギー」と 「曲面片から平面への埋め込みで入るエネルギー」は ほぼ同じ 以降では基準状態と現状態を入れ替えて定式化する ---- ### Riemann多様体上の非線形弾性論 ![](https://media.giphy.com/media/8A7t5VLdWWfx1qYkkm/giphy.webp =420x) 材料に発生する歪エネルギー$W$は次の順で定義される * 基準状態$M_{[0]}$, 現状態$M_{[t]}$のRiemann計量 $g_{[0]}, g_{[t]}$ * Green歪テンソル $E=\frac{1}{2}(g_{[t]}-g_{[0]})$ * 歪エネルギー $W=\int_M \frac{1}{2}C(E,E)\upsilon_{[0]}$ 歪エネルギー$W$が最小となる 埋込$M_{[0]}\to \mathbb{E}^2$を探す --- ## ElasticSurfaceEmbedding.jl * 環境構築 * 編み紙の全体の流れ * 数値計算の全体の流れ * デモ ---- ### 環境構築 REPLのpkgモードで以下を実行 ``` (@v1.8) pkg> add BasicBSpline StaticArrays IntervalSets (@v1.8) pkg> add https://github.com/hyrodium/BasicBSplineExporter.jl (@v1.8) pkg> add https://github.com/hyrodium/ElasticSurfaceEmbedding.jl ``` ---- ### 編み紙の全体の流れ ![](https://i.imgur.com/iBWlT4Q.png) 1. 曲面の形状の定義 1. 曲面を長細い曲面片に分割 1. それぞれの曲面片の切り出し形状の計算 1. 平面材料(紙)から切り出し 1. 編んで完成! ---- ### 数値計算の全体の流れ 1. 曲面の形状の定義 1. 測地的曲率から初期値決定 1. 反復計算 a. Newton法で反復計算 b. B-spline多様体のリファインメント ---- ### デモ (放物面) ```julia= using IntervalSets using BasicBSpline using StaticArrays using ElasticSurfaceEmbedding ElasticSurfaceEmbedding.𝒑₍₀₎(u¹,u²) = SVector(u¹, u², u¹^2+u²^2) n = 10 D(i,n) = (-1.0..1.0, (i-1)/n..i/n) allsteps = AllSteps() for i in 1:10 initial_state!(allsteps, D(i,n), n₁=25) newton_onestep!(allsteps, fixingmethod=:fix3points) newton_onestep!(allsteps) refinement!(allsteps, p₊=(0,1), k₊=(EmptyKnotVector(),KnotVector([(i-1/2)/10]))) newton_onestep!(allsteps) newton_onestep!(allsteps) pin!(allsteps) end export_pinned_steps(".", allsteps, unitlength=(50, "mm"), mesh=(20,1), xlims=(-2,2), ylims=(-1,1)) ``` ---- ### 放物面を編む ![](https://i.imgur.com/2TrVqIf.png =x350) ![](https://i.imgur.com/nVgJP7D.jpg =x350) レーザー加工機で紙を切って編む ---- ### デモ (立体射影) ```julia= ## Setup using Luxor using IntervalSets using BasicBSpline using StaticArrays using ElasticSurfaceEmbedding function create_bezierpath(C::BSplineManifold{1,(3,),Point}) P = bsplinespaces(C)[1] k = knotvector(P) k′ = 3*unique(k) + k[[1,end]] P′ = BSplineSpace{3}(k′) C′ = refinement(C,P′) a′ = controlpoints(C′) n′ = dim(P′) m = (n′-1) ÷ 3 bezierpath = BezierPath([BezierPathSegment(a′[3i-2], a′[3i-1], a′[3i], a′[3i+1]) for i in 1:m]) return bezierpath end function svector2point(M::BSplineManifold, unitlength) P = bsplinespaces(M) a = controlpoints(M) a′ = [Point(p[1]*unitlength[1], -p[2]*unitlength[1]) for p in a] M′ = BSplineManifold(a′, P) return M′ end ## Shape definition ElasticSurfaceEmbedding.𝒑₍₀₎(u¹,u²) = SVector(2*u¹/(1+u¹^2+u²^2), 2*u²/(1+u¹^2+u²^2), (-1+u¹^2+u²^2)/(1+u¹^2+u²^2)) n = 10 D(i,n) = (-2.0..2.0, 2(i-1)/n..2i/n) ## Strain estimation show_strain(D(1,n)) ## Main computation allsteps = AllSteps() for i in 1:10 initial_state!(allsteps, D(i,n), n₁=25) newton_onestep!(allsteps, fixingmethod=:fix3points) newton_onestep!(allsteps) refinement!(allsteps, p₊=(0,1), k₊=(EmptyKnotVector(),KnotVector([(i-1/2)/5]))) newton_onestep!(allsteps) newton_onestep!(allsteps) pin!(allsteps) end ## Export settings xlims=(-3,3) ylims=(-1,1) unitlength = (200, "mm") r = 0.025 ## Export all strips for i in 1:10 M = svector2point(allsteps.steps[6i].manifold, unitlength) D¹ = domain(bsplinespaces(M)[1]) D² = domain(bsplinespaces(M)[2]) u¹s = range(extrema(D¹)...,21)[2:end-1] u²₋ = minimum(D²) u²₊ = maximum(D²) width = (xlims[2] - xlims[1]) * unitlength[1] height = (ylims[2] - ylims[1]) * unitlength[1] filepath = "embedding-$(i).svg" Drawing(width, height, filepath) origin() background("white") sethue("red") C = M(:,u²₋) path = create_bezierpath(C) drawbezierpath(path, :stroke) C = M(:,u²₊) path = create_bezierpath(C) drawbezierpath(path, :stroke) C = M(2,:) path = create_bezierpath(C) drawbezierpath(path, :stroke) C = M(-2,:) path = create_bezierpath(C) drawbezierpath(path, :stroke) for u¹ in u¹s k = KnotVector([0,0,0,0,0.25,0.5,0.75,1,1,1,1]) P = BSplineSpace{3}(k) dim(P) a = fittingcontrolpoints(t -> M(u¹+r*cospi(t), u²₋+r*sinpi(t)), P) C = BSplineManifold(a,P) path = create_bezierpath(C) drawbezierpath(path, :stroke) a = fittingcontrolpoints(t -> M(u¹+r*cospi(t), u²₊-r*sinpi(t)), P) C = BSplineManifold(a,P) path = create_bezierpath(C) drawbezierpath(path, :stroke) end finish() preview() script = read(filepath, String) lines = split(script, "\n") lines[2] = replace(lines[2],"pt\""=>"mm\"") write(filepath, join(lines,"\n")) end ``` ---- ### 立体射影を編む ![](https://pbs.twimg.com/media/FkJllvMaEAANnFj?format=jpg&name=large =x220) ![](https://assets.st-note.com/img/1671119408995-2uHgew6rz1.png?width=2000&height=2000&fit=bounds&format=jpg&quality=85 =x220) ![](https://pbs.twimg.com/media/FkHLnjGaAAATtsK?format=jpg&name=4096x4096 =x220) レーザー加工機で紙を切って編む ([プレゼント企画](https://note.com/hyrodium/n/n7b7cf03a7d91)もあります!) ---- ### 他の作品たち ![](https://pbs.twimg.com/media/E8v4uoKVIAgenv0?format=jpg&name=large =x300) ![](https://pbs.twimg.com/media/E8v4uU4UUAEFS5Y?format=jpg&name=large =x300) ![](https://i.imgur.com/uQcFxaN.jpg =x300) ![](http://gallery.bridgesmathart.org/sites/live.gallery.host.sunstormlab.com/files/styles/large/public/jmm2019/yuto-horikawa/append.jpg) ↑双曲放物面 6回対称↑ 懸垂面常螺旋面変形模型↓ https://www.youtube.com/watch?v=Gp6XkPLCw7s --- ## まとめ * 数学たのしい! * 工作たのしい! * Juliaたのしい! [![](https://i.imgur.com/Jgvsy97.png)](https://github.com/hyrodium/ElasticSurfaceEmbedding.jl) (⭐が欲しい!)
{"metaMigratedAt":"2023-06-17T16:59:05.409Z","metaMigratedFrom":"YAML","title":"2022-12-15 JuliaTokai","breaks":true,"lang":"ja","dir":"ltr","robots":"noindex, nofollow","slideOptions":"{\"theme\":\"white\",\"transition\":\"slide\"}","description":"堀川 由人, ほりたみゅ, @Hyrodium","contributors":"[{\"id\":\"41421433-16a1-4a57-ac11-6f7b7becb765\",\"add\":10970,\"del\":1336}]"}
    411 views