Skip to content

Instantly share code, notes, and snippets.

@horstjens
Created December 10, 2020 16:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save horstjens/e16c2f6330cba9c0eb508997502ada38 to your computer and use it in GitHub Desktop.
Save horstjens/e16c2f6330cba9c0eb508997502ada38 to your computer and use it in GitHub Desktop.
vpython test
from vpython import *
import math
scene.title = "VPython: Draw a rotating cube"
scene.range = 2
scene.autocenter = True
print("Drag with right mousebutton to rotate view.")
print("Drag up+down with middle mousebutton to zoom.")
deg45 = math.radians(45.0) # 0.785398163397
cube = box() # using defaults, see http://www.vpython.org/contents/docs/defaults.html
cube.rotate( angle=deg45, axis=(1,0,0) )
cube.rotate( angle=deg45, axis=(0,0,1) )
while True: # Animation-loop
rate(50)
cube.rotate( angle=0.005, axis=(0,1,0) )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment