bezierjs
bezierjs copied to clipboard
Offset is drawing a line on both sides of a cubic curve?
trafficstars
Given this code:
var pts = [ 120, 79.63967819396663, 173.33333333333331, 118.72659522329167, 226.66666666666669, 109.84371034788978, 272, 85.57546366477419 ],
curve = new Bezier(pts),
ocurve = curve.offset(20);
draw_curve(curve, "line");
ocurve.forEach(function(c) {
draw_curve(c, "offsetpath");
});
I get a properly offset line below curve, but also a bit of the curve offset by the same amount but above curve. Here is a demo.
Is this a bug, or am I misunderstanding how this is an expected behavior?
This looks like a very curious bug. If I edit the coordinates in http://jsbin.com/vadayaneli/edit?html,console,output just a little, the offsetting works fine, so there is bound to be a rounding issue happening here.
True! On firefox, 173.3333 does not reproduce the bug, but 173.33333 does. 226.66666 does, but 226.6666 doesn't