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

Stitch fields #106

Closed
wants to merge 16 commits into from
Closed

Stitch fields #106

wants to merge 16 commits into from

Conversation

jo-pol
Copy link
Collaborator

@jo-pol jo-pol commented Sep 23, 2017

Objective

Progress

  • Parse the input field.
  • Apply new default colors in all pair diagrams.
  • Shorthand assignments for first pair diagram.
    So far to be tested with docs/index.html in stitch-fields.zip
  • Shorthand assignments for level 2/3 diagrams.
  • Override colors.
  • When all above is implemented: adjust wiki/stitches and wiki/color-code.
    The latter should use plain English for the rules at the bottom of stitches.
    Examples for both are available in StitchesSpec.

@jo-pol jo-pol mentioned this pull request Sep 24, 2017
@jo-pol
Copy link
Collaborator Author

jo-pol commented Sep 24, 2017

@MAETempels

Please first read the intro of the pull request and review the color-code page.

Would you mind to propose more examples (alias tests)? For that purpose you can edit the file StitchesSpec following the pull request procedure starting at step 2. You might also want to propose different rules for the default colors. Once it all works, it would be good to have one or two diagrams for the wiki page that demonstrate all colors and some twist marks.

@jo-pol jo-pol force-pushed the master branch 2 times, most recently from 0c897a9 to 203960f Compare October 6, 2017 17:44
jo-pol added a commit that referenced this pull request Nov 4, 2017
@jo-pol
Copy link
Collaborator Author

jo-pol commented Nov 10, 2017

A sneak preview of a new form

Whenever I push another commit to this issue you can download the latest version and try docs/_includes/tiles-form.html

@veronika @MAETempels

The form is born out of the need for tiling variations with another shift value than a half brick. At last the pennies dropped extending the current stitches form with more functionality. The new form is not yet fully functional but Marian, you might like to play with it and prefer it over the diagram link on the main page.

A seasoned JavaScript developer might be able to update the prototype while you type in the definition field. For now you have to use the tab-key to leave the field or click somewhere else on the page to update the prototype. Once implemented, the go button will use #100 for the new tiling capabilities. For that purpose you can make the stitches field on the main page span multiple lines.

Not sure the form will some day get integrated in the main page. Anyway I would appreciate feedback and advice from both of you. For example I'm in doubt about the 'prototype' caption. Veronika, when you read the help intro you might understand why Marian minted these diagrams 'draft pricking', so any suggestion?

@jo-pol
Copy link
Collaborator Author

jo-pol commented Nov 11, 2017

Thinking loud: To implement the go button I need to create a checker-matrix and thus need the lcm of shift value and corresponding matrix dimension. Matrix dimensions span 1-8, shift spans 0-7. A simple solution would be a table with 8x8 cells with the lcm values. Hm, the shift should get a sign, to reduce the size of the checker matrix.

  1 2 3 4 5 6 7 8
0 1 2 3 4 5 6 7 8
1 2 3 4 5 6 7 8
2 6 4 10 6 14 8
3 6 21 24
4 8

@MAETempels
Copy link
Collaborator

NICE!! Like it indeed!!
If this works nicely it could replace the main form.

If you allow a shift 0, then you have a checkers diagram?

Some first remarks,

  • Of course, I tried first a 9 collumns matrix. Then realized the maximum of 8.

  • At first, I did not see where the small line (in the green oval) was coming from. Then realized it is 2 long. The "empty cirkels" are a bit confusing at first glance. Of course the line nicely disappeared when applying the shift needed.

  • The stitches field might be clearer if the "-" from the matrix definition are incorporated. It is easier to work with than searching for the ID's. (And it might work on tablets too).

  • Not sure what is intended with "variants". It seems not to do anything.

  • The "go" button send me nicely to the main form. However, the matrix is not yet working. (Of course not with the matrix I used, but also not with the example matrix (from the mail).)
    (I noticed that the example provided is multiple rows.)
    There is a footside shift down of 2, why?

  • I like the draft-diagram (prototype). It saves clicking on the [diagram] button. However, I would drop the cheat-sheet and display the draft-diagram just as clear lines. See also second remark.
    I do not mind to click somewhere to update this picture. Would be very "nervously" if it changed with every letter put in the matrix-field.

image

Another example
image

The following example: I would have thought, it to be a shift of 3 collumns (to the right). Apparently, the move is to the left. Might be nice to put this information on the form. Or, indeed, allow -3.
image

@jo-pol
Copy link
Collaborator Author

jo-pol commented Nov 12, 2017

  • Shift zero is indeed a checker pattern. A shift of half the matrix width is a brick pattern.

  • So far only the checker and bricks tiling are supported, as I wrote: not yet fully functional. For that reason the example from the mail (5,1,8,4,8,-,- shift by 2 rows) shows a notYetImplemented in the go-link where the tiling (checker/bricks) would go for existing patterns. But at least the prototype can show you it is a valid pattern.

  • A valid pattern will always have at least one stitch in each row or column. That will make the positions of the stitch fields clearer. Also long lines will only go across empty circles. You will see when trying any of the get-started examples.

  • Variants are indeed not yet implemented. See the form on help/Choose-stitches where you can choose larger matrices. It is meant to allow different stitches for every other spider or whatever feature appears in a pattern. Non-1 values require multiplying the stitch form, but what to do with shifted tiles? Multiply complete tiles? Or for example in case of the current bricks show a checker tile?

  • The shift on the main page is required to match the stitch positions in the form with ID's in the generated pattern. If that indeed solves all ID problems, I can close fix numbering of stitches #96

  • "Apparently, the move is to the left. Might be nice to put this information on the form." not sure it would clutter the form too much. This one has to sink into my brain.

  • I guessed the cheat-sheet and numbered circles in the prototype can be helpful when seriously designing/debugging new patterns. I'm not making that decision right now. You could play with it in your local copy or even the browser debugger. In the HTML you will find SVG structures like

    <g id="g9" ...>
        <path .../>
        <text ...>9</text>
        <path ..."...marker-end:url(#Arrow1Mend)"/>
        <path ..."...;marker-end:url(#Arrow1Mend)" />
    </g>
    

    For example drop the arrows, change the stroke width, or make "g-" (what you called empty-circle) almost fully transparent: opacity:0.3; in a style attribute. Dropping the circle and text however will leave gaps.

@MAETempels
Copy link
Collaborator

MAETempels commented Nov 13, 2017

  • I have examples where the ID's are shifted both in rows and in collumns. In these examples: 2 collums: all checker-matrices starting with C. Rows shift also 2: starting with 3 in the diagram.
    See
    5---, -C-B, 5-5-, -5-5, --5-, -B-C, 5-5-, -5-5 (Checkers) Starts with C3.
    or bricks: 5-5-, -5--, B-C-, -5-5 starts with A3.
    or bricks: 5---, -C-B, 5-5-, -5-5 starts with A3
    (all the same)

--B-C---, -E-5-O-K, 5-----5-, -------5 bricks: G3 seems to be in the upper-left corner. Also seems to shift 2 both rows & collumns.
(I have more examples. Might want to check all matrices I made.)
(I think there has already been some work on the issue, as my notes stated that the bricks of the first example also started at C3.)
(After remarking some time ago that there seemed to be a shift of 2, I did not explore the issue further after realising that the value given to ID's does not matter for using Groundforge.)

  • If this new form is going to be the new main-page, then the ID's are no longer important. As long as it is clear which stitch-field belongs to which "point" of the proto-pricking. (That's why I suggested empty "fields".)
    Also, the difference between bricks and checkers is no longer nessecarilly - as a move of 0 is a checkers-pattern. Am I correct, that a 0-move is not supported (yet)?

  • The stitch-fields are rather big. I can specify quite a long plait.

  • The blocks may be moved horizontally, or vertically. I have a slight feeling that this will not generate the same pattern. Have to work this out. Both moves together: not possible.
    Start of working out:

abcabc --- abcghi
defdef --- defabc
ghighi --- ghidef
bcabca --- abcghi
efdefd --- defabc
highig --- ghidef

@MAETempels
Copy link
Collaborator

-After some sleep: a new mainpage will give lots issues with existing examples.

  • Refrase puzzle: if a diagram has a horizontal brick pattern, does it also have a vertical? Answer: NO
    See 5831, -4-7

  • more thoughts later.

@jo-pol
Copy link
Collaborator Author

jo-pol commented Nov 14, 2017

I suppose you meant shift 2 columns for 5831, -4-7 as it also works as a checker pattern, it works with shifted by 2 rows for 58,-4,31,-7.

Generalized: a brick pattern ab (with the same dimensions for a and b in number of stitches) can be turned into a checker pattern ab,ba from which you can extract the vertical bricks a,b or b,a. For different width of a and b I don't have yet a similar reasoning at hand, their checker dimensions can become quite large, see #106 (comment)

@jo-pol
Copy link
Collaborator Author

jo-pol commented Nov 14, 2017

Indeed I see a problem for unequal dimensions. In the following example with a horizontal tile of 2 rows by 3 columns, the smallest vertical tile I can find is 6 rows by 2 columns. A fun thing, though I don't see see a use case, are overlapping tiles. The table above for checker sizes also makes no sense. Here we have a checker matrix of 6 rows by 6 columns.

                               
a b c a b c a b c a b c        
d e f d e f d e f d e f        
  a b c a b c a b c a b c      
  d e f d e f d e f d e f      
    a b c a b c a b c a b c    
    d e f d e f d e f d e f    
      a b c a b c a b c a b c  
      d e f d e f d e f d e f  
        a b c a b c a b c a b c
        d e f d e f d e f d e f

Layout hint: just copy-paste from a spreadsheet like Excel, the first line is interpreted as a header row, it can be empty.

@MAETempels
Copy link
Collaborator

I was not quite awake when I gave the example for vertical - horizontal bricks.
Please look at this picture:

bloks

Given: a pattern with horizontal blocks.
Let:
w = width of block
h = height of block
m = move / shift of block to generate the pattern.

let r = number of blocks needed vertically to generate the pattern.
Then: r x m eq 0 (mod w). take the smallest r (and r <= w)

The corresponding Vertical block has
width = m
height = h x r
shift down = h
s = number of blocks needed horizontally: s x h eq 0 (mod hxr)
then: width of total = m x s.
(note: we might have to allow fractions for s and r. I'll work this out later.)

For the corresponding Checkers matrix the following holds:
width = w (! given the horizontal block)
height = h x r

@jo-pol jo-pol mentioned this pull request Nov 15, 2017
@jo-pol
Copy link
Collaborator Author

jo-pol commented Nov 15, 2017

  • big fields: The fields adapt their width to the available space. Within a help page, on a mobile or with more columns that would be less.
  • empty fields: I hide the not used fields. If the same column doesn't have a field on another row, the complete column disappears. That is nice for rows and columns that are not use at all because the matrix has less than the (arbitrary) maximum of 8. But I see that can be a problem for shifted matrices, so I need a different strategy.

@MAETempels
Copy link
Collaborator

I have made a doc about the horizontal and vertical bricks, with neater pictures. With a small comment on the "fractions" mentioned.
bricks.pdf

@MAETempels
Copy link
Collaborator

One more word.

Suppose we have a horizontal brick with width w=9, and a shift of m=3, height h.

As discussed before:
we need r: r x 3 eq 0 (mod 9) --> r = 3
whereas: lcm(3,9) = 9.

A much smaller value!

@jo-pol
Copy link
Collaborator Author

jo-pol commented Nov 19, 2017

Closing the pull request as is has broken links and left the original subject

@jo-pol jo-pol closed this Nov 19, 2017
@jo-pol jo-pol deleted the stitch-fields branch November 25, 2017 13:18
jo-pol added a commit that referenced this pull request Jan 30, 2018
* compiled the code for #106

* new convenience form

* dressing up the new form

* more functionality for the new form

* fill the full prototype of the form

* prototype diagram of new form completed

* event handling and trimming

* pattern variants in figure captions

* preliminary implementation of go button

- new tiling won't work at all
- ID's are wrong, do they need a shift?

* fixed ID's of new form with a shift

* no tranlation for svg groups

* one Paris variant was a typo, no need to shift tiles in two directions

* restored shifting tiles in two directions

* preparing for an overlapping slanted shift

* images no longer linked, hide go-button, script cleanup, more examples

- go button not shown when pattern not implemented
- all links for get started images by numbers in their captions
- split the algorithm into smaller pieces
- added some examples with bricks shifted vertically
  and with another value than a half brick

* first diagonal of overlapping tiles

* completed overlapping tiles

* checkers and bricks expressed with overlapping tiles

TODO: recognize these to activate go-button

* minor changes

* convenience links to initialize checker/brick tiling

* natural repeats indicated with N-links

* re-enabled go button (as far as implemented by main page)

* showed stitches section again, was in the way of debugging the go button

* select stitches with pop-up

* shorter 'go'-links

* eliminated field-set with stitches

* separated digits from letters, illustrating checker/bricks

* did not save the svg source of the changed images

* fixed typo's and omission reported by Monique D.

* colored circles for chosen stitches

* black if stitch defined but has no color

* set default stitches

* stitches in a field-set between the others

* no color for dashes

* fixed pattern match for turning stitch variant

* adopted color values of the dynamic D3js diagrams

* maintain color table in a single location

* fix the build, the new form is not yet included

* new patterns by just a different tiling

* replaced go button with in-situ thread diagram

* fixed last minute change, minimized code to cal D3js

* reapplied shift to fix stitch ids

* work in progress for custom footsides and moving JS code to scala

* newProto no longer hurts the other demo links

* config created once, selected stitch not yet applied in repeats

* config does the tiling

* config applies stitches in prototype, new tiling together with head/foot

* resizable prototype view

* fixed unit tests

* completed previous commit, fixed natural version of small snow pattern

* optional foot/head-side, choosing stitches shows thread diagram

Signed-off-by: Joke Pol <[email protected]>

* clean up

Signed-off-by: jo pol <[email protected]>

* clean up, fixed test, completed footside

Signed-off-by: jo pol <[email protected]>

* bolder arrows

Signed-off-by: jo pol <[email protected]>

* renames and re-activated color codes

Signed-off-by: jo pol <[email protected]>

* smaller arrow heads

Signed-off-by: jo pol <[email protected]>

* head/foot-sides another stitch color, dashes get white circles

Signed-off-by: jo pol <[email protected]>

* white circles changed to almost transparent

Signed-off-by: jo pol <[email protected]>

* smaller initial grid

Signed-off-by: Joke Pol <[email protected]>

* fall back to pair diagram if thread diagram fails

Signed-off-by: Joke Pol <[email protected]>

* thread diagrams apply cosen stitches in all repeats

Signed-off-by: Joke Pol <[email protected]>

* rezisable/scrollable thread diagram, rearranged forms

Signed-off-by: jo pol <[email protected]>

* fixed foot-side

Signed-off-by: jo pol <[email protected]>

* fix defaults for head/foot-sides

Signed-off-by: jo pol <[email protected]>

* nudge tile in diagonal directions

Signed-off-by: jo pol <[email protected]>

* corresponding colors in the form

Signed-off-by: jo pol <[email protected]>

* source of the images was not saved

Signed-off-by: jo pol <[email protected]>

* fixed tests, added link-button

Signed-off-by: jo pol <[email protected]>

* additional hints, demo's below the forms

Signed-off-by: jo pol <[email protected]>

* added pair diagram, marked patterns, moved page

- comparing the pair diagram with the prototype to analyse bugs
- demo's might move to a help page, for now it helps manual tests

Signed-off-by: jo pol <[email protected]>

* styling and two more foot sides

Signed-off-by: jo pol <[email protected]>

* renamed / split SVG classes and objects

Signed-off-by: Joke Pol <[email protected]>

* toggle thread colors, download, animation of pair diagram, hack-fix

Signed-off-by: jo pol <[email protected]>

* reset thread color with alt

Signed-off-by: jo pol <[email protected]>

* made more use of d3.select

Signed-off-by: jo pol <[email protected]>

* clear diagrams when prototype is set

Signed-off-by: jo pol <[email protected]>

* also reset scroll bars of pair diagram when clearing it

Signed-off-by: jo pol <[email protected]>

* reorganized and renamed functions

Signed-off-by: jo pol <[email protected]>

* visual check of the matrix

Signed-off-by: jo pol <[email protected]>

* introduced site-map, not yet linked anywhere

Signed-off-by: jo pol <[email protected]>

* fixed two foot sides

Signed-off-by: jo pol <[email protected]>

* miniatures on the sitemap

Signed-off-by: jo pol <[email protected]>

* consistent margins/links and applied a color scheme

Signed-off-by: jo pol <[email protected]>

* Error marks built into the prototype.

Signed-off-by: jo pol <[email protected]>

* fixed thread diagrams

Signed-off-by: jo pol <[email protected]>

* work in progress

Signed-off-by: jo pol <[email protected]>

* fixed pattern-sheet, adjusted error-marks, moved "under construction"

Signed-off-by: jo pol <[email protected]>

* figcaption padding

Signed-off-by: jo pol <[email protected]>

* nested figcaptions not clear on a small device, using fieldset

Signed-off-by: jo pol <[email protected]>

* moved workaround hint into "under construction" fieldset

Signed-off-by: jo pol <[email protected]>
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.

2 participants