/**************************************

           Code Template for:

           EECS 487  Fall 2003

           Programming Assignment #1

**************************************/
#include <stdio.h>


/* Defined constants */
#define Winter
#define MAX_NAME_LEN 255
#define N_ROWS       100
#define N_COLS       100
#define VIEWX0 	      15
#define VIEWY0        15
#define VIEWX1        85
#define VIEWY1        85

/* Subroutine Prototypes */

extern int WriteImage( char *outfilename, int rows, int cols, unsigned char *pixeldata );
extern int ReadInputData( char *infile, int *numpnts, float **x_pnts, float **y_pnts );
extern int ReadInputData3D( char *infile, int *numpnts, float **x_pnts, float **y_pnts, float **z_pnts)

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

/*w***************  Variable Declarations ********************f03*/
        char            infilename[MAX_NAME_LEN];
        char            outfilename[MAX_NAME_LEN];
        unsigned char   pixeldata[N_ROWS * N_COLS];
        int             err_status;


        int             numpnts, n, i, j;
        float           *x_pnts, *y_pnts, *z_pnts;


/****************** Main Code **********************************/

  if (argc != 3)
  {
     printf("Usage:  pa1 <Input data filename> <Output image filename>\n");
     exit(0);
  }
 
  /* Initialize the error status */
  err_status = 0;

  /* Copy the input data filename to a local variable */
  if (strlen(argv[1]) < MAX_NAME_LEN)
  {
    strcpy(infilename, argv[1]);
  }
  else
  {
    err_status = 1;
  }
 
  /* Copy the output image filename to a local variable */
  if (strlen(argv[2]) < MAX_NAME_LEN)
  {
    strcpy(outfilename, argv[2]);
  }
  else
  {
    err_status = 1;
  }

  /* Init Image array to 0 */
  for (n=0; n<N_ROWS*N_COLS; n++)
    pixeldata[n] = 0;

  /* For 2D data */
  err_status = ReadInputData( infilename, &numpnts, &x_pnts, &y_pnts );
  
  /* For 3D data  uncomment to use! */
/*  err_status = ReadInputData( infilename, &numpnts, &x_pnts, &y_pnts, &z_pnts);*/
 

/******************** Your Code Goes Here ********************/



/*w****************** End of your code *********************f03*/




  /* Write data array out to an image file */
  if (!err_status)
  {
     err_status = WriteImage( outfilename, N_ROWS, N_COLS, pixeldata ); 
  }

}
