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

new way better satin algo #607

Merged
merged 2 commits into from Apr 26, 2020
Merged

new way better satin algo #607

merged 2 commits into from Apr 26, 2020

Conversation

lexelby
Copy link
Member

@lexelby lexelby commented Jan 31, 2020

I've kept noticing a weird bug in satin columns. On some shapes, the stitches aren't lining up properly with the rungs:

bad_satin

What's happening is that errors are building up, causing one rail to "fall behind" the other. I think it's been this way since we added the "density compensation" code. I redid the satin algorithm, and in the process I accidentally got rid of a very important part of the algorithm that prevented this kind of thing from happening.

Adding that back wasn't so easy. I couldn't really come up with a good way of restoring that part of the algorithm while still having the density compensation, and I feel that the density compensation is quite important.

Instead, I redid the entire algorithm (again). Yikes! But this time I think we've got something really good, and the code is way simpler. It doesn't have the issue with one rail falling behind, and it also does a pretty great job of avoiding density issues. Better yet, I think it's a ton easier to understand what the code is doing.

Here's how it works. It figures out the center-line of the satin, which is pretty much just halfway between each pair of points on the rails. For each stitch, it inches along the rails, measuring how far it's gone along the center line (not either rail). Once it's gone the right distance, it makes a stitch.

This naturally avoids the density issues we saw before, even for a V-like shape. It can still be slightly denser in some places for a shape like this: | / but it's not too dense, and it's just as good if not better than the previous density compensation.

Test all your satin columns. :) I have high hopes for this, but of course, I don't want to break existing designs.

@kaalleen
Copy link
Collaborator

@kaalleen kaalleen commented Feb 4, 2020

Looks good to me, no errors found yet.
The density in the edges look beautiful - haven't sewn it out though, but at the display it looks good to me!! I removed some rungs in older files, it still looked as it should (I believe those rungs have been necessary before!).

@lexelby
Copy link
Member Author

@lexelby lexelby commented Mar 21, 2020

Do you think this one's ready to merge?

@kaalleen
Copy link
Collaborator

@kaalleen kaalleen commented Mar 22, 2020

I tested it again and I like how the satin stitches spread more evenly.
Then I created an uncommon ugly shape and got the impression that the master branch takes better care for the underlay to be covered by the final layer:

fix-satin-underlay

@lexelby
Copy link
Member Author

@lexelby lexelby commented Mar 22, 2020

Awesome, could you post that SVG so I can take a look?

@kaalleen
Copy link
Collaborator

@kaalleen kaalleen commented Mar 22, 2020

Here you go: fix-satin-underlay-issue.svg.log

@lexelby
Copy link
Member Author

@lexelby lexelby commented Mar 28, 2020

Honestly, I'm kind of okay with this. The master branch doesn't actually take any care to ensure that the underlay doesn't show, it just got lucky. If you set the contour underlay stitch length to 1.2, it looks great. It's really just a matter of whether the stitches are close enough to avoid cutting that corner.

@kaalleen
Copy link
Collaborator

@kaalleen kaalleen commented Mar 28, 2020

Ok, then I think this is ready to be merged.

@lexelby
Copy link
Member Author

@lexelby lexelby commented Apr 26, 2020

Agreed!

@lexelby lexelby merged commit eb52692 into master Apr 26, 2020
4 checks passed
@lexelby lexelby deleted the lexelby/satin-fix branch Apr 26, 2020
kaalleen added a commit that referenced this issue May 16, 2020
## New Features

- New Simulator (#531)
- Import Threadlist (#666)
- Export Threadlist in ZIP file (#664)
- Option to include SVG in ZIP file (#648)
- Break Apart and Retain Holes (#653)
- G-Code: option to alternate z-value (#659)
- New Stitch Plan Extension (#640)
- Optionally enable/disable ties (lock down stitches) (#619)
- Multiple Fill Underlays
- Additional Fonts (#683):
    * Geneva
    * DejaVu

## Improvements

- Better Algorithm for Satin Columns (#607)
- Better Algorithm for Fill Stitches (#606)
- Convert to Satin with Loops (#608)
- Adding '@ #' to all fonts (#680)

## Bug Fixes

- Fix Issue with Troubleshoot Pointer Position (#696)
- Inherit Styles (#673)
- Fix Color Palette Issues (#660)
- Preserve Aspect Ratio (#646)
- and more

## Under the Hood

- Namespaced Attributes (#657)
- Remove stub.py (#629)
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

Successfully merging this pull request may close these issues.

None yet

2 participants