Clipping and hidden lines in the Spherical Sketch Pad routines

Completely transparent spheres can be confusing in many cases. Computing where to stop drawing lines on a sphere can be somewhere involved, so the spherical sketch pad routines provide two different types of clipping.

Types of clipping

Types of lines

Lines in the hidden hemisphere or behind a specified clipping sphere are called hidden lines. All others are called visible lines.

Visible lines are drawn as solid lines by default. If hidden lines are requested they are drawn with dotted lines by default. Both line styles are controlled by keywords to sphinit:

VIS_STYLE = default linestyle for visible lines (def=0).
HID_STYLE = default linestyle for hidden lines (def=1).

Routines that clip

The spherical sketch pad routines that draw are Each of these routines, by default, draws only visible lines. To draw hidden lines use the keyword /HIDDEN on each of the above routines.

Controlling clipping

Setting the visible hemisphere
The visible hemisphere is actually defined by a plane through the center of the sphere. All lines on the visible side of this plane are drawn by default. All lines on the hidden side of this plane may be drawn using the keyword /HIDDEN to the drawing routines. It is important to understand that hemisphere clipping is actually done by this plane, the surface of the sphere itself is transparent, that is, spheres are visible inside larger spheres, at least the parts on the visible side of the clipping plane. The clipping plane also explains how radial lines are clipped. In most cases it is better to clip radial lines using the MAXRAD=r keyword to the drawing routines. The clipping plane may be ignored using the keyword /ALL which will draw all points on both sides of the clipping plane as if they were visible. Use /ALL instead of /HIDDEN to draw both visible and hidden points.

The visible hemisphere is set on the call to sphinit. By default the visible hemisphere is the front of the sphere. If set to something different for part of the figure it may be set back to the front using the /FRONT keyword on another call to sphinit.

The keyword /TOP set the visible hemisphere to the top of the sphere. When the pole appears on the edge of the sphere the top hemisphere is centered at the top of the sphere as seen by the viewer. As the pole rotates into view, by setting the central latitude higher than 0 (in sphinit), the top hemisphere also rotates toward the viewer.

When the central latitude is 0 /TOP gives:

When the central latitude is 40 /TOP gives:

The visible hemisphere may be controlled in general using two keywords:
VPA = Position angle of visible hemisphere center (def=0).
VAZ = Line of sight ang. of vis. hemisphere center (def=0).
The default values correspond to /FRONT.
Note, a position angle of 0 is directly above the center of the sphere as seen by the viewer. Position angles increase in the CCW direction.
The Line of sight angle is 0 when the center of the visible hemisphere appears in the center of the sphere. It is 90 degrees when the center of the visible hemisphere appears at the edge of the sphere.

Setting a clipping sphere There is no default clipping sphere. A clipping sphere is set by specifying its radius in a call to one of the drawing routines, using the keyword MAXRAD=r. Anything behind this clipping sphere is considered a hidden line. As usual, these hidden lines may be plotted using the keyword /HIDDEN in the drawing routine. Here is an example using MAXRAD.

    erase,40
    sphinit, long=-30, lat=30, rad=.5, fill=80, pa=30,/front
    for lat=-90,90,5 do sphlat,lat,.5
    for r=.7,.9,.03 do sphlat,0,r,color=170,maxrad=.5
    for r=.9,1.1,.03 do sphlat,0,r,color=190,maxrad=.5
The result is:

Multiple clipping

A visible hemisphere is always in effect. Two calls to each drawing routine are needed to draw both visible and hidden lines. A clipping sphere may also be in effect at the same time if specified. Since sphinit may be called any number of times various clipping hemisphere may be set for various parts of a plot. Of course a clipping sphere of any size may be given to the drawing routines, one size could be used for some calls, and another for others.