Home | Pictures of 3D objects

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=vec(5,2,0), size=vec(12,6,4)) Here is a full list of attributes for a pyramid. All 3D objects have all of these attributes, other than arrow and curve: pos Position: the center of one end of the pyramid; default = vec(0,0,0). size The length, width, and height of the pyramid; default = vec(1,1,1). axis The axis points in the direction of the length of the pyramid, default = vec(1,0,0). Only the direction of the axis is meaningful, not its magnitude. The length of the pyramid, from base to tip, is size.x, not the magnitude of the axis. color Color of object, as a red-green-blue (RGB) triple: vec(1,0,0) is the same as color.red, default = vec(1,1,1), which is color.white. opacity Opacity of object, default = 1 (fully opaque); 0 is completely transparent. shininess 0 to 1, default 0.6; governs the amount of specular reflections. emissive If True, local and distant lights are ignored, and the brightness is governed by the object's own color. An example of its use is to put an emissive sphere at the location of a local_light, which looks like a glowing lamp. The default for emissive is False. up Which side of the pyramid is "up"; default = vec(0,1,0). visible If False, object is not displayed; e.g. obj.visible = False Use obj.visible = True to make the object visible again. texture You can specify a texture to apply to the object's surface. See the Textures documentation. End vs center: The pos attribute for arrow, cone, cylinder, helix, and pyramid corresponds to one end of the object, whereas for a box, ring, or sphere it corresponds to the center of the object. To display a trail or an arrow along the path of a moving object, see Attach a trail or arrow. See Rotating an Object for an easy way to change the orientation of an object. When you run a program, for convenience GlowScript creates a canvas on the web page and names it scene. Objects that you create are drawn on this canvas. If you have more than one canvas, you can specify in which canvas to place a new object, as in box(canvas=myscene); in JavaScript this would be box( {canvas:myscene} ). If you don't specify a canvas, the new object goes into the most recently created canvas, or the most recently selected canvas as specified by setting canvas.selected. JavaScript See the cylinder documentation for how to create an object in JavaScript.

Top of page