|
If you're new to Python A VPython tutorial Pictures of 3D objects Choose a 3D object: Work with 3D objects: Windows, Events, & Files: What's new in Visual 5 VPython web site |
Floating DivisionBy default, Python performs integer division with truncation, so that 3/4 is 0, not 0.75. This is inconvenient when doing scientific computations, and can lead to hard-to-find bugs in programs. You can write 3./4., which is 0.75 by the rules of "floating-point" division. You can change the default so that
3/4 is treated as 0.75. Place this at the start of your program: from __future__ import division There are two underscores ("_" and "_") before "future" and two after. The Visual module converts integers to floating-point numbers for you when specifying attributes of objects: object.pos = (1,2,3) is equivalent to object.pos = (1.,2.,3.) |
||