| ASSIGNMENTS | DESIGN | NAME = design | { command ... } | definition | NAME = arrangement | dNAME | reference | NAME = part |
|---|---|---|---|
| PARTS | ||
|---|---|---|
| eNAME/N | reference: one Nth of part NAME | |
| eT/N | definition: one Nth of part with T teeth | |
| (e is p = inside curve, q = outside curve, l = straight) | ||
| ARRANGEMENTS and ARRANGEMENT COMMANDS | ||
|---|---|---|
| [ part ... ]T/R | definition (T = translation count, R = reflection count) | |
| aNAME | reference | |
On the top level, a spiro program file is a series of assignments. An assignment is a user name followed by the equal sign = followed by a word.
The word is the fundamental object. There are several forms of words. A word is a collection of words optionally followed by a parameter. A word is a command optionally preceded by a sign and/or optionally followed by a parameter. A word is a command followed by a user name optionally followed by a slash and a number.
Words may be separated by white space (blanks, tabs and/or newlines). White space is never necessary. A pound sign # begins a comment which extends through the following newline. A comment is equivalent to white space.
Collections of words are enclosed in pairs of symbols: parentheses ( ), square brackets [ ], angle brackets < > or braces { }. The latter are also known as curly brackets. A parameter consists of a number and/or a slash / followed by a number. A number is one or more digits 0-9, excluding the period . which is never permitted. A command is a single lower-case letter a-z or the exclamation point !. A sign is plus + or minus −. A user name is an upper-case alphabetic A-Z or underscore _ followed by a zero or more upper-case alphabetic, underscore or digit characters.
It is worth noting that, unlike normal programming languages, the distinction between upper- and lower-case letters is tightly coupled with context. Upper-case letters are used within the classical context of identifiers. Lower-case letters, however, appear individually as commands similar to the classical context of unary operators.
When the spiro interpretter is invoked, the drawings to be drawn are named on the command line by the same user names which appear on the left-hand sides of the assignments within the spiro program file. The names which appear on the command line may use lower-case in place of upper-case. The drawings named on the command line are drawn in the order in which they appear from left to right. If no drawings are specified on the command line, all the designs defined in the spiro program file are drawn in the order in which they appear in the file. A drawing is a design referenced from the command line.
For each design, the words within the definition are read and executed in order. A reference to another design may appear within a design definition. The definition of the new design is executed when and where it appears in the original definition. The only other flow of control construct is the repeat command. This is the loop. There is no conditional construct.
The repeat command consists of a series of words enclosed in parentheses ( ) followed by a parameter. The words within the parentheses are executed a number of times (the repeat count) given by the parameter. In no case, however, is it possible to execute the loop zero times. In the usual case, the parameter is a simple number which is the repeat count.
In the alternative form, the parameter is a slash followed by a number. The number represents the number of points to generate in a pattern drawn with the current wheel and the current arrangement. These terms and the use of this form of the repeat command is discussed in detail below. It is formally stated here that given a wheel with a given number of teeth, W, and an arrangement with a given number of teeth, A, the number of points, P, in a pattern drawn by the pair is A divided by the Greatest Common Factor of W and A. The repeat count of this form of the repeat command is thus P divided by the given number. It is necessary that this repeat count is a whole number; in other words, that the given number is a factor of P. Used in conjunction with shifting commands discussed below, it is possible to create symmetrical patterns with a larger number of points than otherwise possible with a given number of wheel and arrangement. It is worth noting that the computation of P, based upon W and A are performed at the end of each iteration of the loop (where the parameter appears). If W or A are altered within the loop, the effect is to alter dynamically the upper bound of the loop and this is permitted but not recommended.
The Go command consists of the exclamation point optionally followed by a parameter. In the usual case, the parameter is omitted. The Go command causes a pattern to be drawn. It is the only way a pattern can be drawn. The pattern is drawn using the current state of the drawing apparatus and the current state is not altered by the Go command (unless a parameter is included). Therefore, executing the Go command more than once without executing another command to alter the apparatus would have the effect of drawing a pattern over itself and this is permitted but not recommended.
In the alternative form, the exclamation point is followed by a parameter which represented a fraction: the first number is the numerator and the second is the denominator. If either is omitted, one is assumed (although if the denominator is one, the numerator must be one as well). And a fraction greater than one is not permitted. The fraction is the fractional part of a pattern to draw. This partial state is maintained after the completion of the Go command so a subsequent Go command can complete the pattern. The only reasonable thing to do with this form of the Go command is to change the color part way through a pattern. Changing anything else about the drawing apparatus (hole, shift, wheel, arrangement, etc.) will reset the partial state of the pattern to the starting position.
Although the term pattern is used loosely, it may be defined formally as it pertains to the Go command as follows: given an arrangement with a number of teeth, A, and a wheel with a number of teeth, W, the number of teeth, T, engaged and traversed in a pattern is A times W divided by the Greatest Common Factor of A and W. In other words, T is the Least Common Multiple of A and W. The number of circuits of the arrangement is T divided by A and the number of circuits of the wheel is T divided by W. Less formally, a pattern is exactly one closed loop. In the alternative form, it is necessary that the number of teeth, T, times the fraction is a whole number. Formally, given a fraction N over D, then D must be a factor of N times T. In practice, N over D is given in reduced form (no common factor), so D must be a factor of T.
There are three types of color words: the definition and two commands. Colors initially appear in a definition called a color map which is a series of one or more color names enclosed in angle brackets < >. The color names are four: red "r", green "g", blue "b", and black "x". The designation of black is unfortunately, but since it is rarely used in practice and is a unique color, the mnemonic "b" was preferentially associated with blue. It is worth noting as a memory aid that "rgb" in that order is an acronym used to describe color television equipment as these are the real colors present in the picture elements and that black is produced by activating none of these elements.
The color names themselves are only permitted within a color map. They
may not appear by themselves within a design definition. If a single
color is wanted, for example, black, it may be obtained by defining it
as the sole color in a color map, for example
The series of color names within the angle brackets represents a sequence of colors for subsequent use. Colors exist independent of any other state of the drawing apparatus; an existing color map can only be superceded by a new color map and only deactivated by the completion of the entire drawing. The execution of a color map sets the current color to the first color in the map.
The first of the two color commands is the letter "c" optionally followed by a parameter which is a single number. If the number is omitted, the current color is set to the first color in the current color map. If the number appears, the current color is set to the color within the map with that number counting from one, left to right. The color map "wraps around" so that, for example, in a map of five colors, the first color is also the sixth.
The other color command is a sign (plus or minus) followed by the
letter "c" optionally followed by a parameter which is a single
number. This form is used to increment (with plus) or decrement (with
minus) through the color map. If the number is omitted, one is assumed.
For example, "+c" sets the current color to the next color in the map,
and "−c", the previous. Again, the map wraps around. So, a sequence
of patterns to be drawn "blue, blue, red, blue, blue, red, blue, blue"
can be specified with the map
There are two hole commands. The first is the letter "h" optionally followed by a parameter which is a single number. If the number is omitted, one is assumed. The current hole is set to the number given. The current hole exists independent of any other state of the drawing apparatus, the current hole number can only be changed by a new hole command or the completion of the design. Because hole one is so commonly used, especially to begin a drawing, this hole number is automatically set at the beginning of a design and need not be explicitly set, although the explicit initialization is always recommended.
The other hole command is a sign (plus or minus) followed by the letter "h" optionally followed by a parameter which is a single number. This form is used to increment (with plus) or decrement (with minus) the hole number.
The wheel commands are three, the first of which is essential. A wheel is designated by its number of teeth, its circumference counted in units of the distance between teeth. In spiro, the unit of distance is the tooth and so can be used interchangeably in description of wheels and parts through this discussion. There is, in fact, no distinction made between using the outside of a ring as an arrangement versus using a wheel as an arrangement. Furthermore, when a ring is used as a wheel, it is referenced simply as a wheel with the number of teeth on the outside of the ring. Formally, a wheel is the moving part and an arrangement is the stationary part when a pattern is drawn. Also, wheels are not limited to those actually available, any wheel number is permitted.
The essential wheel command is the letter "w" followed by a parameter which is a number, the number of the wheel.
The second, rarely used wheel command is a sign (plus or minus) followed by the letter "w" optionally followed by a paramenter which is a single number. This form is used to increment (plus) or decrement (minus) the wheel number.
The final, exotic, wheel command is the letter "u" followed by a number, the number of the wheel: turned upside-down. This has the effect of shifting the pattern one half of a tooth to the right along the arrangement.
A part definition has two general forms. The first is the letter "p", "q" or "l" followed by parameter which is a number optionally followed by a slash and another number. In its simplest version, the inside of a ring, a part definition is the letter "p" followed by the number of teeth along inside of the ring. The outside of a ring is defined by the letter "q" followed by the number of teeth along the outside of the ring. These forms designate parts, not arrangements. To use a ring "part" as an arrangement in a drawing, these forms must be enclosed in square brackets [ ] (see arrangements below).
In general, "p" is used to define the inside and "q", the outside, of a curved part. "l" defines a straight part. As a memory aid, "p" is the most commonly used, inside of a part. The letter "q" is the mirror image of "p". When constructing arrangements of super parts for the purpose of drawing inside the arrangement, in order to use the outside of a part, it necessary to turn the part upside-down. The letter embossed on the transparent part is visible as its mirror image. Finally, "l" may be associated with the term "length" and the parameter associated with "l" is the length, in teeth, of the part.
After the letter "p", "q" or "l" is the parameter which is a number optionally followed by a slash and another number. The first number, in the case of "p" or "q" is the number of teeth along the inside or outside of a complete ring of such parts. The second number divides the circle into as many sections. The part is one of these sections. For example, if this second number is eight, the part is one eighth of a circle. If the second number is omitted, one is assumed; in other words, a ring. It is worth noting that the first number divided by the second is the number of teeth in the part, which must be a whole number. However, the pair of numbers does not represent a true fraction; for example, it is not possible to define a part which is two-thirds of a circle. It is permitted to use a second number with the "l", straight part, definition, the result is to divide the first number and the result must be a whole number.
The other general form of a part is the letter "p", "q" or "l" followed by a user name optionally followed by a slash and a number which works like the second number discussed above. It has the effect of cutting the named part into as many pieces and is useful in the transformation of arrangements discussed below. The user name comes from a prior part assignment (see assignments below). The letter "p", "q" or "l" used to invoke the user named part must be the same letter used to define the part in the prior assignment. Parts with the same user names but different defining letters are considered different. All physical parts except wheels have an inside and an outside, however, both sides are rarely used in the same drawing. Rather than require the definition of both sides, the spiro interpreter considers the two sides to be separate parts. However, since super parts use the same name to refer to both the inside and outside of the physical part, the spiro interpreter permits this name to be used for both by distinguishing between the "p" part and the "q" part by the same name. For consistency, an "l" part is also considered different from a "p" or "q" with the same user name. Of course, there is no real distinction between inside and outside for a straight part.
There are two forms of arrangement definitions. In its simplest form, an arrangement defintion is a part defintion, necessarily a ring, enclosed in square brackets [ ]. The other form is the letter "a" followed by the user name of an arrangement defined in a previous assignment (see below). An arrangement is a complete circuit of parts usable for drawing. A part that is a ring, though it is a circuit, does not, by itself have the status of an arrangement. Arrangements are subject to the test of being a circuit, parts are not, and therefore parts may not appear by themselves in the definition of a design. Parts are permitted only within an arrangement definition. A ring "part" may be easily elevated to the level of an arrangement, essential in a design definition, by enclosing the part definition in square brackets [ ].
Arrangements exist independent of any other state of the drawing apparatus; an existing arrangement can only be superceded by a new arrangement and only deactivated by the competion of the entire drawing.
In the general form, an arrangement definition is a series of part definitions enclosed in square brackets [ ] optionally followed by a parameter which is a number and/or a slash followed by another number. If either is omitted, one is assumed. The first number is the translation count and the second, the reflection count, discussed below. The list of parts taken left to right forms the construction of a path. Ultimately, the path must return to the starting point and point in the original direction having made one complete rotation. The starting point must be along a top edge of the arrangement and in the direction exactly from left to right. This is also the starting point for all pattern drawing, unless the the pattern is shifted (see shifting below). Still the arrangement starting point is the starting point for shifting. The arrangement starting point must lie along a top edge, but need not be the highest point on the arrangement. So long as the proper direction is satisfied, a top edge is any point where the wheel will pass directly below, for inside patterns, or above for outside patterns. Nevertheless the orientation and location of an arrangement may be modified by the orientation, location and automatic scaling commands (see below) but these need not be considered for ordinary drawing.
There is no explicit declaration of whether the inside or the outside of the arrangement is to be used; this is implicit in the requirement of a top (rather than bottom) edge starting point. It is similarly impossible to change from drawing on the inside to the outside without declaring a new arrangement. This is not a real limitation since drawing on both sides is rarely done and automatic centering prevents most alignment problems.
An arrangement has a center which is used by the orientation command (see below) and for automatic centering. The center is, in effect, used for aligning two or more arrangements in the same drawing. In practice, the centers align themselves in intuitively obvious ways and require no consideration. In rare cases, it is necessary to know where the center lies. Formally, the center of an arrangement is the centroid (center of mass) of the arrangement path. The computation of centroid is inconvenient but only necessary in as much as an arrangement lacks symmetry. There are no practical instances of arrangements with no symmetry. The trapezoid is the only practical instance of an arrangement with exactly one line of reflectional symmetry and the centroid necessarily lies on this line. In any other type of symmetry, which includes all other arrangements seen in practice, there is a point of rotational symmetry. (Any two lines of reflectional symmetry is necessarily equivalent to rotational symmetry about the intersection of the two lines.) This point of rotation is necessarily the centroid and therefore the center of the arrangement. Thus the center of an arrangement is the center of rotational symmetry which is almost always present, and is easy to find.
The most interesting features of arrangement definition are the optional translation and reflection counts of the parameter. The translation count is analogous to the repeat count of the repeat command. The parts are repeated the given number of times. The reflection count is similar: the second time through the list, the list is read from right to left generating a reflection. The list is read backwards every other time. These transformations allow symmetrical arrangements to be defined clearly with their symmetrical properties intact.
It is worth noting that practical arrangements tend to have a large amount of symmetry. Virtually all have a line of reflectional symmetry; those that do not tend to have radial symmetry. Radial symmetry is represented by the translation count. Combinations of the two are possible. In this case, the translation count is regarded as an inner loop and the reflection count, the outer loop. The total number of repetitions is thus the product of the two counts.
There are several commands for shifting the starting point of patterns within an arrangement. These form a hierarchy: zig-zag "z", tooth "t", fill shift "f" and mark "m", in order from lowest to highest. Ultimately, all these commands do the same thing, but each is intended to be useful in a different context. Many, but not all, combinations of these are useful. To facilitate this, these commands affect one another. In particular, each of these commands has no effect on the shift of a higher level command and each sets the shift of every lower level command. Also, the current shift actually used for drawing is that of the last shift command; in other words, the current shift for drawing is on the lowest level of all. Finally, a new arrangement definition sets the shift for all commands and drawing to the starting point of the arrangement.
All these commands have two forms: absolute which is the letter optionally followed by a parameter and relative which is a sign (plus or minus) followed by the letter optionally followed by a parameter. In the relative form, the shift is (forward or backward) relative to the shift of the last command at the same level. In the absolute form, the shift is absolute for that level, but still relative to any higher level command.
The four shifting commands are described below in order from the bottom to the top of the heirarchy, although it would be more instructive to consider the tooth command before the zig-zag command.
The zig-zag command is used to draw patterns alternately on either side of a tooth for the purpose of centering a group of designs on that tooth. Zig-zag sequence is 0, 1, −1, 2, −2, etc., relative to the current "t" tooth. Normally only the command "+z" is useful, although "z" alone resets the sequence to the current "t" tooth. In general, the first form is the letter "z" followed by an optional parameter which is a number. If the number is omitted, zero is assumed. The effect is to set the zig-zag counter to the element with that number in the sequence counting from zero. The second form is a sign (plus or minus) followed by the letter "z" optionally followed by a parameter which is a number. If the number is omitted, one is assumed. The effect is to change the zig-zag counter from its position in the sequence to that which follows (plus) or precedes (minus) by the given number of elements.
The tooth shift has two forms. The letter "t" optionally followed by a parameter which is a number sets the current tooth (at which to begin patterns) to the given tooth counting from zero at the starting point of the arrangement. If the number is omitted, zero is assumed and the current "t" tooth becomes the current "f" tooth.
The second form is a sign (plus or minus) followed by the letter "t" optionally followed by a parameter which is the number of teeth to move the current tooth forward (plus) or backward (minus). If the number is omitted, one is assumed.
In some cases it is useful to draw several patterns with the points of each equally spaced. This is most often in a context where the relative spacing between points is well understood but neither the exact number of teeth nor the total number of points of the pattern are conveniently available. The fill shift is used both to center a pattern between others and, in conjunction with the repeat command, to draw a number of patterns with the points of each equally spaced.
The fill shift has two forms. The first is the letter "f" optionally followed by a parameter which is a number and/or a slash followed by another number. If either number is omitted, one is assumed, but if both are omitted, the first is assumed to be zero, resetting the fill shift tooth to the current "m" tooth. The parameter represents a fraction with the first number the numerator and the second, the denominator. The current fill shift location is set (relative to the current "m" tooth) to that fraction of the space between points of a pattern drawn with the current arrangement and wheel.
The second form is a sign (plus or minus) followed by the letter "f" optionally followed by a parameter which is a fraction, as in the first form. The fraction is interpretted the same way except the location is shifted forward (plus) or backward (minus) relative to the current fill shift location.
Formally, given an arrangement with a number of teeth, A, a wheel with a number of teeth, W, the number of teeth between points, T, is the Greatest Common Factor of A and W. Given a fraction N over D, the shift caused by the fill command is T times N divided by D. This must be a whole number. So, D must be a factor of T times N. In practice, N over D is given in reduced form (no common factors), so D must be a factor of T.
In most cases this command is used to draw a given number of patterns with equally spaced points. For example, if this number is four, after each pattern is draw the command "+f/4" is used to provide the proper shift and this is all enclosed in a repeat command with a count of four. It is worth noting that this command is dependent upon the current wheel (and arrangement) at the time the command is executed. If the wheel were changed within the aforementioned repeat command, the behavior of the fill shift command may be changed as well.
The mark command has three forms. The first is simply the letter "m". This resets the current mark (and all other shift commands) to the starting point of the arrangement. The second form is the letter "m" followed by a parameter which is a number and/or a slash followed by another number. If either number is omitted, one is assumed. (Note the command without the parameter is a special case which does not follow this rule). This parameter forms a fraction. In this form, the shift is relative to the starting point of the arrangement. The final form is a sign (plus or minus) followed by the letter "m" optionally followed by a parameter which is a fraction. In this form, the shift is relative to the current mark.
The fraction is taken as a mixed number, that is a whole number plus a fraction less than one. This mixed number represents the number of whole "parts" to shift, plus the fraction of the next "part", counting from zero at the first "part". If the part finally located has T teeth and the fraction is N over D, T times N over D must be a whole number. The term part used with the mark command is similar, but not the same as that used in the part command. Since equivalent arrangements can be built from different parts, it is preferable to specify marks independent of these particular parts. For example, a simple ring could be constructed of a single part, two half circle parts, three one-third circles, etc., yet these arrangements are effectively identical. If marks were defined dependent upon the particular parts, the mark half way around might be "m/2", "m1", "m3/2", etc. This is unacceptable. In fact, the only correct representation of this mark is "m/2" as defined below.
A sequence of parts (in the sense of the "p", "q" and "l" commands) with the same curvature are regarded as a single "part" in the use of the mark command. Curvature is the amount and direction of bending of a part. Thus all adjacent straight "l" parts are regarded as a single "part". Adjacent inward curving "p" parts with the same circumference (first number of the "p" parameter) are regarded as a single "part". Finally, adjacent outward curving "q" parts with the same circumference are regarded as a single part, for use with the mark command. Also, there is no "wrap around" from last part to first part of an arrangement in this definition. In other words, the first and last parts are not considered adjacent here. This apparent exception is necessary to keep the definition of the starting point of an arrangement crystal clear since it is the essential reference point.
The mark command is the highest level shift command. Its principle use is to fix absolute starting locations for patterns. The mark command is also used in conjunction with the alternative form of the repeat command to produce drawings with a given number of points, using wheels which do not produce as many points in a single pattern. If the required number of points is twelve, after each pattern is draw the command "+m/12" is used to provide the proper shift and this is all enclosed in a repeat command of the form "( ... )/12". It is worth noting that the number of points generated by all the wheels in such a loop must be a factor of the number of points required, in this example, twelve.
The continuous drawing command has two forms: the letter "k" optionally followed by a parameter (the absolute form) and a sign (plus or minus) followed by the letter "k" optionally followed by a parameter. The parameter is a number and/or a slash followed by another number. In the absolute form, the current continuous drawing location is relative to the starting point of continuous drawing. The starting point is reset by the definition of a new arrangement. In the relative form, the location is relative to the current location. If the slash and the second number, or the entire parameter, is omitted the translational component of continuous drawing is selected. If the slash and the second number is included, the rotational component is selected.
Continuous drawing is the technique of locking a ring between two parallel racks by engaging the teeth along the outside of the ring with the teeth of each rack. The racks remain fixed throughout the process; however the ring may be lifted and moved between the racks and re-engaged in another location. Of course, patterns are drawn while the ring is in place. In the simplest case, the ring is moved without rotation by moving the same number of teeth along both racks. However, the more interesting case occurs when the teeth of the ring are left engaged with one of the racks and the motion is only along the other rack. The effect is to roll the ring. In fact, there are two component motions in rolling. The first component is translation, which is the same as simple case of moving the same number of teeth along both racks. The other component is a rotation. For example, moving two teeth forward along one rack is clearly identical to moving one tooth forward along both racks (translation) followed by moving one tooth forward along one rack and one tooth backward along the other (rotation).
The continous drawing command, in theory, is not limited to moving rings. The necessary component for rolling is the number of teeth along the outside of the ring, although there is no connection between this outside circumference and the arrangement used for drawing. In fact, it is permissible to draw along the outside of an arrangement using the continuous drawing command, although there is no physical equivalent using real drawing apparatus. Continuous drawing, however, must be horizontal. Nevertheless, the continuous drawing itself can be rotated using the orientation command (see below). In the context of this command drawing is horizontal, so there is a top and a bottom rack. Also the positive direction is left to right and rotation is measured clockwise. Formally, then, given the number of teeth to move along the top rack, T, and the number of teeth to move along the bottom rack, B, the number of teeth in the translation component is T plus B while the number of teeth in the rotation component is T minus B.
It is worth noting that the translational and rotational component numbers are twice as large as would seem proper. This is due to the fact that the movement along one edge of the ring is acting on the opposite edge of the ring, rather than the center. It is also worth noting that when the ring is translated, it is customary to move the ring toward the right. When using a real set, it is necessary to begin a safe distance to the left. Similarly, the automatic centering mechanism is effectively defeated by translating the ring to the right: the center of the arrangement is determined when the arrangement is specified and so the continuous drawing will appear on the right side of the display area. To provide proper centering, it is necessary to balance the drawing about the center by beginning half the distance to the left. For example, if a complete continuous drawing will move 50 teeth to the right, begin 25 teeth to the left (in order to end 25 teeth to right).
The parameter for the translational component is simply a number which is the number of teeth T plus B. If this parameter is omitted, zero is assumed for the absolute form (reset the translational component) and one for the relative form (move one tooth). The direction is left to right for a positive number and right to left for a negative number.
The parameter for the rotational component is a number followed by a slash and another number. The first number is number of teeth to rotate clockwise along the top rack minus the number to rotate counterclockwise along the bottom. If this number is omitted, zero is assumed for the absolute form (reset the rotational component) and one for the relative form (rotate one tooth). The direction is clockwise for a positive number and counterclockwise for a negative number. The second number is the number of teeth along the outside of the ring.
A few examples are useful. Moving one tooth top and bottom to the right is "+k2". One tooth top and bottom to the left is "−k2". Assuming a outside ring of 144 teeth: one tooth top right is "+k/144 +k"; one tooth bottom right is "−k/144 +k"; one tooth top left is "−k/144 −k"; and one tooth bottom left is "+k/144 −k".
The polygon command has the absolute form, the letter "y" optionally followed by a parameter, and the relative form, a sign (plus or minus) followed by the letter "y" followed by a parameter. The absolute form without a parameter resets the polygon center and orientation. The parameter forms a fraction. The polygon command heuristically determines the center point of a polygon with the number of sides given by the second number of the fraction. In both the absolute and relative form, the arrangement is effectively translated so that the center point of the polygon becomes the new center point of the arrangement. Then the arrangement is rotated by the given fraction of one rotation, either absolutely, or relative to the previous "y" rotation angle. A new arrangement or orientation command resets the polygon orientation.
This command is normally used in conjunction with the repeat command with a repeat count which is the required number of sides. The super square is an instance of this with the command "+y/4" enclosed in a repeat command with a count of four. A polygon command must appear before any drawing begins in order to provide the initial translation.
The positioning commands are two: "i" for positioning left to right and "j" for positioning top to bottom. The center of all designs are normally positioned at the same location in the center of the physical display device. These commands change that position for subsequent drawing. The absolute form is the letter "i" or "j" optionally followed by a parameter and the relative form, a sign (plus or minus) followed by the letter "i" or "j" followed by a parameter. The parameter forms a fraction which is a number of teeth and measures the distance to move the drawing center point. The absolute form without a parameter resets the position in the direction given by the command letter. These are only reset by the completion of an entire drawing.
The orientation command has the absolute form, the letter "o" optionally followed by a parameter and the relative form, a sign (plus or minus) followed by the letter "o" followed by a parameter. The parameter forms a fraction which is the part of one complete clockwise rotation to rotate all subsequent drawing. The absolute form without a parameter resets the orientation. The orientation is only reset by the completion of an entire drawing.
The scale command has the absolute form, the letter "s" optionally followed by a parameter and the relative form, a sign (plus or minus) followed by the letter "s" followed by a parameter. The parameter forms a fraction which is the factor by which to scale all subsequent drawing. The absolute form without a parameter resets the scale to the automatic scale. The absolute form with a parameter sets the scale factor relative to automatic scaling. The relative form expands (plus) or compresses (minus) the current scale by the given factor. The scale is only reset by the completion of an entire drawing.
Each drawing is automatically scaled to fit the physical display device. The scale command supercedes, but is still relative to the automatic scaling. The actual effect of scaling a drawing beyond the limits of the physical display device is beyond the scope of this document. Similarly, it is possible to specify hole numbers that lie outside of the wheel and wheel numbers that are larger than the arrangement, the automatic scaling only accounts for the various transformations, the arrangement, holes which lie between the edge and the center of the wheel and, in the case of drawing outside the arrangement, the wheel. Unless the drawing is scaled down or other designs lie in the outlying area, the limits of the physical device may be exceeded.
A design definition is a series of words enclosed in braces { }, also known as curly brackets. A design reference is the letter "d" followed by a user name. The name comes from a prior design assignment (see assignments below). A design definition may refer to another design and so becomes part of the referring design.
There are five types of assignments: designs, arrangements, "p", "q" and "l" parts. An assignment is a user name followed by an equal sign = followed by definition of the appropriate type. The spiro program file is a list of assignments. Once a user name is defined in an assignment it may be subsequently used in the appropriate context, or, in the case of designs, referenced from the command line when the interpreter is run.
The actual equipment available in a Spirograph™ set, besides the four pens, are:
| Teeth | Holes | Teeth | Holes | Teeth | Holes | ||
|---|---|---|---|---|---|---|---|
| 24 | 5 | 45 | 16 | 63 | 25 | ||
| 30 | 8 | 48 | 17 | 64 | 25 | ||
| 32 | 9 | 50 | 18 | 72 | 29 | ||
| 36 | 11 | 52 | 19 | 75 | 31 | ||
| 40 | 13 | 56 | 21 | 80 | 33 | ||
| 42 | 14 | 60 | 23 | 84 | 35 |
The Super Spirograph™ set also includes:
The terms "Spirograph" and "Super Spirograph" are trademarks or were trademarks of the Kenner toy company. The printed material associated with the toy was copyrighted 1969.
The U.S. Patent No. 3,230,624 was granted on Jan. 5, 1966 and apparently reissued as U.S. Reissue Patent No. 26,341 on Feb. 6, 1968 to Denys Fisher of Leeds, England. The patent describes every detail of the original set, save the pins, including continuous drawing and turning the wheel upside-down. The notion of an arrangement that is neither ring nor rack is mentioned briefly but there is no reference to the "super" set notion of constructing the arrangement from component parts. The patent has long since expired.
In reality, the distance between teeth, the fundamental unit of distance used by this program, is about 2 mm. Hole number one is about 3 mm from the edge of the wheel. Each succeeding hole is about 0.65 mm further from the edge. This program also attempts to account for some of the imperfections of the gear mesh and the fit of the pen inside the hole.
To create an original aesthetically pleasing design requires a particular artistic and mathematical talent, of course. The major features of any design are the "points" produced when the hole passes closest to the arrangement. Customarily a pattern is drawn as one complete closed loop (even if colors are changed en route). The number of points, then, is purely a function of the number of teeth on the arrangement, A, and wheel, W. The number of points, P, is A / GCF(A, W), that is, A divided by the Greatest Common Factor of A and W. It is usually desirable that P be reasonably small. Often an interesting design can be achieved by using more than one wheel but all of which generate the same number of points. Or, for instance, a wheel that generates 6 points on a particular arrangement might be used with a wheel that generates 3 points, the latter being used twice and "fill shifted" the second time.
In any case, the relationship of A, W and P is useful to known well in advance. In practice, the user firstly will select an arrangement and thus the value A. Then a wheel might be experimented with and a value of W leads to a value of P. At this point the user wants to know of other wheels which produce the same or a compatible number of points. Or perhaps, the user regrets his choice of wheel because it produces an absurd number of points and instead resolves to select a reasonable value for P and use whatever wheels lead to that result.
To facilitate this type of design work, the following lists provide this information for the wheels, rings, racks and commonly used arrangements of the actual set. (There are far more possibilities available with this program than the actual set.) The lists are organized by arrangement with the number A in parentheses. Under each arrangement is listed the number of points, P, possible with the actual wheel numbers, W, listed in parentheses. For clarity, the wheel numbers are preceded by the letter w. For instance, if one wishes to use the inside of the large ring (which has 105 teeth) and produce 7 point patterns, one may use wheels 30, 45, 60 and 75. (However, a wheel 90 could also be specified using this program.)
The numbers systems used by computers ordinarily are integers and floating point numbers. Except for their limited range, computer integers are like mathematical integers. And except for their limited range and precision, computer floating point numbers are like mathematical real numbers. In between, lie rational numbers or fractions, which are never directly implemented in computers.
This program makes extensive use of rational numbers and the user has the opportunity to gain an intimate familiarity with their unique qualities. One of the few technical discussions of rational numbers in computers is section 4.5 of "The Art of Computer Programming" in volume 2, "Seminumerical Algorithms," by Donald Knuth.
In this program, the mathematics of rational numbers is closely associated with factors and prime numbers and is worth a brief discussion. For whole numbers greater than one, any two numbers multiplied together produce another whole number. These two are factors of the produced number. Thus every whole number greater than one may have a collection of factors. Of course many numbers have no collection at all, and these are the prime numbers. Every non-prime number may be produced by multiplying together two or more prime numbers. Every set of two or more prime numbers multiplied together produces a different non-prime number so this set is called the prime factors of the non-prime number. It is also said that every single prime number is its own prime factor. Therefore, every whole number greater than one has a unique set of one or more prime factors. It is important to note that the prime numbers in these sets need not all be different. For example, the prime factors of 12 are 2, 2 and 3. In practice, finding the prime factors of a number requires finding factors of factors repeatedly until only the primes remain.
The number one is usually omitted from discussions of prime numbers since it confounds an otherwise useful theory, but it may be reasonably said that one is the number with no prime factors. The number zero is the black hole of multiplication, the destroyer of factors. Representing zero is sometimes necessary and must then be regarded as a special trivial case. Negative numbers have some corresponding positive number, so the sign of a number is a two state property of a number. No further discussion of negative numbers is interesting.
Any two whole numbers have a Greatest Common Factor. Stated as such, it is the largest factor that is a factor of both original numbers, or as a last resort, it is one. It is more informative to describe Greatest Common Factor in terms of prime factors. For any two sets of prime factors, the Greatest Common Factor is the set of prime factors common to both of the original sets. For example, the GCF of 36 and 90 is 18. This may not be obvious. But if 36 is factored into 2×2×3×3 and 90 into 2×3×3×5 it is clear the the common prime factors are 2×3×3 or 18.
The Greatest Common Factor often appears in the context of rational numbers. A positive rational number is the quotient of two whole numbers, but stated as such there are many pairs of whole numbers that produce the same rational number. These duplicates may be identified by the GCF of the pair. A positive rational number is conveniently stipulated to be the quotient of two whole numbers with no common factors, that is, a GCF of 1. A positive rational number not expressed in this way is said to be not in reduced form.
For any two whole numbers, Least Common Multiple is the smallest number that has both the originals as factors. In terms of prime factors, if Greatest Common Factor is the set common to both the two sets of factors, then Least Common Multiple is the set unique to the first number, the set unique to the second number and the set common to both, all taken together. Obviously the resultant set is the smallest that contains all the factors of both the originals.
To fully appreciate the mathematical machinations of this program, therefore, one must readily think of a number and its prime factors interchangeably.