Home Pictures of 3D objects
cone
cone

cone The cone object has a circular or elliptical cross section and tapers to a point. The following statement will display a cone with circular cross section with the center of its circular base at (5,2,0), pointing parallel to the x axis with length 12; the wide end of the cone has diameter = 2:

cone( pos=vec(5,2,0),
      axis=vec(1,0,0),
      size=vec(12,2,2) )

If you specify the size to be vec(12,1,2), the cone will have an elliptical cross section.

Here is a full list of attributes for a cone. All 3D objects have all of these attributes, other than arrow and curve:

pos Position: the center of one end of the cone; default = vec(0,0,0).

size The length, width, and height of the cone; default = vec(1,1,1).

axis The axis points in the direction of the length of the cone, default = vec(1,0,0). Only the direction of the axis is meaningful, not its magnitude. The length of the cone 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 cone is "up"; this has only a subtle effect on the 3D appearance of a cone unless the cross section is not circular or a texture is applied; 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