main.cc.html
//**************************************************************************
//
// CSE 486 Project #3
// By Anirudh Modi (anirudh@bart.aero.psu.edu) on 3/28/99-Sun
// & Jim Geis (geis@cse.psu.edu)
// & Howard Elikan (elikan@cse.psu.edu)
//
//**************************************************************************
// Have implemented the following ->
// 1. Reading OFF object file format
// 2. Perspective transformation
// 3. Writing image plane as a PPM file
//**************************************************************************
#include <iostream.h>
#include <fstream.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include "image.h"
#include "matrix.h"
#include "offobject.h"
//**************************************************************************
int main (int argc, char *argv[])
{
if (argc != 2)
{
cerr << "Syntax: " << argv[0] << " <object-definition-file>" << endl;
exit(-1);
}
OFFobject object;
object.ReadFromFile(argv[1]);
object.setBoxRange(1.0);
object.setImageSize(256);
//object.setFocalLength(5.0);
object.mapToImagePlane( );
if (object.getNumVerts() < 25)
object.printMappingData( );
object.drawImage( );
object.WriteImageToFile("view.ppm");
}
//**************************************************************************