Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Unified Diff: src/core/SkGeometry.cpp

Issue 175193003: Stub for conic section max curvature (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/core/SkGeometry.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
+}
« no previous file with comments | « include/core/SkGeometry.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698