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)

ellipsoid |

A long ellipsoid object looks like a cigar; a short one looks like somewhat like a pill. Its cross sections are circles or ellipses. The elllipsoid object has the same attributes as the box object and it can be thought of as fitting inside a box of the same dimensions:

myell = ellipsoid(pos=(x0,y0,z0),
length=L, height=H, width=W)

The given position is in the center of the ellipsoid, at (x0, y0, z0). This is different from cylinder, whose pos attribute is at one end of the cylinder. Just as with a cylinder, we can refer to the individual vector components of the ellipsoid as myell.x, myell.y, and myell.z. The length from end to end (along the x axis) is L , the height (along the y axis) is H , and the width is W (along the z axis). For this ellipsoid, we have myell.axis = (L, 0, 0) . Note that the axis of an ellipsoid is just like the axis of a cylinder.

For an ellipsoid that isn't aligned with the coordinate axes, additional issues come into play. The orientation of the length of the ellipsoid is given by the axis (see diagrams shown with the documentation on the box object):

myell = ellipsoid(pos=(x0,y0,z0), axis=(a,b,c),
length=L, height=H, width=W)

The axis attribute gives a direction for the length of the ellipsoid, and the length, height, and width of the ellipsoid are given as before (if a length attribute is not given, the length is set to the magnitude of the axis vector).

The ellipsoid object has the following attributes and default values, like those for cylinders: pos (0,0,0), x (0), y(0), z(0), axis (1,0,0), length (1), color (1,1,1) which is color.white, red (1), green (1), blue (1), opacity (1), material, and up (0,1,0). Additional attributes, similar to those for a box:

height In the y direction in the simple case, default is 1

width In the z direction in the simple case, default is 1

size (length, height, width), default is (1,1,1)
myell.size=(20,10,12) sets length=20, height=10, width=12

Note that the pos attribute for cylinder, arrow, cone, and pyramid corresponds to one end of the object, whereas for an ellipsoid, box, sphere, or ring it corresponds to the center of the object.

See description of Additional Attributes available for all 3D display objects.