Homework # 3: Parametric Surface (Due Date:Thursday 21/4/2016 by Midnight)

Submission:
Submit your homework via E-learning

Deliverables:
Compress the code files (surface.cpp, Matrix.h, and Matrix.cpp) to one file named StudentID_FirstName.zip

Description:
Implement two of the parametric surfaces methods that we studied in class (Interpolating, Bezier, and B-Spline).

Code skeleton is here: Curve.cpp   Matrix.h   Matrix.cpp

You code should read control points from a input file.
		std::vector<std::vector<Matrix>> vecSurfCtrlPoints;
		
		void init ()
		{
			// read surafce control points
			ifstream in;
			in.open ("Surface10x10.txt", ios::in);
			int numUs, numVs;
			in>>numUs>>numVs;

			for (int i = 0; i < numUs; ++i)
			{
				std::vector vecPoints;
				for (int j = 0; j < numVs; ++j)
				{
					Matrix point (3, 1);
					in>>point.elements[0][0]>>point.elements[1][0]>>point.elements[2][0];
					vecPoints.push_back (point);
				}
				vecSurfCtrlPoints.push_back (vecPoints);
			}

			glClearColor (1.0, 1.0, 1.0, 0.0);	// set display-window color to white
			glEnable (GL_DEPTH_TEST);
		}
		

Assign different (or random) colors to patches

Surface Input files
surface10x10.txt   Surface of 100 control points (7 patches). 10 rows (u's) of 10 columns (v's)

surface4x10.txt   Surface of 40 control points (3 patches). 4 rows (u's) of 10 columns (v's)