aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar kbr@chromium.org <kbr@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2010-07-07 22:20:35 +0000
committerGravatar kbr@chromium.org <kbr@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2010-07-07 22:20:35 +0000
commit2e086190e55a01dc2f7b74df6f2828e8cac2b9ab (patch)
tree6a5e3bd62185e01e9d0ad877a095a902d1436c99 /include
parent40408614655c4057d93842c9b0f09aa6dfff9e02 (diff)
Added optional "ambiguous" outgoing argument to XRay queries so that
calling code may choose different y-coordinates for better robustness. Tested and verified manually inside O3D. BUG=none TEST=none Review URL: http://codereview.appspot.com/1695051 git-svn-id: http://skia.googlecode.com/svn/trunk@586 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r--include/core/SkGeometry.h21
1 files changed, 16 insertions, 5 deletions
diff --git a/include/core/SkGeometry.h b/include/core/SkGeometry.h
index b8ab74caef..a20978326d 100644
--- a/include/core/SkGeometry.h
+++ b/include/core/SkGeometry.h
@@ -26,10 +26,13 @@
*/
typedef SkPoint SkXRay;
-/** Given a line segment from pts[0] to pts[1], and ax xray, return true if
- they intersect.
+/** Given a line segment from pts[0] to pts[1], and an xray, return true if
+ they intersect. Optional outgoing "ambiguous" argument indicates
+ whether the answer is ambiguous because the query occurred exactly at
+ one of the endpoints' y coordinates, indicating that another query y
+ coordinate is preferred for robustness.
*/
-bool SkXRayCrossesLine(const SkXRay& pt, const SkPoint pts[2]);
+bool SkXRayCrossesLine(const SkXRay& pt, const SkPoint pts[2], bool* ambiguous = NULL);
/** Given a quadratic equation Ax^2 + Bx + C = 0, return 0, 1, 2 roots for the
equation.
@@ -155,8 +158,12 @@ int SkChopCubicAtMaxCurvature(const SkPoint src[4], SkPoint dst[13], SkScalar tV
left of the curve, the line is not considered to cross the curve,
but if it is equal to cubic[3].fY then it is considered to
cross.
+ Optional outgoing "ambiguous" argument indicates whether the answer is
+ ambiguous because the query occurred exactly at one of the endpoints' y
+ coordinates, indicating that another query y coordinate is preferred
+ for robustness.
*/
-bool SkXRayCrossesMonotonicCubic(const SkXRay& pt, const SkPoint cubic[4]);
+bool SkXRayCrossesMonotonicCubic(const SkXRay& pt, const SkPoint cubic[4], bool* ambiguous = NULL);
/** Given an arbitrary cubic bezier, return the number of times an xray crosses
the cubic. Valid return values are [0..3]
@@ -165,8 +172,12 @@ bool SkXRayCrossesMonotonicCubic(const SkXRay& pt, const SkPoint cubic[4]);
left of the curve, the line is not considered to cross the curve,
but if it is equal to cubic[3].fY then it is considered to
cross.
+ Optional outgoing "ambiguous" argument indicates whether the answer is
+ ambiguous because the query occurred exactly at one of the endpoints' y
+ coordinates or at a tangent point, indicating that another query y
+ coordinate is preferred for robustness.
*/
-int SkNumXRayCrossingsForCubic(const SkXRay& pt, const SkPoint cubic[4]);
+int SkNumXRayCrossingsForCubic(const SkXRay& pt, const SkPoint cubic[4], bool* ambiguous = NULL);
///////////////////////////////////////////////////////////////////////////////////////////