Home

   Overview of Python & VPython

  "Welcome to VPython" tutorial

  Introductory Videos

  Pictures of 3D objects

  

  

  

  VPython 7 web site
  VPython license

pyramid
pyramid

The pyramid object has a rectangular cross section and tapers to a point. The following statement will display a pyramid with the center of the rectangular base at (5,2,0), pointing parallel to the x axis with a base that is 6 high (in y), 4 wide (in z), and with a length 12 from base to tip:

pyramid(pos=vector(5,2,0), size=vector(12,6,4))

The pyramid object has the following attributes and default values, like those for cylinders: pos which is the center of the rectangular base 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 pyramid attributes:

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 vector(1,1,1)
mypyramid.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 a 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.