Home

If you're new to Python
and VPython: Introduction

A VPython tutorial

Pictures of 3D objects

Choose a 3D object:

Work with 3D objects:

Windows, Events, & Files:

Vector operations

Graphs

factorial/combin

What's new in Visual 5

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

# 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 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.