VPython Reference: Difference between revisions
Jump to navigation
Jump to search
(Created page with "Created by Shuyang Chen VPython reference page for animation functions and constants. This page assumes and only includes basic usage of VPython. == VPython Template == <no...") |
|||
Line 26: | Line 26: | ||
=== Sphere === | === Sphere === | ||
[http://vpython.org/contents/docs/sphere.html Advanced] | |||
==== Example ==== | ==== Example ==== | ||
ball = sphere(pos=(1,2,3), radius=0.4, color=color.blue) | ball = sphere(pos=(1,2,3), radius=0.4, color=color.blue) | ||
Line 37: | Line 38: | ||
| pos | | pos | ||
| vector | | vector | ||
| Position of the | | Position of the object | ||
|- | |||
| color | |||
| color | |||
| Color of the object | |||
|- | |||
| opacity | |||
| number | |||
| Opacity of the object | |||
|- | |||
| make_trail | |||
| boolean | |||
| Whether or not to leave behind a trail | |||
|} | |||
=== Arrow === | |||
[http://vpython.org/contents/docs/arrow.html Advanced] | |||
==== Example ==== | |||
arr = arrow(pos=(1,2,3), axis=(4,5,6), color=color.red) | |||
==== Parameters ==== | |||
{| class="wikitable" | |||
|- | |||
! Parameter | |||
! Type | |||
! Description | |||
|- | |||
| pos | |||
| vector | |||
| Position of the object | |||
|- | |- | ||
| axis | | axis | ||
| vector | | vector | ||
| | | Direction the arrow is pointing at | ||
|- | |- | ||
| color | | color | ||
| color | | color | ||
| Color of the | | Color of the object | ||
|- | |- | ||
| opacity | | opacity | ||
| number | | number | ||
| Opacity of the | | Opacity of the object | ||
|- | |||
| shaftwidth | |||
| number | |||
| Width of the shaft (default: 0.1*(length of arrow)) | |||
|- | |||
| headwidth | |||
| number | |||
| Width of the head (default: 2*shaftwidth) | |||
|- | |||
| headlength | |||
| number | |||
| Length of the head (default: 3*shaftwidth) | |||
|- | |- | ||
| make_trail | | make_trail | ||
Line 55: | Line 97: | ||
| Whether or not to leave behind a trail | | Whether or not to leave behind a trail | ||
|} | |} | ||
==Examples== | ==Examples== |
Revision as of 18:39, 5 December 2015
Created by Shuyang Chen
VPython reference page for animation functions and constants. This page assumes and only includes basic usage of VPython.
VPython Template
from __future__ import division from visual import * ## Constants ## Initialization ## Loop t = 0 deltat = 1e-10 end = 10 while t < end: rate(1000) ## Loop Code t += deltat
VPython Animation Functions
Sphere
Example
ball = sphere(pos=(1,2,3), radius=0.4, color=color.blue)
Parameters
Parameter | Type | Description |
---|---|---|
pos | vector | Position of the object |
color | color | Color of the object |
opacity | number | Opacity of the object |
make_trail | boolean | Whether or not to leave behind a trail |
Arrow
Example
arr = arrow(pos=(1,2,3), axis=(4,5,6), color=color.red)
Parameters
Parameter | Type | Description |
---|---|---|
pos | vector | Position of the object |
axis | vector | Direction the arrow is pointing at |
color | color | Color of the object |
opacity | number | Opacity of the object |
shaftwidth | number | Width of the shaft (default: 0.1*(length of arrow)) |
headwidth | number | Width of the head (default: 2*shaftwidth) |
headlength | number | Length of the head (default: 3*shaftwidth) |
make_trail | boolean | Whether or not to leave behind a trail |
Examples
Be sure to show all steps in your solution and include diagrams whenever possible
Simple
Middling
Difficult
Connectedness
- How is this topic connected to something that you are interested in?
- How is it connected to your major?
- Is there an interesting industrial application?
History
Put this idea in historical context. Give the reader the Who, What, When, Where, and Why.
See also
Are there related topics or categories in this wiki resource for the curious reader to explore? How does this topic fit into that context?
Further reading
Books, Articles or other print media on this topic
External links
References
This section contains the the references you used while writing this page