Removed contourPoint struct
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
diff --git a/include/FTContour.h b/include/FTContour.h
index 2f30f1c..3cb06e0 100644
--- a/include/FTContour.h
+++ b/include/FTContour.h
@@ -6,19 +6,6 @@
#include "FTGL.h"
-struct ContourPoint
-{
- ContourPoint(){}
-
- ContourPoint( FTPoint p, char t)
- : point(p),
- tag(t)
- {}
-
- FTPoint point;
- char tag;
-};
-
/**
* FTContour class is a container of points that describe a vector font
* outline. It is used as a container for the output of the bezier curve
@@ -76,7 +63,7 @@ class FTGL_EXPORT FTContour
*
* @param point The point to be added to the contour.
*/
- void AddPoint( FTPoint point);
+ inline void AddPoint( FTPoint point);
/**
* De Casteljau (bezier) algorithm contributed by Jed Soane
@@ -85,7 +72,7 @@ class FTGL_EXPORT FTContour
* @param curveOrder The order of the curve to be evaluated.
* <code>2</code> equals conic (quadratic) and <code>3</code> equals cubic
*/
- void deCasteljau( const float t, const int curveOrder);
+ inline void deCasteljau( const float t, const int curveOrder);
/**
* De Casteljau (bezier) algorithm contributed by Jed Soane
@@ -93,19 +80,13 @@ class FTGL_EXPORT FTContour
* @param curveOrder The order of the curve to be evaluated.
* <code>2</code> equals conic (quadratic) and <code>3</code> equals cubic
*/
- void evaluateCurve( const int curveOrder);
+ inline void evaluateCurve( const int curveOrder);
/**
*/
// Magic numbers -- #define MAX_DEG 4
float bValues[4][4][2]; //3D array storing values of de Casteljau algorithm.
float ctrlPtArray[4][2]; // Magic numbers
-
- /**
- * Parameterisation step size for De Casteljau algorithm
- */
- const float kBSTEPSIZE;
-
};
#endif // __FTContour__
diff --git a/src/FTContour.cpp b/src/FTContour.cpp
index c812a3b..6863d51 100644
--- a/src/FTContour.cpp
+++ b/src/FTContour.cpp
@@ -2,10 +2,10 @@
static const unsigned int SECOND_ORDER_CURVE = 2;
static const unsigned int THIRD_ORDER_CURVE = 3;
+static const float BEZIER_STEP_SIZE = 0.2f;
FTContour::FTContour( FT_Vector* contour, char* pointTags, unsigned int numberOfPoints)
-: kBSTEPSIZE( 0.2f)
{
for( unsigned int pointIndex = 0; pointIndex < numberOfPoints; ++ pointIndex)
{
@@ -104,8 +104,7 @@ void FTContour::deCasteljau( const float t, const int n)
bValues[i][k][1] = (1 - t) * bValues[i - 1][k][1] + t * bValues[i - 1][k + 1][1];
}
}
-
- //Specify next vertex to be included on curve
+
AddPoint( FTPoint( bValues[n][0][0], bValues[n][0][1], 0.0f));
}
@@ -121,9 +120,9 @@ void FTContour::evaluateCurve( const int n)
float t; //parameter for curve point calc. [0.0, 1.0]
- for( int m = 0; m <= ( 1 / kBSTEPSIZE); m++)
+ for( int m = 0; m <= ( 1 / BEZIER_STEP_SIZE); m++)
{
- t = m * kBSTEPSIZE;
+ t = m * BEZIER_STEP_SIZE;
deCasteljau( t, n); //calls to evaluate point on curve at t.
}
}