home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 564a.lha / igensurf_v1.0 / examples / bpatch.cal next >
Text File  |  1991-09-27  |  2KB  |  56 lines

  1. {
  2.     bpatch.cal: Create a bezier patch
  3.  
  4.     These functions computes a bezier patch when given three functions
  5.     Px(i,j), Py(i,j) and Pz(i,j) which returns the x, y and z components
  6.     of control point (i,j).
  7.  
  8.     Normally you would define Px, Py and Pz in another file, and use a
  9.     command like this:
  10.  
  11.     igensurf -v bpatch.cal data.cal | WriteTDDD > bpatch.obj
  12.  
  13. }
  14.  
  15.  
  16. x(u,v) = patch(u,v,Px);
  17. y(u,v) = patch(u,v,Py);
  18. z(u,v) = patch(u,v,Pz);
  19.  
  20. patch(u,v,p) =
  21.     bezier(
  22.         bezier(p(0,0), p(0,1), p(0,2), p(0,3), v),    
  23.         bezier(p(1,0), p(1,1), p(1,2), p(1,3), v),
  24.         bezier(p(2,0), p(2,1), p(2,2), p(2,3), v),
  25.         bezier(p(3,0), p(3,1), p(3,2), p(3,3), v),
  26.         u);
  27.  
  28. { --------------------------------------------------------
  29.  
  30.     This is an example of the three functions which must be supplied 
  31.     to the bpatch routines.
  32.  
  33.     The patch created by these values is a part of the UTAH teapot.
  34.     teapot.cal contain all the definitions necessary to build the
  35.     teapot.
  36.  
  37.     Px(i,j) = select( i*4+j+1,
  38.          1.500000, 1.500000, 0.840000, 0.000000,
  39.          1.750000, 1.750000, 0.980000, 0.000000,
  40.          2.000000, 2.000000, 1.120000, 0.000000,
  41.          2.000000, 2.000000, 1.120000, 0.000000
  42.     );
  43.     Py(i,j) = select( i*4+j+1,
  44.          0.000000, -0.840000, -1.500000, -1.500000,
  45.          0.000000, -0.980000, -1.750000, -1.750000,
  46.          0.000000, -1.120000, -2.000000, -2.000000,
  47.          0.000000, -1.120000, -2.000000, -2.000000
  48.     );
  49.     Pz(i,j) = select( i*4+j+1,
  50.          2.400000, 2.400000, 2.400000, 2.400000,
  51.          1.875000, 1.875000, 1.875000, 1.875000,
  52.          1.350000, 1.350000, 1.350000, 1.350000,
  53.          0.900000, 0.900000, 0.900000, 0.900000
  54.     );
  55. ----------------------------------------------------------------- }
  56.