diff options
author | rmistry@google.com <rmistry@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-08-23 18:14:13 +0000 |
---|---|---|
committer | rmistry@google.com <rmistry@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-08-23 18:14:13 +0000 |
commit | d6176b0dcacb124539e0cfd051e6d93a9782f020 (patch) | |
tree | 9e6f4b465e54c9b26e1ba70cd8890b55abb08464 /experimental/Intersection/LineIntersection.cpp | |
parent | fbfcd5602128ec010c82cb733c9cdc0a3254f9f3 (diff) |
Result of running tools/sanitize_source_files.py (which was added in https://codereview.appspot.com/6465078/)
This CL is part II of IV (I broke down the 1280 files into 4 CLs).
Review URL: https://codereview.appspot.com/6474054
git-svn-id: http://skia.googlecode.com/svn/trunk@5263 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'experimental/Intersection/LineIntersection.cpp')
-rw-r--r-- | experimental/Intersection/LineIntersection.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/experimental/Intersection/LineIntersection.cpp b/experimental/Intersection/LineIntersection.cpp index 3efa240d83..6271edcefe 100644 --- a/experimental/Intersection/LineIntersection.cpp +++ b/experimental/Intersection/LineIntersection.cpp @@ -15,7 +15,7 @@ int intersect(const _Line& a, const _Line& b, double aRange[2], double bRange[2] double ayLen = a[1].y - a[0].y; double bxLen = b[1].x - b[0].x; double byLen = b[1].y - b[0].y; - /* Slopes match when denom goes to zero: + /* Slopes match when denom goes to zero: axLen / ayLen == bxLen / byLen (ayLen * byLen) * axLen / ayLen == (ayLen * byLen) * bxLen / byLen byLen * axLen == ayLen * bxLen @@ -309,11 +309,11 @@ int verticalIntersect(const _Line& line, double top, double bottom, // from http://www.bryceboe.com/wordpress/wp-content/uploads/2006/10/intersect.py // 4 subs, 2 muls, 1 cmp static bool ccw(const _Point& A, const _Point& B, const _Point& C) { - return (C.y - A.y) * (B.x - A.x) > (B.y - A.y) * (C.x - A.x); + return (C.y - A.y) * (B.x - A.x) > (B.y - A.y) * (C.x - A.x); } // 16 subs, 8 muls, 6 cmps bool testIntersect(const _Line& a, const _Line& b) { - return ccw(a[0], b[0], b[1]) != ccw(a[1], b[0], b[1]) + return ccw(a[0], b[0], b[1]) != ccw(a[1], b[0], b[1]) && ccw(a[0], a[1], b[0]) != ccw(a[0], a[1], b[1]); } |