!   TITLE:  frac_dist.mac (CALCULATION)
!
!
!   OBJECTIVE:
!
!   This sub-macro calculates the dimension that is a fraction of the distance
!   between 2 specified dimension values.
!
!
!   COMMAND SYNTAX:
!
!                      (1)      (2)    (3)      (4) . . . . . (19)
!        FRAC_DIST, FROM_dim, TO_dim, frac#1, frac#2,......, frac#17
!
!
!   ARGUMENTS:
!
!       (1) FROM_dim = the dimension to measure from.
!
!       (2) TO_dim = the dimension to measure to.
!
!       (N) frac#(N-2) = the fraction of the distance between 'FROM_dim'
!                        and 'TO_dim'. All specified values must be less
!                        than 1, otherwise the algorithm will ignore that
!                        calculation.
!
!
!   DESCRIPTION:
!
!   The dimension is measured a specified fraction of the distance between
!   a start dimension (FROM_dim) toward a finish dimension (TO_dim). This
!   dimension is returned in a variable of the name:
!
!                       d_1  : corresponding to fraction frac#1
!                       d_2  : corresponding to fraction frac#2
!                                       .
!                                       .
!                                       .
!                       d_n  : corresponding to fraction frac#n
!
!   The total number of fractional dimensions that may be calculated is 17.
!   If the desired number of dimensions to be calculated is less than this,
!   the user need only specify the desired fractions, and the remaining
!   arguments will be ignored. (e.g., if only 3 fractional dimensions are
!   desired, then simply specifying those 3 fractions in arguments 3, 4 and
!   5 will return dimensions d_1, d_2 and d_3, respectively.)
!
!
!
*get,prkey_,active,0,prkey
/nopr
!
frmdim_=arg1
todim_=arg2
!
*do,jkl_,3,19,1
    *if,jkl_,lt,10,then
        *if,arg%jkl_%,gt,0,then
            frac%jkl_-2%=arg%jkl_%
        *else
            nfrac_=jkl_-3
            *exit
        *endif
    *else
        *if,ar%jkl_%,gt,0,then
            frac%jkl_-2%=ar%jkl_%
        *else
            nfrac_=jkl_-3
            *exit
        *endif
        !
        *if,jkl_,eq,19,then
            nfrac_=jkl_-2
        *endif
    *endif
*enddo
!
*do,jkl_,1,nfrac_,1
    *if,frac%jkl_%,lt,1,then
        d_%jkl_%=frmdim_+frac%jkl_%*(todim_-frmdim_)
    *endif
    !
    *set,frac%jkl_%,
*enddo
!
*set,frmdim_,
*set,todim_,
*set,jkl_,
*set,nfrac_,
!
*if,prkey_,eq,1,then
    /go
*endif