Commit bb7988518583cc03089894ef75ef74111aacbc98

henry 2001-08-01T22:56:04

Made the FTPOINT type a struct of 3 floats rather than a PAIR<int, int> to make it compatible with gluTess. Made bValues[][] a private member rather than local to evaluateCurve()

diff --git a/include/FTVectoriser.h b/include/FTVectoriser.h
index 3c0d9d5..0d41d9a 100644
--- a/include/FTVectoriser.h
+++ b/include/FTVectoriser.h
@@ -22,7 +22,17 @@ class FTContour
 
 		// attributes
 		
-		typedef pair<int, int> ftPoint;
+//		typedef pair<int, int> ftPoint;
+		struct ftPoint
+		{
+			float x, y, z;
+			ftPoint()
+			: x(0), y(0), z(0){}
+			
+			ftPoint( float X, float Y, float Z)
+			: x(X), y(Y), z(Z){}
+		};
+
 		vector< ftPoint> pointList;
 		float ctrlPtArray[4][2];
 	private:
@@ -53,18 +63,20 @@ class FTVectoriser
 		// methods
 		int Conic( int index, int first, int last);
 		int Cubic( int index, int first, int last);
-		void deCasteljau( GLfloat t, int n, GLfloat bValues[MAX_DEG][MAX_DEG][2]);
+		void deCasteljau( GLfloat t, int n);
 		void evaluateCurve( int n);
 
 		// attributes
-//		typedef pair<int, int> ftPoint;
-//		vector< FT_Vector> pointList;
 		vector< FTContour*> contourList;
 		float ctrlPtArray[4][2];
 			
 		FTContour* contour;
 
 		FT_Outline ftOutline;
+		
+		float bValues[MAX_DEG][MAX_DEG][2];	//3D array storing values
+                                        	//of de Casteljau algorithm.
+
 
 };
 
diff --git a/src/FTVectoriser.cpp b/src/FTVectoriser.cpp
index e21d20b..2e7e21a 100644
--- a/src/FTVectoriser.cpp
+++ b/src/FTVectoriser.cpp
@@ -18,18 +18,19 @@ FTContour::~FTContour()
 
 void FTContour::AddPoint( int x, int y)
 {
-	float fx, fy;
+	float fx, fy, fz;
 	
 	fx = static_cast<float>( x);
 	fy = static_cast<float>( y);
+	fy = 0;
 	
-	pointList.push_back( ftPoint( fx, fy));
+	pointList.push_back( ftPoint( fx, fy, fz));
 
 }
 
 
 // De Casteljau algorithm supplied by Jed Soane
-void FTVectoriser::deCasteljau( GLfloat t, int n, GLfloat bValues[MAX_DEG][MAX_DEG][2])
+void FTVectoriser::deCasteljau( float t, int n)
 {
     int i, k;
 
@@ -48,11 +49,9 @@ void FTVectoriser::deCasteljau( GLfloat t, int n, GLfloat bValues[MAX_DEG][MAX_D
 
 void FTVectoriser::evaluateCurve( int n)
 {
-    GLint m, i;            					//loop counters
-    GLfloat t;            					//parameter for curve point calc. [0.0, 1.0]
-    GLfloat bValues[MAX_DEG][MAX_DEG][2];	//3D array storing values
-                                        	//of de Casteljau algorithm.
-    GLfloat stepSize = 0.2;
+    int m, i;            					//loop counters
+    float t;            					//parameter for curve point calc. [0.0, 1.0]
+    float stepSize = 0.2;
 
     // setting the b(0) equal to the control points
     for (i = 0; i <= n; i++)
@@ -64,7 +63,7 @@ void FTVectoriser::evaluateCurve( int n)
     for (m = 0; m <= (1 / stepSize); m++)
     {
     	t = m * stepSize;
-        deCasteljau( t, n, bValues);  //calls to evaluate point on curve att.
+        deCasteljau( t, n);  //calls to evaluate point on curve att.
     } //end for(m...)
 }
 
@@ -242,9 +241,10 @@ void FTVectoriser::Output( float* data)
 		
 		for( int p = 0; p < contour->size(); ++p)
 		{
-			data[i] = contour->pointList[p].first / 64.0f; // is 64 correct?
-			data[i + 1] = contour->pointList[p].second / 64.0f;
-			i += 2;
+			data[i] = contour->pointList[p].x / 64.0f; // is 64 correct?
+			data[i + 1] = contour->pointList[p].y / 64.0f;
+			data[i + 2] = contour->pointList[p].z / 64.0f;
+			i += 3;
 		}
 	}
 }