bezierjs
bezierjs copied to clipboard
outline() fails miserably when reduce() returns empy list because it cannot form a reduction
Shouldn't reduce() in the "cannot reduce" case return the original unreduced curve? Y so destructive?
we can never form a reduction bezier.js:1152:13
TypeError: fcurves[0] is undefined[Learn More] bezier.js:1273:7
Bezier.prototype.outline file:///home/chuck/curve_test_js/bezier.js:1273:7
Bezier.prototype.outlineshapes file:///home/chuck/curve_test_js/bezier.js:1286:17
<anonymous> file:///home/chuck/curve_test_js/outlines.html:375:40
r.Callbacks/i file:///home/chuck/curve_test_js/jquery-3.1.1.min.js:2:27978
r.Callbacks/j.fireWith file:///home/chuck/curve_test_js/jquery-3.1.1.min.js:2:28749
A file:///home/chuck/curve_test_js/jquery-3.1.1.min.js:4:14201
.send/c/< file:///home/chuck/curve_test_js/jquery-3.1.1.min.js:4:16491
Here is a repro quadratic curve:
start: (193.15625, 203.84375)
control point: (193.15625, 203.84375)
end: (213.125, 209.46875)
Hope that helps!
hm, probably a good idea, marking as enhancement.
Thank you! It's also a bug because outline() (which calls reduce() in its own internal implementation) doesn't work at all with this curve (it crashes with the aforementioned stack trace instead of returning an outline for the original curve).
Note to anyone else running into this: I'm terribly unavailable atm, so if anyone wants to file a PR: you'd be a hero
test:
b = new Bezier(0,0, 0,0, 1,1);
r = b.reduce();
r will be an empty array. Note that this is a degenerate curve, and there are no degeneracy checks at the moment, which there really should be..