Scripting Guide > Three-Dimensional Scenes > Drawing Spheres, Cylinders, and Disks
发布日期: 11/15/2021

Drawing Spheres, Cylinders, and Disks

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.

Construction

The following commands are used to 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 command 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 command 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 command 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.

需要更多信息?有问题?从 JMP 用户社区得到解答 (community.jmp.com).