# Basic objects

###### [ Up ][ VRML Intro ][ VRML Tutorial ][ Basic objects ][ More VRML? ]

In the world of VRML there are four basic object.  The four objects are as follows.

1. The Cone
2. The Cylinder
3. The Cube
4. The Sphere

Any object can be formed by using these objects.

## The Cone

The Cone, sometimes called the "Dunce Cap", is code with two variable height and bottom radius.  The coding for the Cone is as follows...

The # are filled with the specific dimensions of the Cone (i.e. the height and the bottom radius of the Cone).  If you ever want the default size for a VRML object, just leave the {} empty.  If you do not see a Cone within your VRML program when you open the file you are working with, try using this code after bottomRadius and before the }...

parts()

Between the () you can put in either BOTTOM, SIDES, or ALL.  To enter multiple characteristics but putting in a vertical line (|) between characteristics.  The full code for the Cone looks like this...

Cone {height 3.0
parts ()}

This will make a cone of height 3 with a bottom radius of 1.

## The Cylinder

The Cylinder, sometimes called the "Juice Can", is coded similarly to the Cone, but with a radius instead of a bottom radius.  So the coding for the Cylinder is as follows...

The # in the coding are replaced with the dimensions of the Cylinder (i.e. height and radius).  If you want the standard VRML Cylinder you do not need to put any information between the {}s.  If when you try this code and the Cylinder is missing parts use the parts() code.   Like the circle the parts() is coded the same but inside the ()s you use the characteristics of TOP, BOTTOM, SIDES, or ALL.  The coding for the cylinder is as follows...

Cylinder{height 3.0
parts()}

This will make a Cylinder with the height of 3 with a radius of 1.

## The Cube

The cube in VRML is coded with three values: height, width, and depth.  These are the basic dimensions of a cube.  So the Cube is coded like this...

Cube{height # width # depth #}

The # in the code is replaced with the dimensions of the cube(i.e. height, width, and depth).  If you want the VRML standard cube you do not need to put information in the {}s.  This is how the code for the cube would look...

Cube{height 3 width 3 depth 3}

This code will produce a cube with the height of 3, the width of 3, and the depth of 3.

## The Sphere

The sphere is the easiest of the basic VRML objects to code.  All the sphere needs is one variable.  This variable is the radius.   The coding for the sphere is...