29 Commits

Author SHA1 Message Date
Behdad Esfahbod
612aa2af87 Return results in tuples, not complex points 2016-07-25 03:35:40 -04:00
Behdad Esfahbod
1cc3c5eae8 Inline _splitCubicIntoN() 2016-07-25 03:14:02 -04:00
Behdad Esfahbod
40bba687ab Replace splitCubicAtT() with splitCubicIntoN()
Another 6% speedup.
2016-07-25 03:13:01 -04:00
Behdad Esfahbod
64af3ad4a8 Inline cubic_quadratic_fit()
Another 5%.
2016-07-25 03:04:51 -04:00
Behdad Esfahbod
abc18236af Inline splitCubicIntoTwo()
Saves another 5%.
2016-07-25 02:12:15 -04:00
Behdad Esfahbod
c50d498ea5 Hand-code splitCubicIntoThree() 2016-07-24 14:10:41 -04:00
Behdad Esfahbod
8a13ef1edf Use splitCubicIntoTwo() more
Shaves another 5%.
2016-07-24 13:54:52 -04:00
Behdad Esfahbod
dff2cd8669 Add splitCubicIntoTwo()
Speeds up another 15% or so.
2016-07-24 13:54:52 -04:00
Behdad Esfahbod
12629a715b Whitespace 2016-07-23 17:11:45 -07:00
Behdad Esfahbod
f63a31dd99 Do less work. 2016-07-23 17:11:28 -07:00
Behdad Esfahbod
d3f566ba54 Use complex numbers to implement points
Shows a 30% speedup for me.
2016-07-22 23:40:44 -07:00
Behdad Esfahbod
46f8416fff Remove more unused code 2016-07-22 23:11:13 -07:00
Behdad Esfahbod
bd52b4d510 Remove unused code 2016-07-22 15:52:00 -07:00
Behdad Esfahbod
49c2d886a0 Use exact error
To me, this looks about 40% faster.

WIP though.  API needs to change to take out error output argument.
Further optimization is possible by merging loops.
2016-07-22 02:21:41 -07:00
Behdad Esfahbod
185216bbfe Remove unused return values 2016-07-22 01:13:12 -07:00
Behdad Esfahbod
2d5e57e973 Make it twice faster by inlining lerp and expanding bezier equations 2016-07-22 00:49:19 -07:00
jamesgk
3c3c579ab1 Assert # error tolerances matches # fonts/curves 2015-12-10 12:50:53 -08:00
jamesgk
b568c934d0 Remove max_n parameter
This is probably not useful as a parameter, so instead we hardcode the
value into the main module.
2015-12-08 12:44:29 -08:00
jamesgk
856ffe1fca Make only a few functions public
This way we hopefully don't have to worry about changing things behind
the scenes.
2015-12-08 12:42:42 -08:00
Cosimo Lupo
4dffdb7dd7 cu2qu.__init__: return (spline[s], error[s]) tuple from curve[s]_to_quadratic; raise exception if no approximation is found; ensure returned spline is a list of tuples 2015-12-07 15:09:26 +00:00
jamesgk
a79fb041a2 Use __future__ imports to ease Python2/3 compat 2015-12-04 13:07:32 -08:00
jamesgk
561bed0ea0 Remove Point class and only use built-ins
Using built-in types (mostly tuples) seems to cut the running time
overall by about one half. Spelling out linear interpolation in the
bezier_at functions actually cuts the running time by another 10%,
but I'm not sure if it's worth it given that this code looks a bit
nicer.
2015-12-01 13:22:24 -08:00
jamesgk
97ce534d7b Move geometry.py to __init__.py 2015-12-01 12:30:31 -08:00
jamesgk
ebf1573564 Remove __init__.py (will be replace by geometry.py) 2015-12-01 11:04:48 -08:00
jamesgk
45364ed045 Move RoboFab-specific code to a "robofab" module 2015-11-19 16:40:52 -08:00
Cosimo Lupo
e8db3a18bb don't truncate floats but round them before casting them to ints 2015-11-14 18:04:22 +00:00
jamesgk
ebcd99b1df Rearrange some code
Hopefully this should make the code supporting the public API more
clear.
2015-11-12 16:36:23 -08:00
jamesgk
3855de8887 Move non-RoboFab code into a separate module 2015-11-12 16:22:15 -08:00
jamesgk
3e7c9a39d3 Move cu2qu into a package 2015-11-12 16:18:58 -08:00