Saturday 26 February 2011

Vpython

Vpython is an "add-on" to the programming language, Python, which alows you to easily put 3D objects onto the screen, and move them around. The Python programming language is very easy to learn, as opposed to some of the more difficult (but more powerful)  programming languages, such as C++. VPython actually doesn't need much knowledge of the Python language to create decent programs, but it does help in some situations, and even if you get stuck, you can check both the Python help documentation, or the VPython documentation.

An example of a double pendulum, created in VPython, whose code is included when you install VPython 

















There are loads of features to VPython, including:
- 3D objects, such as a box, sphere, helix (springs),pyramids,arrows, and more.
- Change the position, the size, the colour, and the materials (such as wood and plastic) of the 3D objects.
- Add lights to the scene and move the camera any way you want.
- Add buttons, sliders, and drop-down menus to give a wider variety of user control.
- Control of objects using vectors, including the magnitude and the dot and cross products.
- Draw graphs in a separate graphs window, where you can control any of the variables.

For more information, you can go to the official VPython website at http://www.vpython.org/

To install the latest version of VPython, you can go to the download pages here:

You need Python installed to run VPython. You can get Python here: http://www.python.org/download/
On that page you will get a list of all the Python versions that are available. To choose one, go to your relevent VPython page shown above (for Windows,Mac, or Linux) and it will tell you which version of Python you need there.

Next week I will show you how to create a simple simulation - a bouncing ball.

No comments:

Post a Comment