Descriptions and Examples for the POV-Ray Raytracer by Friedrich A. Lohmüller
Geometric Transformations with POV-Ray -
Deutsch Deutsch
Italiano Italiano
Français français

- POV-Ray Tutorial
   - Index

    - "translate<  ... >"
    - "rotate<  ... >"
    - "scale<  ... >"
    - "scale<-1,1,1>"

    - "matrix<  ... >"
    - Shearing

    - "transform{ ...}"
       and "inverse"

    Vectors and

    Insert Menu Add-on
      & Download

arround one or more axes of the coordinate system

rotation demo
general syntax:
rotate <wx,wx,wz>
this causes a rotation of an object arround the appropriated coordinate axis of the three basic directions
by an angle of wx degrees arround the x axis
by an angle of wy degrees arround the y axis and
by an angle of wz degrees arround the z axis.
Attention: The rotations are not applied relative of any local axes of symetriy through the center of an object and the rotations will be applied in the writen order!

"rotate< 0,90, 0>" causes a rotation arround the y axis by 90 degrees (lefthanded positive).
"rotate< 0,90,45>" first causes a rotation arround the y axis by 90 degrees and then a rotation arround the z axis by 45 degrees.
"rotate< 0, 0,45> rotate< 0,90, 0>" first causes a rotation of 45 degrees arround the z axis
followed by a rotation of 90 degrees arround the y axis.

Attention! Attention:
Sequential rotations arround different axes
are not interchangeable!

This means the result depends on the order in which we apply these rotations! High potential of frustration if we are not carefully enough!!!.

Attention! Attention:
A rotation by "rotate < , , >" will be executed always around the according axes of the system of coordinates!
If we want to turn an object with its center at <x1,y1,z1> around the direction of x, y and/or z with rotate<xrot,yrot,zrot> relative to its center we have to do it in this way:
translate -<x1,y1,z1> // First push it to <0,0,0>! Attention: minus!
rotate<xrot,yrot,zrot>  // Then rotate the object and
translate  <x1,y1,z1>  // then push it back to its position!

Samples rotation 640x480

Sample 1:

#declare YellowSmarty =
       scale <1,0.5,1>
          pigment{ color rgb<1,0.65,0>}
          finish { diffuse 0.9
                   phong 1}}} //--
object{YellowSmarty rotate<0,0, 90>}
object{YellowSmarty rotate<0,0,105>}
object{YellowSmarty rotate<0,0,120>}
object{YellowSmarty rotate<0,0,135>}
object{YellowSmarty rotate<0,0,150>}
object{YellowSmarty rotate<0,0,165>}
object{YellowSmarty rotate<0,0,180>}
#declare Zylinder_1 =
           pigment{ color NeonPink}
           finish { diffuse 0.9
                    phong 1}}} //--
object{Zylinder_1 rotate<0,  0,0>}
object{Zylinder_1 rotate<0, 15,0>}
object{Zylinder_1 rotate<0, 30,0>}
object{Zylinder_1 rotate<0, 45,0>}
object{Zylinder_1 rotate<0, 60,0>}
object{Zylinder_1 rotate<0, 75,0>}
object{Zylinder_1 rotate<0, 90,0>}
object{Zylinder_1 rotate<0,105,0>}
object{Zylinder_1 rotate<0,120,0>}
object{Zylinder_1 rotate<0,135,0>}
object{Zylinder_1 rotate<0,150,0>}
object{Zylinder_1 rotate<0,165,0>}
object{Zylinder_1 rotate<0,180,0>}
Samples rotation 640x480

Sample 2:

#declare Ring=
object{YellowSmarty rotate<0,  0,0>}
object{YellowSmarty rotate<0, 30,0>}
object{YellowSmarty rotate<0, 60,0>}
object{YellowSmarty rotate<0, 90,0>}
object{YellowSmarty rotate<0,120,0>}
object{YellowSmarty rotate<0,150,0>}
object{YellowSmarty rotate<0,180,0>}
object{YellowSmarty rotate<0,210,0>}
object{YellowSmarty rotate<0,240,0>}
object{YellowSmarty rotate<0,270,0>}
object{YellowSmarty rotate<0,300,0>}
object{YellowSmarty rotate<0,330,0>}
            pigment{ color NeonPink}
            finish { diffuse 0.9
                     phong 1} } }
}// end of union //---------------
 object{Ring translate<4,1,4> }

"rotate" can also be used with geometric shapes as well as with other objects like light sources, textures("texture"), color patterns ("pigment") and simulated surface deformations ("normal").

translate | rotate | scale | matrix | shearing | | transform | vector transformations
© Friedrich A. Lohmüller, 2014