      SUBROUTINE QURV2 (T,XS,YS,ZS,N,X,Y,Z,XP,YP,ZP,S,SIGMA)
C
      INTEGER N
      REAL T,XS,YS,ZS,X(N),Y(N),Z(N),XP(N),YP(N),ZP(N),S(N)
      REAL SIGMA
C
C                      FROM THE SPLINE UNDER TENSION PACKAGE
C                       CODED BY A. K. CLINE AND R. J. RENKA
C                            DEPARTMENT OF COMPUTER SCIENCES
C                              UNIVERSITY OF TEXAS AT AUSTIN
C
C THIS SUBROUTINE PERFORMS THE MAPPING OF POINTS IN THE
C INTERVAL (0.,1.) ONTO A CURVE IN SPACE.  THE SUBROUTINE
C QURV1 SHOULD BE CALLED EARLIER TO DETERMINE CERTAIN
C NECESSARY PARAMETERS. THE RESULTING CURVE HAS A PARAMETRIC
C REPRESENTATION ALL OF WHOSE COMPONENTS ARE SPLINES UNDER
C TENSION AND FUNCTIONS OF THE POLYGONAL ARCLENGTH
C PARAMETER.
C
C ON INPUT--
C
C   T CONTAINS A REAL VALUE TO BE MAPPED TO A POINT ON THE
C   CURVE. THE INTERVAL (0.,1.) IS MAPPED ONTO THE ENTIRE
C   CURVE, WITH 0. MAPPING TO (X(1),Y(1,Z(1)) AND 1. MAPPING
C   TO (X(N),Y(N),Z(N)). VALUES OUTSIDE THIS INTERVAL RESULT
C   IN EXTRAPOLATION.
C
C   N CONTAINS THE NUMBER OF POINTS WHICH WERE SPECIFIED
C   TO DETERMINE THE CURVE.
C
C   X, Y, AND Z ARE ARRAYS CONTAINING THE X-, Y- AND Z-
C   COORDINATES OF THE SPECIFIED POINTS.
C
C   XP, YP, AND ZP ARE THE ARRAYS OUTPUT FROM QURV1
C   CONTAINING CURVATURE INFORMATION.
C
C   S IS AN ARRAY CONTAINING THE POLYGONAL ARCLENGTHS OF
C   THE CURVE.
C
C AND
C
C   SIGMA CONTAINS THE TENSION FACTOR (ITS SIGN IS IGNORED).
C
C THE PARAMETERS N, X, Y, Z, XP, YP, ZP, S, AND SIGMA
C SHOULD BE INPUT UNALTERED FROM THE OUTPUT OF QURV1.
C
C ON OUTPUT--
C
C   XS, YS AND ZS CONTAIN THE X-, Y- AND Z-COORDINATES OF
C   THE IMAGE POINT ON THE CURVE.
C
C NONE OF THE INPUT PARAMETERS ARE ALTERED.
C
C THIS SUBROUTINE REFERENCES PACKAGE MODULES INTRVL AND
C SNHCSH.
C
C-----------------------------------------------------------
C
C DETERMINE INTERVAL
C
      TN = S(N)*T
      IM1 = INTRVL(TN,S,N)
      I = IM1+1
C
C DENORMALIZE TENSION FACTOR
C
      SIGMAP = ABS(SIGMA)*FLOAT(N-1)/S(N)
C
C SET UP AND PERFORM INTERPOLATION
C
      DEL1 = TN-S(IM1)
      DEL2 = S(I)-TN
      DELS = S(I)-S(IM1)
      SUMX = (X(I)*DEL1+X(IM1)*DEL2)/DELS
      SUMY = (Y(I)*DEL1+Y(IM1)*DEL2)/DELS
      SUMZ = (Z(I)*DEL1+Z(IM1)*DEL2)/DELS
      IF (SIGMAP .NE. 0.) GO TO 1
      D = DEL1*DEL2/(6.*DELS)
      C1 = (DEL1+DELS)*D
      C2 = (DEL2+DELS)*D
      XS = SUMX-XP(I)*C1-XP(IM1)*C2
      YS = SUMY-YP(I)*C1-YP(IM1)*C2
      ZS = SUMZ-ZP(I)*C1-ZP(IM1)*C2
      RETURN
    1 DELP1 = SIGMAP*(DEL1+DELS)/2.
      DELP2 = SIGMAP*(DEL2+DELS)/2.
      CALL SNHCSH(SINHM1,DUMMY,SIGMAP*DEL1,-1)
      CALL SNHCSH(SINHM2,DUMMY,SIGMAP*DEL2,-1)
      CALL SNHCSH(SINHMS,DUMMY,SIGMAP*DELS,-1)
      CALL SNHCSH (SINHP1,DUMMY,SIGMAP*DEL1/2.,-1)
      CALL SNHCSH (SINHP2,DUMMY,SIGMAP*DEL2/2.,-1)
      CALL SNHCSH (DUMMY,COSHP1,DELP1,1)
      CALL SNHCSH (DUMMY,COSHP2,DELP2,1)
      D = SIGMAP*SIGMAP*DELS*(SINHMS+SIGMAP*DELS)
      C1 = (SINHM1*DEL2-DEL1*(2.*(COSHP1+1.)*SINHP2+SIGMAP*
     *     COSHP1*DEL2))/D
      C2 = (SINHM2*DEL1-DEL2*(2.*(COSHP2+1.)*SINHP1+SIGMAP*
     *     COSHP2*DEL1))/D
      XS = SUMX+XP(I)*C1+XP(IM1)*C2
      YS = SUMY+YP(I)*C1+YP(IM1)*C2
      ZS = SUMZ+ZP(I)*C1+ZP(IM1)*C2
      RETURN
      END
