双曲面

円筒をねじったような形の双曲面を描きます。

上下に同じ大きさの円があり、上の円周上の点と下の円周上の点を結んだ線分を描くのですが、このとき、すこしずらして結びます。

スクリプトは簡単なので読めるでしょう。下の円周上に20個の点を取り、±120°ずつずらしてひいてみました。

n=20;

d=120°;

repeat(n,s,

th1=s/n*360°;

th2=th1+d;

th3=th1-d;

Spaceline("1"+s,[[sin(th1),cos(th1),-1],[sin(th2),cos(th2),1]]);

Spaceline("2"+s,[[sin(th1),cos(th1),-1],[sin(th3),cos(th3),1]]);

);

circle3d("1",[0,0,1],[0,0,1],1);

circle3d("2",[0,0,-1],[0,0,1],1);

これだけではちょっと味気ないので、色をつけましょう。

デザイン化された丸椅子みたいなので、上下の円はmahogany、紐の色は goldenrod と royalblue にして太さも変え、TeX出力してみました。

n=20;

d=120°;

repeat(n,s,

th1=s/n*360°;

th2=th1+d;

th3=th1-d;

Spaceline("1"+s,[[sin(th1),cos(th1),-1],[sin(th2),cos(th2),1]],["Color=goldenrod"]);

Spaceline("2"+s,[[sin(th1),cos(th1),-1],[sin(th3),cos(th3),1]],["Color=royalblue"]);

);

circle3d("1",[0,0,1],[0,0,1],1,["Color=mahogany"]);

circle3d("2",[0,0,-1],[0,0,1],1,["Color=mahogany"]);

< 戻る >