Trailing-Edge
-
PDP-10 Archives
-
walsh_goodStuff_1600
-
more-uns/roses.txt
There are no other files named roses.txt in the archive.
-1d,2520s,1%
This is Roses, a program that generates pretty patterns on the GT40.
The algorithm was originally developed at Stanford University, then
migrated to Carnegie -Mellon Univ., where this program was developed for
their display system.
The range of designs that can be made is in the millions - we can draw
curves as simple as circles:
-1&,10v,1?,2520u,7s,0p,0r,0o,-1t,1h,%,2&,1%
We can draw geometric figures:
3&,420s%2&,630s2&,1008s2&,1%
On the other hand, we can draw patterns so complex that the GT40 cannot
run fast enough to prevent flicker:
6&,1?,631s,323p,%,6&,1%
And we can draw a lot the GT40 can handle:
2&,5v,1?,58s,303p,%,4&,2v,1?,248s,255p,5&,1?,244s,32p,6&
,,,1v,1?,729s,720p,6&,1?,834s,143p,6&,5v
1?,106s,139p,4&,1?,217s,44p,4&,1?,763s,224p,4&
,,,1?,208s,64p,4&,1?,928s,841p,4&
1?549s,142p,4&,639s,4&,1?,212s,3p,4&
,,,425s,4&,565s,4&,1?128s,5p,4&,282s,4&
1?,513s,467p,4&,1?,355s,101p,4&,1?,76s,667p,4&
1?,7s,1261p,4&,203s,4&,625s,4&
1?,71s,71p,6&,1?,34s,371p,4&,1?,142s,303p,4&
3v,2?,-421u,421s,629p,5&,1?,-631u,317s,6&
1%
So, just how does Roses work? We actually are attempting to draw curves
that are called roses in analytic geometry. The parametric form of the
curve is:
X=COS(T)COS(AT)
Y=SIN(T)COS(AT)
Where A is integral and T varies continuously from 0 to 360 degrees.
Note that if A=0, the equations reduce to that of a circle, so a Rose is
just a circle multiplied by a sinusoidal scale factor. If A is odd, the
Rose will have A petals (and complete after only 180 degrees). If even,
then 2A petals.
Here are the first few even Roses:
-1&,1?,2520u,7s0p,4v,%,4&,2p4&,4p4&,6p4&,1%
And here are some odd order Roses:
Quick - what does a first order Rose look like?
-1&,1p%3&,3p,3&,5p,3&,1%
To draw a Rose given its equation, one connects a series of points known
to be close together. That is precisely how the Roses we just saw were
drawn - the program took 360 points to do it, probably much more than a
person would try. Watch as we reduce the number of sample points to
180, 90, 60, 30, 18, 8, 4, and 2 for a second order rose (4 petals).
This means we will be sampling every 2, 4, 6, 12, 20, 45, 90, and 180
degrees.
-1&,2p,14s,%,3&,28s,3&,42s,3&,84s,3&,140s,3&,315s,3&,630s,3&,1260s,3&
1%
They don't come much less interesting than that last one! One trick to
making an interesting pattern is to use a sampling rate that is not
quite a factor of 360 degrees. The program will have to draw several
hunderd vectors near each other to get back to the starting point, where
it stops.
Let's try it. Here's what happens when we sample a second order Rose
every 90 degrees:
-1&,630s%,1&,-1&,1%
You remember him. What happens if we try a sample rate of 89 5/7
degrees? Watch:
,7&,1?,-315u,628s,3v,%,-7&,1%
After 4 vectors, we've gone 358 6/7 degrees, are almost back at the
start, and have nearly completed a box.
4&,1?,-4u,2p,%,-3&,1%
If we draw 4 more vectors, we will have 2 boxes:
3&,1?,-8u,2p%,-3&,1%
The second one, of course, is slightly rotated because all 4 corners of
the box must lie on the Rose. Furthermore, the box must shrink as it
rotates! Continuing the process gives us the final form. Watch again
and notice that the corners all lie on the Rose.
-1&,1?,-315u,2p,%,-5&,1%
What happens as we increase the order of the Rose while leaving the
sample rate small? We will then be attempting to draw Roses with so many
petals that 360 points will no longer be sufficient to accurately
display it. Watch Roses of orders 2, 12, 24, 58, 90, 108, 122, and 178
drawn with only 360 points.
-1&,1?,-360u,7s2p,%,3&,12p,3&,24p,3&
,,,58p,3&,90p,3&,108p,3&,122p,3&,178p,3&
1%
Enough on how the algorithm works. Let's look at all the numbers around
the screen and how they're set. Roses is controlled by several single
character commands, often with a number typed before the command. If a
number is typed, it may be negative; if you mistype it, type a rubout to
clear it, and try again. The bright number in the upper right hand
corner is simply the order of the Rose, and is commonly called the petal
number. While we were looking at the second order Rose and all its
permutations, this number was always 2. This number is set by the P
command.
-1&,1%
The bright number in the upper left hand corner is another old friend.
It is simply the sampling rate (commonly called the style number) in
sevenths of a degree. To show those 360 point Roses, this was set to 7,
giving a sampling rate of 1 degree, so the 360th point would bring us
back to the start. This number is set via the S command.
We've seen lots of examples of changing these two parameters, no need
for any more.
-1&,1%
Another basic parameter in drawing a pattern is the vector generation
rate, set by the V command, and is displayed in the lower left hand side
of the screen. If it is 0, then the pattern is drawn as fast as
possible, otherwise, that many vectors are drawn per jiffy, where a
jiffy is 1/60 of a second west of the Atlantic and 1/50 east of it.
Here's the slowest mode for a long (2520 vector) pattern:
-1&,1v,1?,2520u,1s,2p,%,12&,1%
That's really too slow. Let's try it at full speed:
3&,v,2p,%,3&,1%
Much more reasonable. Values between 4 and 10 are usually most
interesting.
5&
1%
One very interesting capability is automatic mode. In this mode, after
a pattern has been displayed for a while, either style or petal or both
are changed, and a new one is drawn. This mode is at its best after 3
A. M. when everyone has lost the creativity needed to continually think
up new numbers. An appalling amount of lost sleep has been caused by
automatic mode, handle it with care!
Both the style and petal have their own increment commands. The style
increment is set by the R command (one character before S), and the
petal increment is set by O (one character before P). The increments
are displayed inside parentheses after the style and petal values.
-1&,1%
Once the increments are setup, automatic mode is started by typing the
number of jiffies desired between Roses with the T command. 60 or 120
(1 or 2 seconds) are generally good values. If you type just the T, the
last non-zero value will be used so simply typing T will usually do the
right thing. The current value of T is displayed is in the lower right
corner.
Here's part of one particularly good series:
-1&,7s,8192p,6v,14r,100t,%,-30&,1%
To provide examples of different modes of operation, the M command will
simulate changing all the above parameters to enter a different area of
interest. Currently there are 4 different modes available by typing its
number followed by M:
1) A dynamic mode that has a continuously changing display. Watch:
-1&,1m,%,-15&,1%
2) A flicker pattern good for experimentation:
3&,2m,%,-10&,1%
3) A mode for simple experiments by novices
4) The series Roses initially starts in.
When M is typed without a number, Roses will enter the next mode,
providing an excuse to not remember the mode numbers.
-1&,1%
There are several other little commands that help automatic mode along:
B - Negate both increments (backup). Good for seeing that pattern that
almost escaped.
J - Jump forward or backwards the number of patterns specified (positive
for a forward jump, negative for a backward jump). If no number is
typed before the J, 1 is assumed.
<SP> - Space has different functions depending on the current mode.
Automatic: leave automatic mode. The space key is used since it easy
to hit before that pattern is overwritten.
Manual: Act as J. An easy way to single step through several
patterns.
-1&
1%
One often wants to put limits on the maximum number of vectors drawn (to
avoid flicker) or the minimum (to avoid seeing geometric figures or to
ensure enough vectors are drawn to force flicker). Enter the L and U
commands.
L sets the lower limit for allowing the current pattern to be drawn.
Any pattern that needs fewer than that number of vectors to complete
will not be drawn. Conversely, U sets the upper bound and prevents
patterns that require more than that number of vectors from being drawn.
If U is negative, instead of not drawing the pattern, only the first N
vectors will be drawn.
-1&,1%
This feature is meant to be used with the style and petal increments
from automatic mode. If Roses decides the requested pattern cannot be
drawn, it will wait 1 jiffy, step to the next one, and try again. Watch
as we draw patterns that require no more than 20 vectors via a 20U
command.
L and U are displayed on the left and right side of the inequality
displayed in the top center of the screen. The middle number is the
number of vectors required to complete the current pattern.
-1&,1s,2p,20u,1r,120t,1v,%,-15&,1%
And again, but with a 20L command, so only patterns requiring exactly 20
vectors will be displayed.
6&,1s,2p,20l,%,-15&
1%
The D command has two functions:
1D - remove the documentation text around the screen.
0D - restore the text so you can see what you're doing.
And when you finally tire of Roses:
Q - Quit Roses, return to the monitor.
And since you have already forgotten half of the commands:
H - a toggle to move in and out of the help page. Don't bother reading
it now, but it looks like this:
-1&,-1h,%,5&,1%
This "slide show" is finished, whatever Roses does next is up to you.
-1&,0d,0l,-1260u,0r,0o,10v,-1t,632s,3p,1h,%