Next: , Previous: grid3, Up: Base modules


7.31 solids

This solid geometry package defines a structure revolution that can be used to fill and draw surfaces of revolution. The following example uses it to display the outline of a circular cylinder of radius 1 with axis O--1.5unit(Y+Z) with perspective projection:

import solids;

size(0,100);

revolution r=cylinder(O,1,1.5,Y+Z);
r.draw(heavygreen);
cylinderskeleton.png

Further illustrations are provided in the example files cylinder.asy, sphere.asy, cones.asy, hyperboloid.asy, and torus.asy.

The structure skeleton contains the three-dimensional wireframe used to visualize a volume of revolution (here longitudinal refers to those segments that are parallel to the axis of revolution; transverse segments are perpendicular to the axis of revolution):

struct skeleton {
  // transverse skeleton
  front3[] front;
  front3[] back;
  // longitudinal skeleton
  front3[] longitudinal;
}