Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project!

## [FontTools-checkins] CVS: fonttools/Lib/fontTools/pens pointInsidePen.py,1.2,1.3

 [FontTools-checkins] CVS: fonttools/Lib/fontTools/pens pointInsidePen.py,1.2,1.3 From: Just van Rossum - 2003-10-14 21:00:24 ```Update of /cvsroot/fonttools/fonttools/Lib/fontTools/pens In directory sc8-pr-cvs1:/tmp/cvs-serv22356 Modified Files: pointInsidePen.py Log Message: Fixed subtle bug in curve intersection logic: due to floating point errors, sometimes a legitimate solution is ever so slightly over 1.0. Those used to be filtered out; now checking for 1.0 + 1e-10. Index: pointInsidePen.py =================================================================== RCS file: /cvsroot/fonttools/fonttools/Lib/fontTools/pens/pointInsidePen.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pointInsidePen.py 28 Aug 2003 19:03:29 -0000 1.2 --- pointInsidePen.py 14 Oct 2003 20:30:07 -0000 1.3 *************** *** 10,13 **** --- 10,19 ---- + # working around floating point errors + EPSILON = 1e-10 + ONE_PLUS_EPSILON = 1 + EPSILON + ZERO_MINUS_EPSILON = 0 - EPSILON + + class PointInsidePen(BasePen): *************** *** 117,121 **** solutions = solveCubic(ay, by, cy, dy - y) solutions.sort() ! solutions = [t for t in solutions if 0 <= t <= 1] if not solutions: return --- 123,127 ---- solutions = solveCubic(ay, by, cy, dy - y) solutions.sort() ! solutions = [t for t in solutions if ZERO_MINUS_EPSILON <= t <= ONE_PLUS_EPSILON] if not solutions: return *************** *** 173,177 **** solutions = solveQuadratic(a, b, c - y) solutions.sort() ! solutions = [t for t in solutions if 0 <= t <= 1] if not solutions: return --- 179,183 ---- solutions = solveQuadratic(a, b, c - y) solutions.sort() ! solutions = [t for t in solutions if ZERO_MINUS_EPSILON <= t <= ONE_PLUS_EPSILON] if not solutions: return ```

 [FontTools-checkins] CVS: fonttools/Lib/fontTools/pens pointInsidePen.py,1.2,1.3 From: Just van Rossum - 2003-10-14 21:00:24 ```Update of /cvsroot/fonttools/fonttools/Lib/fontTools/pens In directory sc8-pr-cvs1:/tmp/cvs-serv22356 Modified Files: pointInsidePen.py Log Message: Fixed subtle bug in curve intersection logic: due to floating point errors, sometimes a legitimate solution is ever so slightly over 1.0. Those used to be filtered out; now checking for 1.0 + 1e-10. Index: pointInsidePen.py =================================================================== RCS file: /cvsroot/fonttools/fonttools/Lib/fontTools/pens/pointInsidePen.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pointInsidePen.py 28 Aug 2003 19:03:29 -0000 1.2 --- pointInsidePen.py 14 Oct 2003 20:30:07 -0000 1.3 *************** *** 10,13 **** --- 10,19 ---- + # working around floating point errors + EPSILON = 1e-10 + ONE_PLUS_EPSILON = 1 + EPSILON + ZERO_MINUS_EPSILON = 0 - EPSILON + + class PointInsidePen(BasePen): *************** *** 117,121 **** solutions = solveCubic(ay, by, cy, dy - y) solutions.sort() ! solutions = [t for t in solutions if 0 <= t <= 1] if not solutions: return --- 123,127 ---- solutions = solveCubic(ay, by, cy, dy - y) solutions.sort() ! solutions = [t for t in solutions if ZERO_MINUS_EPSILON <= t <= ONE_PLUS_EPSILON] if not solutions: return *************** *** 173,177 **** solutions = solveQuadratic(a, b, c - y) solutions.sort() ! solutions = [t for t in solutions if 0 <= t <= 1] if not solutions: return --- 179,183 ---- solutions = solveQuadratic(a, b, c - y) solutions.sort() ! solutions = [t for t in solutions if ZERO_MINUS_EPSILON <= t <= ONE_PLUS_EPSILON] if not solutions: return ```