Figure 7: A portion of the program that performs the second isometric transform

#include "cips.h"

#define FILL     200
#define FILL2    150
#define MOREROWS 100
#define DEGREESPERRADIAN 57.29577952

short **the_image;
short **out_image;

main(argc, argv)
   int argc;
   char *argv[];
{

   ...

   sina = sin((double)(alpha)/DEGREESPERRADIAN);
   cosa = cos((double)(alpha)/DEGREESPERRADIAN);
   sinb = sin((double)(beta)/DEGREESPERRADIAN);
   cosb = cos((double)(beta)/DEGREESPERRADIAN);

   get_image_size(in_name, &length1, &width1);
   length2 = (double)(width1)*sinb + 
             (double)(length1)*sina + 
             MOREROWS + MOREROWS;
   width2  = (double)(width1)*cosb + 
             (double)(length1)*cosa;

   row0 = MOREROWS/2 + 
          MOREROWS + 
          (double)(width1)*sinb;
   col0 = 0;
   
   create_resized_image_file(in_name, out_name, 
                             length2, width2);

   for(i=0; i<length2; i++)
      for(j=0; j<width2; j++)
         out_image[i][j] = FILL;

   read_image_array(in_name, the_image);

   max = 0;

   for(i=0; i<length1; i++){
      for(j=0; j<width1; j++){
         if(the_image[i][j] > max)
            max = the_image[i][j];
      }  /* ends loop over j */
   }  /* ends loop over i */


   if(max > MOREROWS)
      scale = (float)(max)/(float)(MOREROWS);
   else
      scale = max;

   if(scale < 1.0)
      scale = 1.0;

   for(i=0; i<length1; i++){
      for(j=0; j<width1; j++){

         if(i%space == 0){
            ii = row0 + 
                 (double)(i)*sina - 
                 (double)(j)*sinb;
            jj = col0 + 
                 (double)(i)*cosa + 
                 (double)(j)*cosb;

            out_image[ii][jj] = the_image[i][j];

            height = the_image[i][j]/scale;
            lineup(out_image, ii, ii-height, jj);
            if(value == 0)
               out_image[ii-height][jj] = 0;
            else
               out_image[ii-height][jj] = 
                  the_image[i][j];
         }  /* ends if j mod space */

      }  /* ends loop over j */
   }  /* ends loop over i */

   write_image_array(out_name, out_image);

   ...

}  /* ends main  */



lineup(image, start_row, end_row, column)
   int   start_row, end_row, column;
   short **image;
{
   int i; 
   for(i=start_row; i>end_row; i--)
      image[i][column] = FILL2;
}  /* ends lineup */