| 101 | point *output)*/ |
| 102 | |
| 103 | void BSpline2D::Evaluate(float pct, float* x, float* y) |
| 104 | { |
| 105 | if (mUVals == NULL) |
| 106 | Calculate(); |
| 107 | |
| 108 | int k; |
| 109 | float temp; |
| 110 | |
| 111 | int n = (int) mInputPoints.size(); |
| 112 | int t = (int)mInputPoints.size() - 3; // ???? |
| 113 | t = 1; |
| 114 | |
| 115 | Point2D* control = &mInputPoints[0]; |
| 116 | |
| 117 | // initialize the variables that will hold our outputted point |
| 118 | |
| 119 | float oX = 0; |
| 120 | float oY = 0; |
| 121 | |
| 122 | for (k=0; k<=n; k++) |
| 123 | { |
| 124 | temp = blend(t,t,mUVals,pct); // same blend is used for each dimension coordinate |
| 125 | oX = oX + (control[k]).mX * temp; |
| 126 | oY = oY + (control[k]).mY * temp; |
| 127 | } |
| 128 | |
| 129 | *x = oX; |
| 130 | *y = oY; |
| 131 | } |