Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error Compounding In Most Writers. #125

Closed
tatarize opened this issue Jul 12, 2018 · 4 comments
Closed

Error Compounding In Most Writers. #125

tatarize opened this issue Jul 12, 2018 · 4 comments

Comments

@tatarize
Copy link

tatarize commented Jul 12, 2018

while(stitches)
    {
        dx = stitches->stitch.xx * 10.0 - xx;
        dy = stitches->stitch.yy * 10.0 - yy;
        xx = stitches->stitch.xx * 10.0;
        yy = stitches->stitch.yy * 10.0;
        flags = stitches->stitch.flags;
        jefEncode(b, (char)roundDouble(dx), (char)roundDouble(dy), flags);
...

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.

@tatarize
Copy link
Author

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.

@tatarize
Copy link
Author

tatarize commented Jul 13, 2018

        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.

@tatarize
Copy link
Author

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.

@robin-swift robin-swift self-assigned this Oct 27, 2021
@robin-swift robin-swift transferred this issue from Embroidermodder/Embroidermodder Oct 27, 2021
@robin-swift robin-swift added this to the Version 1.0 milestone Oct 27, 2021
@robin-swift robin-swift removed this from the Version 1.0 milestone Dec 1, 2021
@robin-swift
Copy link
Member

fixed in commit e5d5f1f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants