!=====================================================================
! NG3D: THREED, SRFACE, and ISOSRF Utilities to Drawing
!       3-D objects, Surfaces and Isosurfaces
!=====================================================================
!
! A. THREED, Drawing 3-D objects
!
!    NG_D3INIT - Defines the transformation (Optional RZERO argument, the
!                viewing distance, added by CNCARG) [SET3, the original name]
!
!    NG_D3FRST - Moves to new starting point for a sequence of line draws [FRST3]
!    NG_D3VECT - Draws a line from current position to a new position [VECT3]
!    NG_D3LINE - Draws the projection of a straight-line segment [LINE3]
!
!    NG_D3CURV - Draws the projection of a curve [CURVE3]
!    NG_D3PERI - Draws the projection of a rectangular perimeter [PERIM3]
!                *** 7 optional arguments added by CNCARG
!    NG_D3FENC - Draws the projection of a curve with "fence" [FENCE3]
!                *** 2 optional arguments added by CNCARG
!    NG_D3POIN - Draws the projection of a point. [POINT3]
!
!    NG_D3PWRZ - Plots characters in 3-space when using the THREED routine. [PWRZT]
!
! B. SRFACE, Drawing Surface
!
!    NG_SRSET1 - Set internal parameters (added by CNCARG)
!    NG_SRGET1 - Get internal parameters (added by CNCARG)
!    NG_SRRSET - Reset internal paranmeters (added by CNCARG)
!
!    NG_EZSRFC - Simpler alternative for drawing a surface
!                (working array argument removed by CNCARG)
!
!    NG_SRFACE - Draws a surface
!                (working array arguments removed by CNCARG)
!
!    NG_SRSETR - Overlays THREED and SRFACE plots. [SETR, the original name]
!
!    NG_SRPWRZ - Plots characters in 3-space when using the SRFACE routine. [PWRZS]
!
! C. ISOSRF, Drawing Isosurface
!
!    NG_ISSETI - Sets integer parameters.
!    NG_ISSETR - Sets real parameters.
!    NG_ISGETI - Gets integer parameters.
!    NG_ISGETR - Gets real parameters.
!    NG_ISRSET - Reset all parameters. (added by CNCARG)
!
!    NG_EZISOS - Simpler alternative for drawing an isosurface
!                (working array argument removed by CNCARG)
!
!    NG_ISOSRF - Draws an isosurface
!                (working array arguments removed by CNCARG)
!
!    NG_ISPWRZ - Plots characters in 3-space when using ISOSRF. [PWRZI, the original name]
!
!=====================================================================
! A. THREED, Drawing 3-D objects
!=====================================================================
!
! NG_D3INIT - Defines the transformation (Optional RZERO argument, the
!             viewing distance, added by CNCARG) [SET3, the original name]
!
! NG_D3FRST - Moves to new starting point for a sequence of line draws [FRST3]
! NG_D3VECT - Draws a line from current position to a new position [VECT3]
! NG_D3LINE - Draws the projection of a straight-line segment [LINE3]
!
! NG_D3CURV - Draws the projection of a curve [CURVE3]
! NG_D3PERI - Draws the projection of a rectangular perimeter [PERIM3]
!             *** 7 optional arguments added by CNCARG
! NG_D3FENC - Draws the projection of a curve with "fence" [FENCE3]
!             *** 2 optional arguments added by CNCARG
! NG_D3POIN - Draws the projection of a point. [POINT3]
!
! NG_D3PWRZ - Plots characters in 3-space when using the THREED routine. [PWRZT]
!
!---------------------------------------------------------------------
!
! SUBROUTINE NG_D3INIT( XMIN, XMAX, YMIN, YMAX, UMIN, UMAX, VMIN, VMAX, &
!                       WMIN, WMAX, PEYE, RZERO )
!
! Routine to establish the projection transformation from the object
! 3-sapce coordinates (U,V,W) to viewport 2-space coordinates (X,Y).
!
! Variables :
!
!   XMIN, XMAX: REA, INTENT(IN)
!               the minimum and maximum X values of 2-space
!               viewport (X,Y) coordinates
!
!   YMIN, YMAX: REAL, INTENT(IN)
!               the minimum and maximum Y values of 2-space
!               viewport (X,Y) coordinates
!
!   XMIN, XMAX, YMIN, and YMAX are measured in fractional coordinates
!   defining the portion of the viewport into which 3-D objects are to
!   be projected. Each has a value between 0. and 1., inclusive.
!   Examples: To use the whole viewport, set XMIN=0.0, XMAX=1.0,
!   YMIN=0., and YMAX=1.; to use the upper left quarter of the viewport,
!   set XMIN=0.0, XMAX=0.5, YMIN=0.5, and YMAX=1.0
!
!   UMIN, UMAX: REAL, INTENT(IN)
!               the minimum and maximum U values of 3-space
!               object (U,V,W) coordinates.
!
!   VMIN, VMAX: REAL, INTENT(IN)
!               the minimum and maximum V values of 3-space
!               object (U,V,W) coordinates.
!
!   WMIN, WMAX: REAL, INTENT(IN)
!               the minimum and maximum W values of 3-space
!               object (U,V,W) coordinates.
!
!   UMIN, VMIN, WMIN, UMAX, VMAX, and WMAX are the limiting coordinates,
!   in a 3-D coordinate space of the user's choosing, of the rectangular
!   box that is to be projected. This box normally contains all of the
!   objects whose projections are to be drawn.
!
!   PEYE      : REAL, with dimension (3), INTENT(IN)
!               the (U,V,W) coordinates of the eye position
!               from which the 3-space object are viewed.
!               The coordinates of eye should be outside the
!               block defined by box with corners (UMIN,VMIN,WMIN)
!               and (UMAX,VMAX,WMAX).
!
!   RZERO     : REAL, INTENT(IN), OPTIONAL
!               the distance between the observer and the point
!               looked at (center of the box by default) when
!               the picture is to fill the screen when viewed
!               from the direction which makes the box biggest.
!               RZERO is thus to be used to determine the shape
!               of the object. If RZERO is not positive (or not
!               PRESENT) then the relative size feature is turned
!               off, and subsequent pictures will fill the screen.
!
! Note: Optional argument RZERO added by CNCARG
!
!---------------------------------------------------------------------
!
! SUBROUTINE NG_D3FRST( U, V, W )
!
! Routine to secifiy the first in a sequence of points connected by
! straight-line segments, the projections of which are to be drawn.
! (NG_D3FRST is called for the first point in the sequence and NG_D3VECT
! is called for the rest.)
!
! Variables:
!
!   U, V, W : REAL, INTENT(IN)
!             The U, V, and W coordinates of a point in 3-space.
!
!---------------------------------------------------------------------
!
! SUBROUTINE NG_D3VECT( U, V, W )
!
! Routine to define the second and all subsequent points in a sequence
! of points connected by straight-line segments, the projections of
! which are to be drawn. (NG_D3FRST is called for the first point in
! the sequence and NG_D3VECT is called for the rest.)
!
! Variables:
!
!   U, V, W : REAL, INTENT(IN)
!             The U, V, and W coordinates of a point in 3-space.
!
!---------------------------------------------------------------------
!
! SUBROUTINE NG_D3LINE( UA, VA, WA, UB, VB, WB )
!
! Routine to draw draw the projection of the straight line segment
! joining two points in 3-space.
!
! Variables:
!
!   UA, VA, WA : REAL, INTENT(IN)
!                The U, V, and W coordinates of a point in 3-space.
!
!   UB, VB, WB : REAL, INTENT(IN)
!                The U, V, and W coordinates of another point in 3-space.
!
!---------------------------------------------------------------------
!
! SUBROUTINE NG_D3CURV( U, V, W, N )
!
! Routine to draw the projection of a curve defined by an array of
! points in 3-space.
!
! Variables :
!
!   U, V, W : REAL, with dimension (NCRV), INTENT(IN)
!             arrays containing the 3-space coordinates of the points
!             defining the curve.
!
!   N       : INTEGER, INTENT(IN)
!             specifying the number of points defining the curve.
!
!---------------------------------------------------------------------
!
! SUBROUTINE NG_D3FENC( U, V, W, N, IORENT, BOTTOM, IFENCE, ICURVE )
!
! Routine to draw a curve in 3-space as well as a "fence" between the
! curve and a plane normal to one of the coordinates axes.
! *** 2 optional arguments added by CNCARG
!
! Variables :
!
!   U, V, W : REAL, with dimension (N), INTENT(IN)
!             the 3-space (U,V,W) coordinates of points
!             of the curve to de drawed.
!
!   N       : INTEGER, INTENT(IN)
!             the number of points of the arrays U, V,
!             and W to be used in drawing the curve and
!             the fence.
!
!   IORENT  : INTEGER, INTENT(IN)
!             the direction in which the fence lines are
!             to be drawn.
!             =1, indicates parallel to the U axes
!             =2, indicates parallel to the V axes
!             =3, indicates parallel to the W axes
!
!   BOTTOM  : REAL, INTENT(IN)
!             the bottom plane location of the fence is to
!             be drawn. If the fence lines are to be drawn
!             parallel to the W axes, and BOTTOM is given a
!             value of 2.0, then the bottom of the fence
!             would be the plane W=2.0.
!
!-----------
!
!   IFENCE : INTEGER, OPTIONAL, INTENT(IN)
!            Specify the color index for fence.
!            Default is current "Polyline" color if argument not present
!
!   ICURVE : INTEGER, OPTIONAL, INTENT(IN)
!            Specify the color index for curve.
!            Default is current "Polyline" color if argument not present
!
!---------------------------------------------------------------------
!
! SUBROUTINE NG_D3PERI( MAJOR1, MINOR1, MAJOR2, MINOR2, IAXIS , VALUE ,&
!                       MAJTK1, MINTK1, MAJTK2, MINTK2, MAJTKC, MINTKC, PERIMC )
!
! Routine NG_D3PERI is used to draw a perimeter in a plane perpendicular
! to one of the three axes in the 3-D coordinate system.
! *** 7 optional arguments added by CNCARG
!
! Variables:
!
!   MAJOR1 : INTEGER, INTENT(IN)
!            Specifies the number of major divisions of those sides of
!            the perimeter parallel to direction 1. (Directions 1 and 2
!            are defined by the value of IAXIS.) Major divisions are
!            indicated by tick marks.
!
!   MINOR1 : INTEGER, INTENT(IN)
!            Specifies the number of minor divisions per major division
!            along those sides of the perimeter parallel to direction 1.
!            (Directions 1 and 2 are defined by the value of IAXIS.)
!            Minor divisions are indicated by tick marks that, by default,
!            are smaller than the tick marks indicating major divisions.
!
!   MAJOR2 : INTEGER, INTENT(IN)
!            Specifies the number of major divisions of those sides of
!            the perimeter parallel to direction 2. (Directions 1 and 2
!            are defined by the value of IAXIS.)
!
!   MINOR2 : INTEGER, INTENT(IN)
!            Specifies the number of minor divisions per major division
!            along those sides of the perimeter parallel to direction 2.
!            (Directions 1 and 2 are defined by the value of IAXIS.)
!
!   IAXIS  : INTEGER, INTENT(IN)
!            Specifies which of the three axes the perimeter is to be
!            perpendicular to and identifies directions 1 and 2:
!              1 - The perimeter is to be perpendicular to the U axis.
!                  Direction 1 is parallel to the V axis and direction
!                  2 is parallel to the W axis.
!              2 - The perimeter is to be perpendicular to the V axis.
!                  Direction 1 is parallel to the U axis and direction
!                  2 is parallel to the W axis.
!              3 - The perimeter is to be perpendicular to the W axis.
!                  Direction 1 is parallel to the U axis and direction
!                  2 is parallel to the V axis.
!
!   VALUE  : REAL, INTENT(IN)
!            The value at which the plane of the perimeter is to
!            intersect the axis specified by IAXIS. If IAXIS is a 1,
!            VALUE is a U coordinate; if IAXIS is a 2, VALUE is a V
!            coordinate; and, if IAXIS is a 3, VALUE is a W coordinate.
!
!-----------
!
!   MAJTK1 : INTEGER, OPTIONAL, INTENT(IN)
!            Specifies the length of major ticks of those sides of the
!            perimeter parallel to direction 1.
!            Default value is 12 for argument not present.
!
!   MINTK1 : INTEGER, OPTIONAL, INTENT(IN)
!            Specifies the length of minor ticks of those sides of the
!            perimeter parallel to direction 1.
!            Default value is 8 for argument not present.
!
!   MAJTK2 : INTEGER, OPTIONAL, INTENT(IN)
!            Specifies the length of major ticks of those sides of the
!            perimeter parallel to direction 2.
!            Default value is 12 for argument not present.
!
!   MINTK2 : INTEGER, OPTIONAL, INTENT(IN)
!            Specifies the length of minor ticks of those sides of the
!            perimeter parallel to direction 2.
!            Default value is 8 for argument not present.
!
!            Note: Tick lengths are specified as integers between 0 and 1024.
!                  The value n produces a tick that is n/1024ths as long as
!                  the longest side of the box defined by the arguments UMIN,
!                  UMAX, VMIN, VMAX, WMIN, and WMAX in the call to NG_D3INIT.
!
!   MAJTKC : INTEGER, OPTIONAL, INTENT(IN)
!            Specify the color index of major ticks to be used on perimeters.
!            Default is current "Polyline" color if argument not present
!
!   MINTKC : INTEGER, OPTIONAL, INTENT(IN)
!            Specify the color index of minor ticks to be used on perimeters.
!            Default is current "Polyline" color if argument not present
!
!   PERIMC : INTEGER, OPTIONAL, INTENT(IN)
!            Specify the color index to be used on perimeters.
!            Default is current "Polyline" color if argument not present
!
!---------------------------------------------------------------------
!
! SUBROUTINE NG_D3POIN( U, V, W )
!
! Routine to draw the projection of a point.
!
! Variables:
!
!   U, V, W : REAL, INTENT(IN)
!             The U, V, and W coordinates of a point whose projection
!             is to be drawn.
!
! Note: Each point is drawn by calling the SPPS routine NG_POINT to
! draw a little "X".
!
!---------------------------------------------------------------------
!
! SUBROUTINE NG_D3PWRZ( X, Y, Z, ID, N, ISIZE, LIN3, ITOP, ICNT )
!
! Routine NG_D3PWRZ is a character plotting routine for plotting
! characters in three-space when using THREED.  For a large class of
! possible positions, the hidden character problem is solved.
!
! Variables:
!
!   REAL,         INTENT(IN) :: X, Y, Z
!   CHARACTER(*), INTENT(IN) :: ID
!   INTEGER,      INTENT(IN) :: N, ISIZE, LIN3, ITOP, ICNT
!
!   X,Y,Z
!     Positioning coordinates for the characters
!     to be drawn.  These are floating point
!     numbers in the same three-space as used in
!     THREED.
!
!   ID
!     Character string to be drawn.  ID is of type
!     CHARACTER .
!
!   N
!     The number of characters in ID.
!
!   ISIZE
!     Size of the character:
!     .  If between 0 and 3, ISIZE is 1., 1.5,
!        2., OR 3. times a standard width equal
!        to 1/128th of the screen width.
!     .  If greater than 3, ISIZE is the character
!        width in plotter address units.
!
!   LIN3
!     The direction in which the characters are to
!     be written.
!       1 = +X     -1 = -X
!       2 = +Y     -2 = -Y
!       3 = +Z     -3 = -Z
!
!   ITOP
!     The direction from the center of the first
!     character to the top of the first
!     character (the potential values for
!     ITOP are the same as those for LIN3 as
!     given above.)  Note that LIN3 cannot
!     equal ITOP even in absolute value.
!
!   ICNT
!     Centering option.
!     -1 (X,Y,Z)  is the center of the left edge of
!                 the first character.
!     0  (X,Y,Z)  is the center of the entire
!                 string.
!     1  (X,Y,Z)  is the center of the right edge
!                 of the last character.
!
!=====================================================================
! B. SRFACE, Drawing Surface
!=====================================================================
!
! NG_SRSET1 - Set internal parameters (added by CNCARG)
! NG_SRGET1 - Get internal parameters (added by CNCARG)
! NG_SRRSET - Reset internal paranmeters (added by CNCARG)
!
! NG_EZSRFC - Simpler alternative for drawing a surface
!             (working array argument removed by CNCARG)
!
! NG_SRFACE - Draws a surface
!             (working array arguments removed by CNCARG)
!
! NG_SRSETR - Overlays THREED and SRFACE plots. [SETR, the original name]
!
! NG_SRPWRZ - Plots characters in 3-space when using the SRFACE routine. [PWRZS]
!
!---------------------------------------------------------------------
!
! SUBROUTINE NG_EZSRFC( Z, M, N, ANGH, ANGV )
!
! Routine to draw a perspective picture of a surface stored in a two
! dimensional array via a very short argument list.
!
! Variables:
!
!   INTEGER, INTENT(IN) :: M, N
!   REAL,    INTENT(IN) :: Z(M,N)
!   REAL,    INTENT(IN) :: ANGH, ANGV
!
!   Z    the 2 dimensional array to be drawn.
!
!   M    the first dimension of z.
!
!   N    the second dimension of z.
!
!   ANGH angle in degrees in the x-y plane to the line of sight
!        (counter-clock wise from the plus-x axis).
!
!   ANGV angle in degrees from the x-y plane to the line of sight
!        (positive angles are above the middle z, negative below).
!
! Assumptions--
!     The entire array is to be drawn,
!     The data is equally spaced (in the x-y plane),
!     No stereo pairs.
! If these assumptions are not met use NG_SRFACE.
!
!---------------------------------------------------------------------
!
! SUBROUTINE NG_SRFACE( X, Y, Z, MX, NX, NY, S, STEREO )
!
! Routine to draw a perspective picture of a function of two
! variables with hidden lines removed.  The function is approximated
! by a two-dimensional array of heights.
!
! Variables:
!
!   INTEGER, INTENT(IN) :: MX, NX, NY
!   REAL,    INTENT(IN) :: X(NX), Y(NY), Z(MX,NY)
!   REAL,    INTENT(IN) :: S(6), STEREO
!
!   X
!     A linear array NX long containing the X
!     coordinates of the points in the surface
!     approximation, in increasing numerical order.
!     See note, below.
!
!   Y
!     A linear array NY long containing the Y
!     coordinates of the points in the surface
!     approximation, in increasing numerical order.
!     See note, below.
!
!   Z
!     An array MX by NY containing the surface
!     to be drawn in NX by NY cells.
!     Z(I,J) = F(X(I),Y(J)).  See note, below.
!
!   MX
!     First dimension of Z.
!
!   NX
!     Number of data values in the X direction
!     (the first subscript direction) in Z.
!     to be plotted. When plotting an entire
!     array, MX=NX.
!
!   NY
!     Number of data values in the Y direction
!     (the second subscript direction) to be
!     plotted.
!
!   S
!     S defines the line of sight.  The viewer's
!     eye is at (S(1), S(2), S(3)) and the
!     point looked at is at (S(4), S(5), S(6)).
!     The eye should be outside the block with
!     opposite corners (X(1), Y(1), ZMIN) and
!     (X(NX), Y(NY), ZMAX) and the point looked
!     at should be inside it.  For a nice
!     perspective effect, the distance between
!     the eye and the point looked at should be
!     5 to 10 times the size of the block.  See
!     note, below.
!
!   STEREO
!     Flag to indicate if stereo pairs are to
!     be drawn.  0.0 means no stereo pair (one
!     picture).  Non-zero means put out two
!     pictures.  The value of STEREO is the
!     relative angle between the eyes.  A value
!     of 1.0 produces standard separation.
!     Negative STEREO reverses the left and
!     right figures.  See the documentation below
!     for internal variable ISTP for additional
!     information.
!
! Notes:
!
!   . The range of Z compared with the range
!     of X and Y determines the shape of the
!     picture.  They are assumed to be in the
!     same units and not wildly different in
!     magnitude.  S is assumed to be in the
!     same units as X, Y, and Z.
!
!   . Picture size can be made relative to
!     distance.  See comments in NG_SRSETR.
!
!   . Data with extreme discontinuities may
!     cause visibility errors.  If this problem
!     occurs, use a distant eye position
!     away from the +Z axis.
!
!---------------------------------------------------------------------
!
! SUBROUTINE NG_SRSETR( XMIN, XMAX, YMIN, YMAX, ZMIN, ZMAX, R0 )
!
! Routine to establishe certain constants so that NG_SRFACE produces a
! picture whose size changes with respect to the viewers distance from
! the object.  It can also be used when making a movie of an object
! evolving in time to keep it positioned properly on the screen, saving
! computer time in the bargin.  call it with "R0" negative to turn off
! this feature.
!
! Variables:
!
!   REAL, INTENT(IN) :: XMIN, XMAX, YMIN, YMAX, ZMIN, ZMAX, R0
!
!   XMIN,XMAX - Range of x array that will be passed to NG_SRFACE.
!
!   YMIN,YMAX - Same idea, but for y.
!
!   ZMIN,ZMAX - Same idea, but for z.  If a movie is being
!               made of an evolving z array, zmin and zmax
!               should contain range of the union of all the z
!               arrays.  They need not be exact.
!
!   R0        - Distance between observer and point looked at
!               when the picture is to fill the screen when
!               viewed from the direction which makes the pic-
!               ture biggest.  If "R0" is not positive, then the
!               relative size feature is turned off, and sub-
!               sequent pictures will fill the screen.
!
!---------------------------------------------------------------------
!
! SUBROUTINE NG_SRPWRZ( X, Y, Z, ID, N, ISIZE, LIN3, ITOP, ICNT )
!
! Routine NG_SRPWRZ is a character plotting routine for plotting
! characters in three-space when using SRFACE package.  For a large
! class of possible positions, the hidden character problem is solved.
!
! Variables:
!
!   REAL,         INTENT(IN) :: X, Y, Z
!   CHARACTER(*), INTENT(IN) :: ID
!   INTEGER,      INTENT(IN) :: N, ISIZE, LIN3, ITOP, ICNT
!
!   X,Y,Z
!     Positioning coordinates for the characters
!     to be drawn.  These are floating point
!     numbers in the same three-space as used in
!     SRFACE.
!
!   ID
!     Character string to be drawn.  ID is of type
!     CHARACTER .
!
!   N
!     The number of characters in ID.
!
!   ISIZE
!     Size of the character:
!     .  If between 0 and 3, ISIZE is 1., 1.5,
!        2., or 3. times a standard width equal
!        to 1/128th of the screen width.
!     .  If greater than 3, ISIZE is the character
!        width in plotter address units.
!
!   LIN3
!     The direction in which the characters are to
!     be written.
!       1 = +X     -1 = -X
!       2 = +Y     -2 = -Y
!       3 = +Z     -3 = -Z
!
!   ITOP
!     The direction from the center of the first
!     character to the top of the first
!     character (the potential values for
!     ITOP are the same as those for LIN3 as
!     given above.)  Note that LIN3 cannot
!     equal ITOP even in absolute value.
!
!   ICNT
!     Centering option.
!     -1 (X,Y,Z)  is the center of the left edge of
!                 the first character.
!     0  (X,Y,Z)  is the center of the entire
!                 string.
!     1  (X,Y,Z)  is the center of the right edge
!                 of the last character.
!
!---------------------------------------------------------------------
! Internal Parameters
!---------------------------------------------------------------------
!
! IFR    : Flag for calling FRame              Integer   1 (no function)
! ISTP   : Stereo flag                         Integer   0
! THETA  : Stereo angle in radians             Real      0.02
! IROTS  : Controls plotting direction         Integer   0
! IDRX   : DRaw lines of constant X flag       Integer   1
! IDRY   : DRaw lines of constant Y flag       Integer   1
! IDRZ   : DRaw lines of constant Z flag       Integer   0
! IUPPER : Draw UPPER/lower/both side flag     Integer   0
! ISKIRT : Draw SKIRT around surface flag      Integer   0
! HSKIRT : Height of SKIRT                     Real      0.0
! NCLA   : Number of Z levels (approximation)  Integer   6
! CHI    : HIghest level of Constant Z         Real      0.0
! CLO    : LOwest level of Constant Z          Real      0.0
! CINC   : INCrement between levels            Real      0.0
! IOFFP  : Special value flag                  Integer   0
! SPVAL  : The SPecial VALue                   Real      0.0
!
! ---> followings added by CNCARG
!
! ICX    : Color index for drawing X-lines     Integer  -1
! ICY    : Color index for drawing Y-lines     Integer  -1
! ICZ    : Color index for drawing Z-lines     Integer  -1
! ICS    : Color index for drawing Skirt       Integer  -1
!
!---------------------------------------
!
! SUBROUTINE NG_SRSET1( IFR   , ISTP  , THETA , IROTS , IDRX  ,&
!                       IDRY  , IDRZ  , IUPPER, ISKIRT, HSKIRT,&
!                       NCLA  , CHI   , CLO   , CINC  , IOFFP ,&
!                       SPVAL , ICX   , ICY   , ICZ   , ICS )
!
! Routine to set internal parameters.
!
! Variables:
!
!   INTEGER, INTENT(IN), OPTIONAL :: IFR
!   INTEGER, INTENT(IN), OPTIONAL :: ISTP
!   REAL,    INTENT(IN), OPTIONAL :: THETA
!   INTEGER, INTENT(IN), OPTIONAL :: IROTS
!   INTEGER, INTENT(IN), OPTIONAL :: IDRX
!   INTEGER, INTENT(IN), OPTIONAL :: IDRY
!   INTEGER, INTENT(IN), OPTIONAL :: IDRZ
!   INTEGER, INTENT(IN), OPTIONAL :: IUPPER
!   INTEGER, INTENT(IN), OPTIONAL :: ISKIRT
!   REAL,    INTENT(IN), OPTIONAL :: HSKIRT
!   INTEGER, INTENT(IN), OPTIONAL :: NCLA
!   REAL,    INTENT(IN), OPTIONAL :: CHI
!   REAL,    INTENT(IN), OPTIONAL :: CLO
!   REAL,    INTENT(IN), OPTIONAL :: CINC
!   INTEGER, INTENT(IN), OPTIONAL :: IOFFP
!   REAL,    INTENT(IN), OPTIONAL :: SPVAL
!   INTEGER, INTENT(IN), OPTIONAL :: ICX
!   INTEGER, INTENT(IN), OPTIONAL :: ICY
!   INTEGER, INTENT(IN), OPTIONAL :: ICZ
!   INTEGER, INTENT(IN), OPTIONAL :: ICS
!
!---------------------------------------
!
! SUBROUTINE NG_SRGET1( IFR   , ISTP  , THETA , IROTS , IDRX  ,&
!                       IDRY  , IDRZ  , IUPPER, ISKIRT, HSKIRT,&
!                       NCLA  , CHI   , CLO   , CINC  , IOFFP ,&
!                       SPVAL , ICX   , ICY   , ICZ   , ICS )
!
! Routine to get internal parameters.
!
! Variables:
!
!   INTEGER, INTENT(OUT), OPTIONAL :: IFR
!   INTEGER, INTENT(OUT), OPTIONAL :: ISTP
!   REAL,    INTENT(OUT), OPTIONAL :: THETA
!   INTEGER, INTENT(OUT), OPTIONAL :: IROTS
!   INTEGER, INTENT(OUT), OPTIONAL :: IDRX
!   INTEGER, INTENT(OUT), OPTIONAL :: IDRY
!   INTEGER, INTENT(OUT), OPTIONAL :: IDRZ
!   INTEGER, INTENT(OUT), OPTIONAL :: IUPPER
!   INTEGER, INTENT(OUT), OPTIONAL :: ISKIRT
!   REAL,    INTENT(OUT), OPTIONAL :: HSKIRT
!   INTEGER, INTENT(OUT), OPTIONAL :: NCLA
!   REAL,    INTENT(OUT), OPTIONAL :: CHI
!   REAL,    INTENT(OUT), OPTIONAL :: CLO
!   REAL,    INTENT(OUT), OPTIONAL :: CINC
!   INTEGER, INTENT(OUT), OPTIONAL :: IOFFP
!   REAL,    INTENT(OUT), OPTIONAL :: SPVAL
!   INTEGER, INTENT(OUT), OPTIONAL :: ICX
!   INTEGER, INTENT(OUT), OPTIONAL :: ICY
!   INTEGER, INTENT(OUT), OPTIONAL :: ICZ
!   INTEGER, INTENT(OUT), OPTIONAL :: ICS
!
!---------------------------------------
!
! SUBROUTINE NG_SRRSET()
!
! Routine to reset all internal parameters to its default values.
!
!=====================================================================
! C. ISOSRF, Drawing Isosurface
!=====================================================================
!
! NG_ISSETI - Sets integer parameters.
! NG_ISSETR - Sets real parameters.
! NG_ISGETI - Gets integer parameters.
! NG_ISGETR - Gets real parameters.
! NG_ISRSET - Reset all parameters.
!
! NG_EZISOS - Simpler alternative for drawing an isosurface
!             (working array argument removed by CNCARG)
!
! NG_ISOSRF - Draws an isosurface
!             (working array arguments removed by CNCARG)
!
! NG_ISPWRZ - Plots characters in 3-space when using ISOSRF. [PWRZI, the original name]
!
!---------------------------------------------------------------------
!
! SUBROUTINE NG_EZISOS( T, MU, MV, MW, EYE, TISO )
!
!   INTEGER, INTENT(IN) :: MU, MV, MW
!   REAL,    INTENT(IN) :: T(MU,MV,MW)
!   REAL,    INTENT(IN) :: EYE(3), TISO
!
! Simpler alternative for drawing an isosurface.
!
! Notes:
!
!   1. The entire array T is to be drawn
!
!   2. The flag IFLAG is chosen internally
!
!---------------------------------------------------------------------
!
! SUBROUTINE NG_ISOSRF( T, LU, MU, LV, MV, MW, EYE, TISO, IFLAG )
!
! Routine to draw a perspective view of the surface defined by the
! equation T(U,V,W)=Tiso, where the function T is approximated by a
! 3-dimensional array of data and Tiso is a user-specified "isovalue".
! Contours created by taking slices in any of three directions through
! the surface are drawn with hidden portions of the contour lines
! removed.
!
! Variables:
!
!   T     : REAL, with dimension (MU,MV,MW), INTENT(IN)
!           Three dimensional array of data that is used to determine
!           the iso-valued surface.
!
!   MU    : INTEGER, INTENT(IN)
!           The number of data values of T to be processed in the U
!           direction
!
!   MV    : INTEGER, INTENT(IN)
!           The number of data values of T to be processed in the V
!           direction
!
!   MW    : INTEGETR, INTENT(IN)
!           The number of data values of T to be processed in the W
!           direction
!
!   EYE   : REAL, with dimension (3), INTENT(IN)
!           The position of the eye in the UVW coordinate system.
!           T is considered to be a box with opposite corners (1,1,1)
!           and (MU,MV,MW). The eye position, at (EYE(1),EYE(2),EYE(3)),
!           must be outside the box containing the data. The point
!           being  looked at is at the center of the data box and the
!           projection plane is perpendicular to the line of sight.
!           While gaining experience with the routine, a good choice
!           for EYE is (5.0*REAL(MU),3.5*REAL(MV),2.0*REAL(MW)).
!
!   TISO  : REAL, INTENT(IN)
!           The iso-value used to define the surface; The surface
!           drawn will reparate volumes of T that have value greater
!           than TISO from volumes of T that have value less than TISO.
!
!   IFLAG : INTEGER, INTENT(IN)
!           A flag which serves two purposes.
!           1. First, The absolute value of IFLAG
!              determines which types of lines are drawn
!              to approximate the surface.  Three types
!              of lines are considered:  lines of
!              constant U, lines of constant V and lines
!              of constant W.  The following table lists
!              the types of lines drawm.
!
!                                 Lines of Constant
!                                 -----------------
!              IABS(IFLAG)        U    V    W
!                   1             No   No   Yes
!                   2             No   Yes  No
!                   3             No   Yes  Yes
!                   4             Yes  No   No
!                   5             Yes  No   Yes
!                   6             Yes  Yes  No
!               otherwise         Yes  Yes  Yes
!
!           2. Second, The sign of IFLAG determines what
!              is inside and what is outside, Hence,
!              which lines are visible and what is done
!              at the boundary of T.  For IFLAG:
!
!              Positive   T values greater than TISO are
!                         assumed to be inside the solid
!                         formed by the drawn surface.
!              Negative   T values less than TISO are
!                         assumed to be inside the solid
!                         formed by the drawn surface.
!              If the algorithm draws a cube, reverse the
!              sign of IFLAG.
!
!---------------------------------------------------------------------
!
! SUBROUTINE NG_ISPWRZ( X, Y, Z, ID, N, ISIZE, LIN3, ITOP, ICNT )
!
! Routine NG_ISPWRZ is a character plotting routine for plotting
! characters in three-space when using ISOSRF.  For a large class
! of possible positions, the hidden character problem is solved.
!
! Variables:
!
!   REAL,         INTENT(IN) :: X, Y, Z
!   CHARACTER(*), INTENT(IN) :: ID
!   INTEGER,      INTENT(IN) :: N, ISIZE, LIN3, ITOP, ICNT
!
!   X,Y,Z
!     Positioning coordinates for the characters
!     to be drawn.  These are floating point
!     numbers in the same three-space as used in
!     ISOSRF.
!
!   ID
!     Character string to be drawn.  ID is of type
!     CHARACTER .
!
!   N
!     The number of characters in ID.
!
!   ISIZE
!     Size of the character:
!     .  If between 0 and 3, ISIZE is 1., 1.5,
!        2., or 3. times a standard width equal
!        to 1/128th of the screen width.
!     .  If greater than 3, ISIZE is the character
!        width in plotter address units.
!
!   LIN3
!     The direction in which the characters are to
!     be written.
!       1 = +X     -1 = -X
!       2 = +Y     -2 = -Y
!       3 = +Z     -3 = -Z
!
!   ITOP
!     The direction from the center of the first
!     character to the top of the first
!     character (the potential values for
!     ITOP are the same as those for LIN3 as
!     given above.)  Note that LIN3 cannot
!     equal ITOP even in absolute value.
!
!   ICNT
!     Centering option.
!     -1 (X,Y,Z)  is the center of the left edge of
!                 the first character.
!     0  (X,Y,Z)  is the center of the entire
!                 string.
!     1  (X,Y,Z)  is the center of the right edge
!                 of the last character.
!
!---------------------------------------------------------------------
! Internal Parameters
!---------------------------------------------------------------------
!
! IU : Number of U-axis Interpolation slabs  Integer  0
! IV : Number of V-axis Interpolation slabs  Integer  0
! IW : Number of W-axis Interpolation slabs  Integer  0
! RF : ReFerence plane drawing flag          Integer  1
! RS : Relative Size flag                    Real     0.0
! SL : Smooth curve segment Length           Real     0.01
! SM : Screen Model resolution               Integer  0
! ST : Spline Tension                        Real     0.0
! SV : Special Value flag                    Integer  0
! VB : Viewport Bottom edge                  Real     0.005
! VL : Viewport Left edge                    Real     0.005
! VR : Viewport Right edge                   Real     0.995
! VT : Viewport Top edge                     Real     0.995
!
! ---> followings added by CNCARG
!
! CU : Color index for drawing V/W slices    Integer  -1
! CV : Color index for drawing U/W slices    Integer  -1
! CW : Color index for drawing U/V slices    Integer  -1
! CR : Color index for drawing W axis/plane  Integer  -1
!
!---------------------------------------
!
! SUBROUTINE NG_ISSETI( PNAM, IVAL )
!
! Routine to st the integer value of the ISOSRF parameter
! named PNAM from IVAL.
!
! Variables:
!
!   CHARACTER(*), INTENT(IN) :: PNAM
!   INTEGER,      INTENT(IN) :: IVAL
!
!---------------------------------------
!
! SUBROUTINE NG_ISSETR( PNAM, RVAL )
!
! Routine to st the real value of the ISOSRF parameter
! named PNAM from RVAL.
!
! Variables:
!
!   CHARACTER(*), INTENT(IN) :: PNAM
!   REAL,         INTENT(IN) :: RVAL
!
!---------------------------------------
!
! SUBROUTINE NG_ISGETI( PNAM, IVAL )
!
! Routine to get in IVAL the integer value of the ISOSRF parameter
! named PNAM.
!
! Variables:
!
!   CHARACTER(*), INTENT(IN   ) :: PNAM
!   INTEGER,      INTENT(  OUT) :: IVAL
!
!---------------------------------------
!
! SUBROUTINE NG_ISGETR( PNAM, RVAL )
!
! Routine to get in RVAL the real value of the ISOSRF parameter
! named PNAM.
!
! Variables:
!
!   CHARACTER(*), INTENT(IN   ) :: PNAM
!   REAL,         INTENT(  OUT) :: RVAL
!
!---------------------------------------
!
! SUBROUTINE NG_ISRSET()
!
! Routine to reset all internal parameters to its default values.
!
!=====================================================================
! Refer "NCAR menu" for interfacing THREED/SRFACE/ISOSRF in detail
!=====================================================================