Scripting Guide > Three-Dimensional Scenes > Draw Cylinders, Disks, and Spheres
Publication date: 07/08/2024

Draw Cylinders, Disks, and Spheres

There are several pre-defined commands that allow for quick rendering of spheres, cylinders, and disks. The advantage of these commands is not only their ease-of-use, but that they have special lighting properties (their “normals”) built in.

Construct Cylinders, Disks, and Spheres

The following functions construct cylinders, disks, partial disks, and spheres.

Cylinders

Cylinder( baseRadius, topRadius, height, slices, stacks )

baseRadius is the radius of the cylinder’s base. Similarly, topRadius is the radius of the top. height is the height of the cylinder.

Slices can be 10 for a reasonably accurate cylindrical shape. Using QuadricNormals(Smooth) helps the appearance.

Stacks sets the number of vertices available for lighting reflections. Use a larger value for Stacks for accurate “hot-spots”.

Disks

The following expression draws a paper-thin disk with an innerRadius hole in the middle.

Disk( innerRadius, outerRadius, slices, loops )

Like Cylinder, slices controls the accuracy of the curve and loops makes more vertices (for lighting accuracy).

Partial Disk( innerRadius, outerRadius, slices, loops, startAngle, sweepAngle )

The Partial Disk function works like Disk, but with a slice of the disk removed. Specify the part of the disk that is showing using startAngle and sweepAngle.

Spheres

The following function draws a sphere with the specified radius.

Sphere( radius, slices, stacks )

The slices can be thought of as longitudes and stacks as latitudes. About 10 of each make a nicely drawn sphere.

Want more information? Have questions? Get answers in the JMP User Community (community.jmp.com).