物体を拡大縮小する 【文法】 Transform{ scale Xの拡大率 Y方向の拡大率 Z方向の拡大率 children[ ] }
【例1】半径2の球を、X方向に2倍、Y方向に0.5倍に拡大縮小する。 #VRML V2.0 utf8 Transform{ scale 2.0 0.5 1.0 # X方向に2.0倍、Y方向に0.5倍、Z方向に1.0倍、拡大縮小する children[ Shape{ appearance Appearance{ material Material{ diffuseColor 0.0 1.0 0.0 } } geometry Sphere{ radius 2.0 } } ] } 実行例
【例2】半径2の球を、X方向に2倍、Y方向に0.5倍に拡大縮小し、Z軸を中心に30度回転する。 #VRML V2.0 utf8 Transform{ rotation 0.0 0.0 1.0 0.52 # 30度回転する scale 2.0 0.5 1.0 # X方向に2.0倍、Y方向に0.5倍、Z方向に1.0倍、拡大縮小する children[ Shape{ appearance Appearance{ material Material{ diffuseColor 0.0 1.0 0.0 } } geometry Sphere{ radius 2.0 } } ] } 実行例
【例3】半径2の球を、X方向に2倍、Y方向に0.5倍に拡大縮小し、Z軸を中心に30度回転した図形を(3, 0, 0)に移動する。 #VRML V2.0 utf8 Transform{ rotation 0.0 0.0 1.0 0.52 # 30度回転する translation 3.0 0.0 0.0 # (3.0 0.0 0.0)に移動する scale 2.0 0.5 1.0 # X方向に2.0倍、Y方向に0.5倍、Z方向に1.0倍、拡大縮小する children[ Shape{ appearance Appearance{ material Material{ diffuseColor 0.0 1.0 0.0 } } geometry Sphere{ radius 2.0 } } ] } 実行例
【練習問題】
鏡餅を作りなさい
実行例
【練習問題】
飛行船を作りなさい
実行例
【練習問題】
扇風機を作りなさい
実行例