


Matrix Creation(1)   Volvis Library Routines   Matrix Creation(1)



NAME
     C_identity3D, C_scale3D, C_translate3D,  C_rotate3D  -  rou-
     tines to create a transformation matrix


SYNOPSIS
      # include <math.h>
      # include "VolVis.h"

      C_identity3D( M )
      C_Matrix      *M;

      C_scale3D( sx, sy, sz, M )
      float         sx, sy, sz;
      C_Matrix      *M;

      C_translate3D( tx, ty, tz, M )
      float         tx, ty, tz;
      C_Matrix      *M;

      C_rotate3D( axis, angle, M )
      char          axis;
      float         angle;
      C_Matrix      *M;


PARAMETERS
      M             the matrix returned by the routine

      sx            expects the x scale factor
      sy            expects the y scale factor
      sz            expects the z scale factor

      tx            expects the x translation factor
      ty            expects the y translation factor
      tz            expects the z translation factor

      axis          expects the axis of rotation.  The three
                    valid values for this parameter are:

                         X_AXIS to indicate the x-axis
                         Y_AXIS to indicate the y-axis
                         Z_AXIS to indicate the z-axis

      angle         expects the angle (in radians) of rotation










VolVis 0.1        Last change: January 20, 1992                 1






Matrix Creation(1)   Volvis Library Routines   Matrix Creation(1)



DESCRIPTION
     The matrix M returned by each of these  routines  is  a  4x4
     matrix  using  a modified homogeneous coordinate representa-
     tion of points  in  3-space.  In  a  homogeneous  coordinate
     representation, a point in 3-space is denoted by the quadru-
     ple (x, y, z, w), which is equivalent  to  the  point  (x/w,
     y/w,  z/w)  in  the  standard representation of a point.  In
     VolVis, this homogeneous coordinate representation is  modi-
     fied so that w is always 1.  Therefore the homogeneous coor-
     dinate (x, y, z, 1) is  just  (x,  y,  z)  in  the  standard
     representation.   Using  a  4x4  matrix  for transformations
     allows the VolVis system to  incorporate  translations  into
     the transformation matrix, which would not be possible using
     the standard 3x3 matrix.

     C_identity3D returns the following identity matrix in M:

                             |1  0  0  0|
                             |0  1  0  0|
                             |          |
                             |0  0  1  0|
                             |0  0  0  1|
                             |          |
     C_scale3D returns the following scale matrix in M:

                           |sx  0   0   0|
                           |0   sy  0   0|
                           |             |
                           |0   0   sz  0|
                           |0   0   0   1|
                           |             |
     C_translate3D returns the following translation matrix in M:

                           |1   0   0   0|
                           |0   1   0   0|
                           |             |
                           |0   0   1   0|
                           |tx  ty  tz  1|
                           |             |
     C_rotate3D returns the a rotation matrix in M, depending  on
     the value of axis.

       If axis is X_AXIS, M is:

                   |1       0           0       0|
                   |0  cos(angle)   sin(angle)  0|
                   |                             |
                   |0  -sin(angle)  cos(angle)  0|
                   |0       0           0       1|
                   |                             |





VolVis 0.1        Last change: January 20, 1992                 2






Matrix Creation(1)   Volvis Library Routines   Matrix Creation(1)



       If axis is Y_AXIS, M is:

                   |cos(angle)  0  -sin(angle)  0|
                   |    0       1       0       0|
                   |                             |
                   |sin(angle)  0  cos(angle)   0|
                   |    0       0       0       1|
                   |                             |
       If axis is Z_AXIS, M is:

                   |cos(angle)   sin(angle)  0  0|
                   |-sin(angle)  cos(angle)  0  0|
                   |                             |
                   |     0           0       1  0|
                   |     0           0       0  1|
                   |                             |

SEE ALSO
     C_transform_point(2),                 C_transform_vector(2),
     C_create_volume_matrices(2),            C_matrix_multiply(2)
     C_copy_matrix(2)


AUTHOR
          Lisa Sobierajski






























VolVis 0.1        Last change: January 20, 1992                 3



