Squirler, The - Colin Barnsley (Your Spectrum-Issue 13-Page 59)


Hands up all you budding Dalis and Da Vincis who, having spent
hours with the latest graphics packages, stand back from that 
flickering screen, wiping bloodshot eyes, only to come to the 
conclusion that you should have stuck to textual programs? And how about
those tasks the Art tutor used to set using a piece of string and an
eccentric cog that just didn't seem to, well ... work?
        Well, here's a nifty little program that'll create amazing graphics
for you - all it requires from you is a few numbers!
        The Squirler makes use of the INKEY$ command, and the current
state of the variables are displayed in the menu; INKEY$ is
used because, although it takes you longer to type this listing into
the Speccy, the time taken to execute the program is reduced
considerably. Another point to note is that the Spectrum calculates its
angles in radians and the program stores it as such - however, as
radians aren't the easiest quantities to work with, all the angles are
displayed in degrees.
        When you RUN the program, you'll be presented with a menu
on-screen; take a look at the options you're offered in the table
given. Once you've entered some figures, the program determines
how many arcs it's going to need to draw before your masterpiece is
completed. Then, once all the values have been written into
temporary variables for manipulation (without destroying their
original values), plotting begins on-screen. On a final note, if you
choose a variable that results in the Spectrum kicking back with an
'integer out of range' error message, you'll have to start the 
program up again with 'GO TO 20'.
        Do persevere with the program - it's not too long to type in, but
some may find it a bit tricky to end up with a decent drawing first
time out. Have a look at the sample inputs given ... and then experiment
a little. You'll probably find you create your best designs by
accident - but that's life!


OPTION          ACTION
start           The position on the circumference of an
                imaginary circle from which the very first arc is
                drawn; for example, '0' starts at the top, '270' at
                9 o'clock, and so on.
degree swing    The number of degrees turned through - from
                the imaginary centre (x,y) of a circle - in one
                arc; thus, '60' gives a six-pointed shape, '72' a
                five-pointed shape, and so on.
x,y position    This gives the imaginary position of the centre of
                a shape in pixels; the co-ordinates of the screen
                centre is about (128,87).
plots           The number of full drawings that'll be completed
                in the final design.
x,y slide       The number of pixels to be added or subtracted
                from the imaginary centre after each complete
                drawing.
circle radius   The pixel radius of an imaginary circle in which
                the shape is drawn.
circle squash   The percentage reduction in size (per full
                drawing of the shape) of the imaginary circle's
                radius; thus, a 'cir squash' of '5' reduces the full
                drawing of the shape by five per cent.
bend            The number of degrees through which the
                direction is changed in one arc of a 'degree swing'.
bend add        The constant number of degrees to add (for each
                complete drawing of the shape) to accomplish
                the required 'bend'.
degree revol'n  The number of degrees of turn needed to end up
                at the starting point; thus, when n>1, 'cir
                squash' and 'bend' gives a spiral effect.
plot            Draws the final design.


SQUIRLER EXAMPLE INPUTS
                WhirlingDevil   Flowers Limpet
                GalaxiesHelmet          Shell
circle radius   80      80      80      80
start           0       0       0       0
degree swing    72      180     20      40
plots           30      36      5       30
bend            60      40      300     50
degree revol'n  3       5       0       4
circle squash   3       0       10      5
bend add        3       0       -2      0
x position      128     90      128     90
x slide         0       2       0       2.5
y position      87      87      87      87
y slide         0       0       0       0.5


Line 10         Initialises the variables used in the program.
Lines 20-100    Display the various menu options available (see the Options
                table) and the current state of the variables. Note that the
                variable 'b' displays the angles in degrees, although the
                program itself stores this quantity in radians.
Lines 105-270   Update the variables as the program is RUN.
Lines 300-330   Determine the number of arcs per full plot of the shape.
Line 350        Moves the parameter values to the temporary variable set.
Lines 360-410   Begin the plotting on-screen. Calculations are made to find
                the value in radians that the shape should be turned through
                for the start and end of the swing, and a line is drawn
                between the points.
Line 420        Checks for the 'exit' routine. If a call has been made to go to
                the 'exit' routine, the program flow is resumed at line 500.
Line 430        Adjusts the slides and squashes once the shape has been
                plotted.
Lines 440-470   When you've finished creating your design on-screen,
                you're given the option to either re-draw the BORDER or COPY.
Lines 500-540   The 'exit' routine.
Line 600        The 'BORDER draw' routine.

------------------------------------------------------------------------------
TYPE: Utility 

COMMENT: 


This info file was typed by Jim Grimwood

Downloaded from:
Desert Island Disks -- http://www.image.dk/~frankie/
Maintained by:
Michael Bruhn -- frankie@image.dk
