Purpose:

The cylinder node is another of the shape Nodes. It provides you with a primitive object known as simple capped cylinder. The cylinder is centered around the y-axis. The default for this node has the cylinder centered at (0,0,0) with a size of -1 to +1 in all three dimensions. You can change the radius and height field variables to create cylinders with different sizes.

Syntax

PARTS
SIDES The cylindrical part
TOP The top circular face
BOTTOM The bottom circular face
ALL All parts

FILE FORMAT/DEFAULTS
Cylinder {
parts ALL #
SFBitMask
radius 1 #
SFFloat
height 2 #
SFFloat
}

Explanation

As with other nodes of this type, the cylinder is transformed by the current cumulative transformation and drawn with the current material and texture.

If the current material binding is not PER_PART or PER_PART_INDEXED, the first material is used for the entire cylinder. If the material binding is one of these two, the first current material is used for the sides of the cylinder, the second is used for the top, and the third is used for the bottom.

When applying textures to a cylinder, the texture is applied in different ways to the sides, the top, and the bottom. For the sides, the texture will wrap in a counterclockwise direction, as you look at it from above, starting at the back of the cylinder. The texture will have a vertical seam along the back side of the cylinder, intersecting the yz-plane.

For the top and bottom, as with the cone node, a circle will be cut out of the texture square and applied to the top or bottom circle. The top texture will appear right side up when the top of the cylinder is tilted toward the +Z axis, or away from your viewpoint. The bottom texture will appear right side up when the top of the cylinder is tilted toward the -Z axis, or toward your viewpoint.

Example Use

The following code fragment is from Cyl.wrl.

Cylinder {	parts ALL
		radius 0.8
		height 3}
See Also

PER_PART, PER_PART_INDEXED