*-----------------------------------------------------------------------
*     uvUNIT
*-----------------------------------------------------------------------
      SUBROUTINE uvUNIT

      EQUIVALENCE ( VXULOC , IVXLOC ), ( VYULOC , IVYLOC )
      EQUIVALENCE ( UXUNIT , IUXUNI ), ( UYUNIT , IUYUNI )

      logical lclip

*     / GET INTERNAL PARAMETERES /

      CALL uvPGET('IUNDEF',IUNDEF)
      CALL uvPGET('INDEX',INDEX )

*     / INQUIRE NORMALIZATION TRANSFORMATION /

      call sgqtrn ( itr )
      call sgqwnd ( ux1, ux2, uy1, uy2 )
      call sgqvpt ( vx1, vx2, vy1, vy2 )

*     / deactivate viewport clipping if active /

      call sglget ( 'LCLIP', lclip )
      if ( lclip ) then
         call sglset ( 'LCLIP', .FALSE. )
      end if

*     / DETERMINE LOCATION OF UNIT VECTORS IN NDC /

      CALL uvPGET('VXULOC',VXULOC)
      IF (IVXLOC.EQ.IUNDEF) THEN
        CALL uvPGET('VXUOFF',VXOFF)
        VXULOC=VX2+VXOFF
        CALL uvPSET('VXULOC',VXULOC)
      END IF

      CALL uvPGET('VYULOC',VYULOC)
      IF (IVYLOC.EQ.IUNDEF) THEN
        CALL uvPGET('VYUOFF',VYOFF)
        VYULOC=VY1+VYOFF
        CALL uvPSET('VYULOC',VYULOC)
      END IF

*     / DETERMINE LENGTH OF UNIT VECTORS IN NDC /

      CALL uvPGET('UXUNIT',UXUNIT)
      CALL uvPGET('XFACT2',XFACT2)
      IF (IUXUNI.EQ.IUNDEF) THEN
        CALL uvPGET('VXUNIT',VXUNIT)
        UXUNIT=VXUNIT/XFACT2
        CALL uvPSET('UXUNIT',UXUNIT)
      ELSE
        VXUNIT=UXUNIT*XFACT2
        CALL uvPSET('VXUNIT',VXUNIT)
      END IF

      CALL uvPGET('UYUNIT',UYUNIT)
      CALL uvPGET('YFACT2',YFACT2)
      IF (IUYUNI.EQ.IUNDEF) THEN
        CALL uvPGET('VYUNIT',VYUNIT)
        UYUNIT=VYUNIT/YFACT2
        CALL uvPSET('UYUNIT',UYUNIT)
      ELSE
        VYUNIT=UYUNIT*YFACT2
        CALL uvPSET('VYUNIT',VYUNIT)
      END IF

*     / DRAW UNIT VECTORS /

      UVX1=VXULOC
      UVX2=VXULOC+VXUNIT
      UVY1=VYULOC
      UVY2=VYULOC+VYUNIT
*
      CALL SGLAZV(UVX1,UVY1,UVX2,UVY1,1,INDEX)
      CALL SGLAZV(UVX1,UVY1,UVX1,UVY2,1,INDEX)

*     / reset clipping status as before /

      call sglset ( 'LCLIP', lclip )
      return

      END
