Lines Matching refs:curve
51 * A scalar (float-valued weights) Bezier curve of arbitrary degree.
57 /** Creates an empty curve with invalid degree. */
60 /** Creates a curve of the specified degree with weights initialized to 0. */
66 /** Creates a curve of specified degree with the given weights. */
86 /** Evaluates the curve at t */
89 /** Evaluates the curve at t */
90 static float Eval(const ScalarBezCurve& curve, float t) {
92 ScalarBezCurve result = curve;
94 for (int k = 1; k <= curve.fDegree; k++) {
96 for (int i = curve.fDegree; i >= k; i--) {
101 return result.fWeights[curve.fDegree];
104 /** Splits this curve at t into two halves (of the same degree) */
109 /** Splits this curve into the subinterval [tmin,tmax]. */
118 /** Splits the curve at t into two halves (of the same degree) */
119 static void Split(const ScalarBezCurve& curve,
124 const int degree = curve.fDegree;
125 ScalarBezCurve result = curve;
128 left->fWeights[0] = curve.fWeights[0];
129 right->fWeights[degree] = curve.fWeights[degree];
143 * Increases the degree of the curve to the given degree. Has no effect if the
158 * Increases the degree of the curve to the given degree. Has no effect if the
163 static ScalarBezCurve ElevateDegree(const ScalarBezCurve& curve, int newDegree) {
164 SkASSERT(newDegree >= curve.degree());
165 if (newDegree == curve.degree()) {
166 return curve;
171 const int r = newDegree - curve.fDegree;
172 const int n = curve.fDegree;
179 elevated.fWeights[i] += curve.fWeights[j] * f;
187 * Returns the zero-set of this curve, which is a list of t values where the curve crosses 0.
192 * Returns the zero-set of the curve, which is a list of t values where the curve crosses 0.
194 static std::vector<float> ZeroSet(const ScalarBezCurve& curve) {
197 ZeroSetRec(curve, 0, 1, kTol, &result);
201 /** Multiplies the curve's weights by a constant value */
202 static ScalarBezCurve Mul(const ScalarBezCurve& curve, float f) {
203 ScalarBezCurve result = curve;
204 for (int k = 0; k <= curve.fDegree; k++) {
213 * Degree of resulting curve is the sum of the degrees of the input curves.
261 /** Subtracts the other curve from this curve */
269 /** Subtracts a constant from this curve */
276 /** Returns the curve degree */
279 /** Returns the curve weights */
287 static void ZeroSetRec(const ScalarBezCurve& curve,
293 bool allPos = curve.fWeights[0] >= 0, allNeg = curve.fWeights[0] < 0;
294 for (int i = 1; i <= curve.fDegree; i++) {
295 lenP += std::abs(curve.fWeights[i] - curve.fWeights[i - 1]);
296 allPos &= curve.fWeights[i] >= 0;
297 allNeg &= curve.fWeights[i] < 0;
309 ScalarBezCurve left(curve.fDegree), right(curve.fDegree);
310 Split(curve, 0.5f, &left, &right);
462 * Returns a list of quad segments that approximate the offset curve.
485 /** Returns the degree of a segment curve */
685 // Compute control polygon for the delta(t) curve. First must elevate to a common degree.
704 // Subtract dist squared curve from E, resulting in: