diff options
author | 2012-05-31 13:13:11 +0000 | |
---|---|---|
committer | 2012-05-31 13:13:11 +0000 | |
commit | 495f8e435b677f28913cd2adc8caa8d3d766dd17 (patch) | |
tree | 82e12d69aede9d11f1f0a0d3fe16e5bef72de430 /experimental/Intersection/LineIntersection.cpp | |
parent | 13f1b6f1569bb5c639ca762f6b153133173c6295 (diff) |
shape ops work in progress
git-svn-id: http://skia.googlecode.com/svn/trunk@4089 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'experimental/Intersection/LineIntersection.cpp')
-rw-r--r-- | experimental/Intersection/LineIntersection.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/experimental/Intersection/LineIntersection.cpp b/experimental/Intersection/LineIntersection.cpp index 40e046cff5..b505761877 100644 --- a/experimental/Intersection/LineIntersection.cpp +++ b/experimental/Intersection/LineIntersection.cpp @@ -56,9 +56,10 @@ int intersect(const _Line& a, const _Line& b, double aRange[2], double bRange[2] aRange[0] = bMin <= aMin ? 0 : (bMin - aMin) / (aMax - aMin); aRange[1] = bMax >= aMax ? 1 : (bMax - aMin) / (aMax - aMin); } + int bIn = (aPtr[0] - aPtr[2]) * (bPtr[0] - bPtr[2]) < 0; if (bRange) { - bRange[0] = aMin <= bMin ? 0 : (aMin - bMin) / (bMax - bMin); - bRange[1] = aMax >= bMax ? 1 : (aMax - bMin) / (bMax - bMin); + bRange[bIn] = aMin <= bMin ? 0 : (aMin - bMin) / (bMax - bMin); + bRange[!bIn] = aMax >= bMax ? 1 : (aMax - bMin) / (bMax - bMin); } return 1 + ((aRange[0] != aRange[1]) || (bRange[0] != bRange[1])); } |