OUPWPS   

Equivalent PK functions: PK_BSURF_ask_piecewise

OUPWPS ( bs, basis, coeffs, dim, uorder, vorder, ncol, nrow, sense, ifail )
===========================================================================

  Output B-surface in piecewise form

Receives:
  KI_tag_b_surface         *bs             --- B-surface
  KI_cod_slba              *basis          --- representation method

Returns:
  KI_tag_list_dbl          *coeffs         --- vectors defining the surface
  KI_int_dimension         *dim            --- dimension of defining vectors
  KI_int_order             *uorder         --- order of surface in u
  KI_int_order             *vorder         --- order of surface in v
  KI_int_nitems            *ncol           --- number of columns of patches
  KI_int_nitems            *nrow           --- number of rows of patches
  KI_cod_logical           *sense          --- surface sense
  KI_cod_error             *ifail          --- failure indicator

Specific errors:
  KI_bad_order              order must be four for Hermite basis

Description:
  This function outputs a B-surface in a piecewise form chosen by the user. The
  following methods of representing the data are available:

   o Bezier                       ('basis' = SLBABZ)
   o Polynomial                   ('basis' = SLBAPY)
   o Hermite (bicubic only)       ('basis' = SLBAHE)
   o Taylor series                ('basis' = SLBATA)

  Coefficient data 'coeffs':
  . Contains ('uorder' * 'vorder' * 'ncol' * 'nrow') vectors of dimension 'dim'.
    If 'dim'=3, then the vectors are 3-D vectors giving the x, y and z
    components. If 'dim'=4, then each vector has a weight (w) associated with
    it, and x, y, z and w components are returned for each vector.
  . The data is returned patch by patch, row by row.
  . The interpretation of the patch data depends on the representation method
    chosen; this is determined by the value of the argument 'basis'.

    The expressions for each patch of the B-surface P(u,v) in the various
    representations are given below. For generality, the rational form is
    given. The simplification to the non-rational form can be obtained by
    setting the weights equal.

  . Bezier vertices SLBABZ:

    The equation of a rational Bezier surface patch is:

                       nu  nv                         nu nv
                       --  --                       / -- --
          P(u,v)   =   >   >   b (u) b (v) w  V    /  >  >  b (u) b (v) w
                       --  --   i     j     ij ij /   -- --  i     j     ij
                      i=0 j=0                        i=0 j=0

          where nu  = 'uorder'-1, nv = 'vorder'-1
                V   = Bezier vertex
                 ij
                w   = weight for V
                 ij               ij
                b (u), b (v) = Bezier coefficients.
                 i      j
    For the rational form the Bezier vertices and weights are returned:
    V  ,w  ,V  ,w  ,...,V  ,w  ,V  ,w  ,...,V  ,w  ,...,V  ,w  ,...,V  ,w  .
     00  00  10  10      m0  m0  01  01      m1  m1      0n  0n      mn  mn
    For the non-rational form the w's are missed out.


  . Polynomial coefficients SLBAPY:

    The surface equation is given by a rational bipolynomial of orders
    'uorder', 'vorder':

                       nu  nv                    nu nv
                       --  --           i   j  / -- --     i  j
          P(u,v)   =   >   >   w   A   u   v  /  >  >  w   u  v
                       --  --   ij  ij       /   -- --  ij
                      i=0 j=0                   i=0 j=0

          where nu = 'uorder'-1, nv = 'vorder'-1

    For the rational form the polynomial coefficients Aij are returned:
    A  ,w  ,A  ,w  ,...,A  ,w  ,A  ,w  ,...,A  ,w  ,...,A  ,w  ,...,A  ,w
     00  00  10  10      m0  m0  01  01      m1  m1      0n  0n      mn  mn
    starting with the constant term and ending with the term of highest degree.
    For the non-rational form the w's are missed out.

  . Hermite coefficients SLBAHE

    This method can only be used for bicubics.
    The Hermite equation for the patch in matrix form is:

                          2  3       T       2 3  T
                   ( 1 u u  u ) M A M ( 1 v v v )
          P(u,v) = --------------------------------
                          2  3       T       2 3  T
                   ( 1 u u  u ) M W M ( 1 v v v )

          where M = (  1  0  0  0  )
                    (  0  0  1  0  )
                    ( -3  3 -2 -1  )
                    (  2 -2  1  1  )

                A = ( w00*P00   w01*P01   wv00*Pv00   wv01*Pv01  )
                    ( w10*P10   w11*P11   wv10*Pv10   wv11*Pv11  )
                    ( wu00*Pu00 wu01*Pu01 wuv00*Puv00 wuv01*Puv01 )
                    ( wu10*Pu10 wu11*Pu11 wuv10*Puv10 wuv11*Puv11 )

                W = ( w00  w01  wv00  wv01 )
                    ( w10  w11  wv10  wv11 )
                    ( wu00 wu01 wuv00 wuv01 )
                    ( wu10 wu11 wuv10 wuv11 )

                and the superscript T denotes the transpose.

    In the matrices A and W, the coefficients P, Pu, Pv and Puv
    are the points at the corners and their derivatives. The w's are the
    corresponding weights and their derivatives. P00 denotes P(0,0), etc.

    For the rational form the coefficients are returned:

    P00,   w00,   P10,   w10,   P01,   w01,   P11,   w11
    Pu00,  wu00,  Pu10,  wu10,  Pu01,  wu01,  Pu11,  wu11
    Pv00,  wv00,  Pv10,  wv10,  Pv01,  wv01,  Pv11,  wv11
    Puv00, wuv00, Puv10, wuv10, Puv01, wuv01, Puv11, wuw11

    For the non-rational form, the w's are missed out.

  . Taylor series SLBATA:

    This method stores the derivatives evaluated u=0, v=0 corner of each patch,
    allowing the surface to be reconstructed as a Taylor series:

                       nu    nv
                       --    --    (i)(j)  (i)(j)  i  j   /
                       >     >    w       P       u  v   /  i! j!
                       --    --
                       i=0   j=0
          P(u,v)   =   ------------------------------------------
                       nu    nv
                       --    --     (i)(j)  i  j   /
                       >     >     w       u  v   /  i! j!
                       --    --
                       i=0  j=0

          where nu = 'uorder'-1, nv = 'vorder'-1

                            i+j
                 (i)(j)    d   P
                P       =  ------ (0,0)
                             i  j
                           du dv

                            i+j
                 (i)(j)    d   w
                w       =  ------ (0,0)
                             i  j
                           du dv

    The point is returned first, followed by the U derivatives in order and
    ending with the derivative of order 'uorder'-1 in U, 'vorder'-1 in V.


  Dimension of coefficient vectors 'dim':
  . For rational surfaces 'dim'=4.
  . For non-rational surfaces 'dim'=3.

  Order of each patch of the surface in u 'uorder', and in v, 'vorder':
  . The order = degree + 1.
  . The minimum order is 2.
  . If the Hermite basis is chosen ('basis' = SLBAHE) then the surface has
    to be bicubic ('uorder' = 'vorder' = 4).

  Surface sense 'sense'
  . If 'sense' is KI_true the surface normal is given by the cross product of
    the first derivatives of the surface with respect the u and v parameters.
    i.e.
             normal = Pu X Pv

  . If 'sense' is KI_false the surface normal is in opposite to that described
    for 'sense' == KI_true.