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

need to review leftFloor / rightFloor #25

Open
ixchow opened this issue Feb 25, 2021 · 1 comment
Open

need to review leftFloor / rightFloor #25

ixchow opened this issue Feb 25, 2021 · 1 comment
Labels
development Issues to consider for style/structure

Comments

@ixchow
Copy link
Member

ixchow commented Feb 25, 2021

These variables enable what seems to be somewhat questionable behavior, need to review this code to understand what is being fixed and whether the fix is working.

@gabrielle-ohlson
Copy link
Collaborator

gabrielle-ohlson commented Feb 25, 2021

I added this as a fix for the following carrier placement issues:

  1. If more than 4 carriers are parked on a given side and carrierSpacing = 1, the carriers push/scrape against each other when moved.
  2. When a carrier is more than 8 spaces away from the edge-most needle on a given side (which happens quite easily when carrierSpacing = 2), it will frequently drop the edge stitches when picked up again to knit (due to too much slack and not enough security for the yarn).

My solution was to allow for x-carrier-spacing N to be equal to non-whole numbers in increments of 0.5, which tells the backend to alternate between: bumpAdd = Math.floor(N) and bumpAdd = Math.ceil(N) each time it bumps a carrier on a given side.
So if x-carrier-spacing 1.5 is specified in the knitout, if (Math.abs(add) % 1 === 0.5) returns true, and the boolean leftFloor or rightFloor (depending on whether add < 0 [meaning we're dealing with carriers on the left side] or vice versa) is toggled between true (for that pass, the working carrier will be bumped 1 —> Math.floor(1.5)), and false (in the next pass, the working carrier will be bumped 2 —> Math.ceil(1.5)). But if N is a whole number, the carrierSpacing is consistently equal to that number.

I've found this to be really helpful for situations where I'm using 5 or 6 carriers and a pattern that causes a lot of carrier stacking, but it is still definitely a quick fix and could be replaced with something more clear and sophisticated.

@gabrielle-ohlson gabrielle-ohlson added the development Issues to consider for style/structure label Feb 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
development Issues to consider for style/structure
Projects
None yet
Development

No branches or pull requests

2 participants