4 Co-ordinate Systems

When two graphics packages are used from the same program, one package may interfere with the correct operation of the other. When mixing the NCAR utilities and SGS, both packages manipulate the GKS transformations and so precautions must be taken to avoid interference.

The NCAR documentation refers to “fractional co-ordinates” which in GKS terms are normalized device co-ordinates (NDC). To plot in NCAR fractional co-ordinates with GKS calls, all that is necessary is to select the GKS normalization transformation 0 using the routine GSELNT. To do locator or stroke input in fractional co-ordinates, the GKS normalization transformation 0 must be made the highest priority using the routine GSVPIP.

With the exception of the utilities that plot three-dimensional objects, a two-dimensional “user co-ordinate” system (which may be logarithmic in one or both dimensions) is defined. A set of functions is provided by NCAR to convert points between user co-ordinates and fractional co-ordinates. These functions are:

CFUX( X )
— Returns the X user co-ordinate corresponding to the fractional co-ordinate X.
CFUY( Y )
— Returns the Y user co-ordinate corresponding to the fractional co-ordinate Y.
CUFX( X )
— Returns the X fractional co-ordinate corresponding to the user co-ordinate X.
CUFY( Y )
— Returns the Y fractional co-ordinate corresponding to the user co-ordinate Y.

The use of these functions is illustrated in the example program in Appendix A. These functions are only valid while the GKS transformations set up by the NCAR utilities are still current. When mixing NCAR calls with SGS or GKS calls it may be necessary to save the normalization transformation immediately after the NCAR call (using the GKS routine GQNT) and restore it before using NCAR again (using the GKS routines GSWN and GSVP). Note that calling any SGS zone selection routine will always correctly restore the state of SGS.

If you use SGS_OPEN to open the GKS workstation, the entire NDC unit square will not usually be mapped onto the display surface. This is an inescapable consequence of making the whole display surface available for plotting and means that the area of NDC (or fractional co-ordinates) used by the utilities must be changed from the default. The method described here demonstrates how to make the utilities plot in the current zone. When the current zone is the base zone, this is equivalent to plotting on the whole workstation.

The first step is to inquire the NDC limits of the current zone (SGS always uses normalization transformation number 1):

        REAL VIEWP( 4 )
        REAL WIND( 4 )
  
        CALL GQNT( 1, IERR, WIND, VIEWP )

The zone limits in NDC are now stored in the array VIEWP. The next step depends on the utility being used:

AUTOGRAPH
        CALL AGSETP( ’GRAPH.’, VIEWP, 4 )
CONRAN,CONRAS,CONRAQ
        CALL CONOP1( ’SCA=PRI’ )
EZMAP
        CALL MAPPOS( VIEWP( 1 ), VIEWP( 2 ), VIEWP( 3 ), VIEWP( 4 ) )
HSTGRM
        CALL HSTOPR( ’WIN’, VIEWP, 4 )
THREED
        CALL SET3( VIEWP( 1 ), VIEWP( 2 ), VIEWP( 3 ), VIEWP( 4 ), ...

The plotting area used by HAFTON, STRMLN and the CONREC family is controlled by variables in common blocks (see the individual routine documentation for details). ISOSRF, ISOSRFHR, SRFACE and VELVCT always use the entire unit square.