( Simple weaving algorithms

Info Catalog ( Weaving algorithms ( Weaving algorithms ( Perfect weaving
 Simple weaving algorithms
    The initial problem is to calculate the starting position of each
 pass; the row number of the printer's top jet when printing that pass.
 Since we assume the paper cannot be reverse-fed, the print head must,
 for each pass, start either further down the page than the previous
 pass or at the same position.  Each pass's start point is therefore at
 a non-negative offset from the previous pass's start point.
    Once we have a formula for the starting row of each pass, we then
 turn that "inside out" to get a formula for the pass number containing
 each row.
    First, let's define how our printer works.  We measure vertical
 position on the paper in "rows"; the resolution with which the printer
 can position the paper vertically.  The print head contains J ink jets,
 which are spaced S rows apart.
    Consider a very simple case: we want to print a page as quickly as
 possible, and we mostly don't care how sparse the printing is, so long
 as it's fairly even.
    It's pretty obvious how to do this.  We make one pass with the print
 head, printing J lines of data, each line S rows after the previous
 one.  We then advance the paper by S*J rows and print the next row.
 For example, if J=7 and S=4, this method can be illustrated like this:
      pass number
      | row number------->
      | |         111111111122222222223333333333444444444455555555556666666666
      | 0123456789012345678901234567890123456789012345678901234567890123456789
      0 *---*---*---*---*---*---*
      1                             *---*---*---*---*---*---*
      2 \-----------------------/                               *---*---*---*---*---*-
                7 jets              \---/
                                    4 rows offset from one jet to the next
           7*4=28 rows offset from one pass to the next
    In these examples, the vertical axis can be thought of as the time
 axis, with the pass number shown at the left margin, while the row
 number runs horizontally.  A `*' shows each row printed by a pass, and
 a row of `-' is used to link together the rows printed by one pass of
 the print head.  The first pass is numbered `0' and starts at row 0.
 Each subsequent pass p starts at row p*S*J.  Each pass prints J lines,
 each line being S rows after the previous one.  (For ease of viewing
 this file on a standard terminal, I'm clipping the examples at column
    This method covers the whole page with lines printed evenly S rows
 apart.  However, we want to fill in all the other rows with printing to
 get a full-density page (we're ignoring oversampling at this stage).
 Where we have previously printed a single pass, we'll now print a "pass
 block": we print extra passes to fill in the empty rows.  A naive
 implementation might look like this:
      0 *---*---*---*---*---*---*
      1  *---*---*---*---*---*---*
      2   *---*---*---*---*---*---*
      3    *---*---*---*---*---*---*
      4                             *---*---*---*---*---*---*
      5                              *---*---*---*---*---*---*
      6                               *---*---*---*---*---*---*
      7                                *---*---*---*---*---*---*
      8                                                         *---*---*---*---*---*-
      9                                                          *---*---*---*---*---*
      10                                                          *---*---*---*---*---
      11                                                           *---*---*---*---*--
 (Now you can see why this process is called "weaving"!)
Info Catalog ( Weaving algorithms ( Weaving algorithms ( Perfect weaving
automatically generated byinfo2html