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

Logical position tracking not reflected properly. #22

Open
ixchow opened this issue May 14, 2022 · 2 comments
Open

Logical position tracking not reflected properly. #22

ixchow opened this issue May 14, 2022 · 2 comments

Comments

@ixchow
Copy link
Member

ixchow commented May 14, 2022

Using xfers to set the logical position of a carrier and then knitting in such a way that it would be trapped is not reflected in the current visualizer. (See example in textiles-lab/knitout#5 )

@ixchow
Copy link
Member Author

ixchow commented May 14, 2022

Slightly shorter test case:

;!knitout-2
;;Carriers: 1 2 3 4 5 6 7 8 9 10

in 1
knit + f1 1
knit + f2 1
knit + f3 1

in 2
knit + f1 2
knit + f2 2
knit + f3 2

xfer f3 b3
rack -1
xfer b3 f2

knit - f2 2
knit - f1 2
knit + f1 2
knit + f2 2
knit + f3 2

drop f1
drop f2
drop f3

Carrier 1's logical position should follow the xfer but it does not.

Output:

Expected:

(possibly with slightly more elegant handling in terms of vertical space)

@ixchow
Copy link
Member Author

ixchow commented May 14, 2022

Useful context for a fix:

  • Carriers currently store their front-bed-relative positions as c.after = {d: direction, n: needle}.
  • The bringCarriers routine moves carriers along the front bed. A fix will likely result in more bringCarriers calls being made.

A possible fix would be to store the logical position of each carrier as c.logical = {d: direction, n:needle} and emit a bringCarriers after split or rack to fix any carriers whose .logical and .after don't match (.logical will need to be mapped to the front bed before this comparison).

(NOTE: after is always a front bed position, so rack will probably trigger lots of wig-wags in carriers referenced to a back-bed stitch.)

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

1 participant