回転の順序**重要!**

重要とまで書きましたが、これを間違うと物体がとんでもない方向に行きます。
例を示します。ここでは物体をy軸中心に45度回転し、x方向に30移動させたい事とします。

#include "colors.inc"

camera { location<5,40,-45> look_at<5,0,0> }
light_source { <-30,30,-30> color rgb 1 }

plane { y,0 pigment { checker color White, color Gray50 } scale 10 }

box { <-5,0,-5>,<5,10,5> pigment { color Cyan } }

box { <-5,0,-5>,<5,10,5> rotate y*45 translate<30,0,0> pigment { color Turquoise } }


正しく移動・回転されました。もしこの順序が逆になるとどうなるでしょうか。


#include "colors.inc"

camera { location<5,40,-45> look_at<5,0,0> }
light_source { <-30,30,-30> color rgb 1 }

plane { y,0 pigment { checker color White, color Gray50 } scale 10 }

box { <-5,0,-5>,<5,10,5> pigment { color Cyan } }

box { <-5,0,-5>,<5,10,5> translate<30,0,0> rotate y*45 pigment { color Turquoise } }


移動させた後に回転させると、y軸中心にその距離分回転するので結果が変わります。