Pythonのお勉強 Part34at TECH
Pythonのお勉強 Part34 - 暇つぶし2ch145:デフォルトの名無しさん
09/07/22 12:17:16
これはおもろいすなぁ。
URLリンク(up2.viploader.net)
こんなブキミな物体(Torus Knot)も簡単に書ける。描画部分を下のように変えます。

pointslist = []
A = 3.0
B = 8.0
drawcount = 1000
for i in range(drawcount):
theta = 2 * math.pi * i * A / drawcount
x = ( 2 + math.cos(B*theta/A))*math.cos(theta) * 20
y = ( 2 + math.cos(B*theta/A))*math.sin(theta) * 20
z = math.sin(B*theta/A) * 20
pointslist.append((x, y, z))

for i, p in enumerate(pointslist):
c_hsv=(i/float(drawcount),1,1)
sphere(pos=p, radius=6, color=color.hsv_to_rgb(c_hsv), opacity=0.7)


次ページ
続きを表示
1を表示
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch