Closed tatarize closed 2 years ago
For an extreme example, suppose you stitch 10000 times, each time you move +.333, +.333. It's not enough to move the needle a tenth of a millimeter so it should stitch 3 times in the same spot, then move over and down a tenth of a millimeter, and then stitch there three times. However, it actually stitches 10000 times in the same spot. It should have gone 30 millimeters, it went 0.
while(stitches) {
x = stitches->stitch.xx * 10.0;
y - stitches->stitch.yy * 10.0;
dx = roundDouble(x - xx); //Or whatever rounding ops are needed.
dy = roundDouble(y - yy);
xx += dx;
yy += dy;
flags = stitches->stitch.flags;
blahEncode(b, (char)dx, (char)dy, flags);
This mechanism would fix it. Do the conversion from global to local, find the change, do the rounding. Then implement xx, yy as the sum of the rounded values. You also don't need to keep converting from mm to tenths.
See, inkstitch/inkstitch#231 for discussions of the bugs in the wild. With the exception of .dst it will affect most of the writers. Exp, Jef, Hus at a minimum.
fixed in commit e5d5f1f59ce
This mechanism doesn't work. The error is introduced during the rounding of the dx, dy and that isn't tracked. The values of xx, yy, need to be the needle position given the summation of the actual dx, dy values given.
It needs to have the value of xx, yy the sum of the dx, dy values. And to round at the calculation of dx, dy.