Chromium Code Reviews| Index: src/core/SkGeometry.cpp |
| diff --git a/src/core/SkGeometry.cpp b/src/core/SkGeometry.cpp |
| index 76d3a3f4f6ccbf2255aa1bff99ca89280c98cdde..da1f702acfb8d9e0e8ce99b1b78b2e10b2bf2818 100644 |
| --- a/src/core/SkGeometry.cpp |
| +++ b/src/core/SkGeometry.cpp |
| @@ -1162,8 +1162,15 @@ int SkBuildQuadArc(const SkVector& uStart, const SkVector& uStop, |
| return pointCount; |
| } |
| -/////////////////////////////////////////////////////////////////////////////// |
| +/////////////////////////////////////////////////////////////////////////////// |
| +// |
| +// NURB representation for conics. Helpful explanations at: |
| +// |
| +// http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.44.5740&rep=rep1&type=ps |
|
reed1
2014/02/21 17:00:04
nit: 80-col
humper
2014/02/21 17:07:21
Done, and fixed a bunch of other 80 col issues in
|
| +// and |
| +// http://www.cs.mtu.edu/~shene/COURSES/cs3621/NOTES/spline/NURBS/RB-conics.html |
| +// |
| // F = (A (1 - t)^2 + C t^2 + 2 B (1 - t) t w) |
| // ------------------------------------------ |
| // ((1 - t)^2 + t^2 + 2 (1 - t) t w) |
| @@ -1173,12 +1180,6 @@ int SkBuildQuadArc(const SkVector& uStart, const SkVector& uStop, |
| // {t^2 (2 - 2 w), t (-2 + 2 w), 1} |
| // |
| -// Take the parametric specification for the conic (either X or Y) and return |
| -// in coeff[] the coefficients for the simple quadratic polynomial |
| -// coeff[0] for t^2 |
| -// coeff[1] for t |
| -// coeff[2] for constant term |
| -// |
| static SkScalar conic_eval_pos(const SkScalar src[], SkScalar w, SkScalar t) { |
| SkASSERT(src); |
| SkASSERT(t >= 0 && t <= SK_Scalar1); |
| @@ -1197,6 +1198,10 @@ static SkScalar conic_eval_pos(const SkScalar src[], SkScalar w, SkScalar t) { |
| return SkScalarDiv(numer, denom); |
| } |
| + |
| +// Take the parametric specification for the conic (either X or Y) and return |
|
reed1
2014/02/21 17:00:04
This comment does not go with deriv_coeff, but per
humper
2014/02/21 17:07:21
Done.
|
| +// in coeff[] the coefficients for the simple quadratic polynomial |
| +// |
| // F' = 2 (C t (1 + t (-1 + w)) - A (-1 + t) (t (-1 + w) - w) + B (1 - 2 t) w) |
| // |
| // t^2 : (2 P0 - 2 P2 - 2 P0 w + 2 P2 w) |
| @@ -1442,3 +1447,11 @@ void SkConic::computeTightBounds(SkRect* bounds) const { |
| void SkConic::computeFastBounds(SkRect* bounds) const { |
| bounds->set(fPts, 3); |
| } |
| + |
| +// Find the parameter value where the conic takes on its maximum curvature. |
|
reed1
2014/02/21 17:00:04
Lets hoist this comment out to the header.
humper
2014/02/21 17:07:21
Done.
|
| +// Returns true if the max curvature is inside the 0..1 parameter range, |
| +// otherwise returns false and leaves its t parameter unchanged. |
| +bool SkConic::findMaxCurvature(SkScalar* t) const { |
| + // TODO: Implement me |
| + return false; |
| +} |