home *** CD-ROM | disk | FTP | other *** search
/ Altsys Virtuoso 2.0K / virtuoso_20k.iso / DemoApps / Graphics / 2D_3D / Tester3D / Source / Linear3D.h < prev    next >
Encoding:
Text File  |  1990-07-04  |  2.1 KB  |  85 lines

  1. /* Linear3D.h */
  2.  
  3. #import "Transformation3D.h"
  4.  
  5. #define L3D_X_AXIS 0
  6. #define L3D_Y_AXIS 1
  7. #define L3D_Z_AXIS 2
  8.  
  9.     /*
  10.         these are constants to be used when calling rotate to choose an
  11.         axis. 
  12.     */
  13.         
  14. @interface Linear3D:Transformation3D
  15. {
  16.     float coeff[4][3];
  17. }
  18.     /*
  19.         coeff is the coefficients of the transformation matrix
  20.         and the translation.
  21.     */
  22.  
  23. +new;
  24.  
  25.     /* initializes coeff such that the transformation is the identity */
  26.  
  27.  
  28. - operateOn:(vector3D *)theVect;
  29.  
  30.     /* 
  31.         will perform matrix multiplication with the vector3D pointed to by
  32.         theVect, using the first three rows of the array coeff as a 3D 
  33.         matrix, and adding the fourth as a translation vector.
  34.         It will leave the result in the vector3D pointed to by theVect.
  35.     */
  36.     
  37. - operateOn:(vector3D *)theVects howMany:(int)count;
  38.  
  39.     /* 
  40.         will perform the same operation as operateOn: to the array of vector3D
  41.         pointed to by theVects. It will leave the array itself modified.
  42.     */
  43.  
  44. - concatBefore:aLinear;
  45. - concatAfter:aLinear;
  46.  
  47.     /* 
  48.         These methods combine the receiver with another Linear3D transformation
  49.         in such a way the the receiver will be modified to perform both
  50.         operations in succession, by doing simple matrix multiplication. 
  51.         concatBefore: will make the receiver a 
  52.         Linear3D such that it performs the receiver's original operation first,
  53.         and aLinear's second. concatAfter: causes the receiver to perform it's
  54.         original operation after aLinear's.
  55.     */
  56.  
  57. - rotation:(int)axis:(float)angle;
  58.  
  59.     /* 
  60.         causes the values in coeff to be set such that it represents a rotation
  61.         transformation of angle degrees, around the axis determined by axis
  62.         using the constants L3D_X_AXIS,L3D_Y_AXIS and L3D_Z_AXIS.
  63.     */
  64.         
  65.  
  66. - scaling:(float)x:(float)y:(float)z;
  67.  
  68.     /* 
  69.         causes the values in coeff to be set such that it represents a scaling
  70.         transformation,where x,y,z represent the scaling in each direction.
  71.     */
  72.  
  73. - translation:(float)x:(float)y:(float)z;
  74.  
  75.     /* 
  76.         causes the values in coeff to be set such that it represents a
  77.         translation transformation.
  78.     */
  79.  
  80. - (float)coefficient:(int)row column:(int)column;
  81.  
  82.     /* returns coeff[row][column] */
  83.     
  84. @end
  85.