Home

If you're new to Python
and VPython see more
Help at glowscript.org

Pictures of 3D objects

 
ellipsoid
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=vector(x0,y0,z0),
          length=L, height=H, width=W)

You can also make an ellipsoid simply by specifying the size of a sphere as vector(length, height, width), where length, height, and width aren't all the same.

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.pos.x, myell.pos.y, and myell.pos.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 = vector(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=vector(x0,y0,z0),
                  axis=vector(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 vector(0,0,0), axis vector(1,0,0), length (1), color (1,1,1) which is color.white, red (1), green (1), blue (1), opacity (1), shininess (0.6), emissive (False), texture, 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 vector(length, height, width), default is vector(1,1,1)
myell.size=vector(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.

If you include make_trail=True when you create the object, a trail will be left behind the object as you move it. For related options, see Leaving a Trail.

See Rotating an Object for an easy way to change the orientation of an object.

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