If you're new to Python
and VPython: Introduction

A VPython tutorial

Pictures of 3D objects

What's new in VPython 6

VPython web site
VPython license
Python web site
Math module (sqrt etc.)
Numpy module (arrays)


This is documentation for Classic VPython (VPython 6), which continues to be available but is no longer supported. See vpython.org for information on installing VPython 7 or using GlowScript VPython. Documentation is available at glowscript.org by clicking Help.

Rotating an Object

Objects other than curve, convex, faces, and points can be rotated about a specified origin (to rotate these other objects, put them in a frame and rotate the frame).

obj.rotate(angle=pi/4, axis=axis, origin=pos)

The rotate function applies a transformation to the specified object (sphere, box, etc.). The transformation is a rotation of angle radians, counterclockwise around the line defined by origin and origin+axis. By default, rotations are around the object's own pos and axis. There are no defaults for the extrusion object, and one must specify all parameters: angle, axis, and origin.

There are functions for converting between degrees and radians, where there are 2*pi radians in 360 degrees:

radians(360) is equal to 2*pi

degrees(2*pi) is equal to 360

Also see the rotation function available for vectors.