Rotate the coordinate system.

The transform methods are used to position objects in your application. You can rotate about a particular axis (x,y,z) or about an arbitrary axis of rotation. See the examples section below for usage.

Be sure to wrap rotate calls with pushMatrix() and popMatrix() to restore the environment to its original state. Otherwise, all subsequent rendering calls will be rotated.

See the coordinate system tutorial for more information.

syntax

rotateX(rx)
rotateY(ry)
rotateZ(rz)
rotate(angle, axis)

parameters

rx angle of rotation about the x-axis
ry angle of rotation about the y-axis
rz angle of rotation about the z-axis
angle angle of rotation about arbitrary axis
axis axis of rotation

examples

cylinder rotated 90 degrees about the x-axis

def display():
   lighting(False)

   cylinder(1.5, 6.0)

   rotateX(90)
   color(green)
   cylinder(1.5, 6.0)

cylinder rotated 90 degrees about the y-axis

def display():
   lighting(False)

   cylinder(1.5, 6.0)

   rotateY(90)
   color(green)
   cylinder(1.5, 6.0)

cylinder rotated 90 degrees about the z-axis

def display():
   lighting(False)

   cylinder(1.5, 6.0)

   rotateZ(90)
   color(green)
   cylinder(1.5, 6.0)