Garland

Developer(s): Gertie Andersson
Date: 1986
Type: Program
Platform(s): TS 2068
Tags: Graphics

Draws a Christmas garland: two concentric rings of flowers in green ink on a red screen. Each flower is a set of seven curved petals, drawn as pairs of arcs out from and back to a point on the ring, and the second ring is larger and holds more flowers than the first. The size of the ring, the number of flowers and petals, the petal length and the curve of each petal are all set in plainly labelled variables at lines 110–240, so you can edit them to make other designs; the REMs advise using prime or odd numbers for the flower and petal counts.

REMs credit Gertie Andersson, October 1986, with thanks to Oleg D. Jefimenko, whose equations appeared in Timelinez 4/86. The program was published as “Garland” in Timelinez in April 1987.

Program Analysis

  • Lines 110–140: centre 128,87, radius 56 and 15 flowers. Lines 210–240: flower shape C=360, A=180, petal length 16 by 16, curve P=.375*PI and 7 petals.
  • Lines 405–480: for each of two rings, step T round the circle and plot a point, then draw the petals with DRAW H/.82,V,P: DRAW -H/.82,-V,P.
  • Line 500: the second ring gets radius +15 and 9 more flowers.

Notable Techniques

  • The third parameter of DRAW turns each petal into an arc of P radians, and drawing out and back with the same angle makes the two sides of the petal bulge apart.
  • Horizontal distances are divided by 0.82 to correct for the screen’s pixel aspect, so the ring comes out round rather than flattened.
  • A REM notes that there are 546 pixels in a circle of any size, and the ring step 546/F is built on that figure.

Potential Issues

  • Large radius or petal settings run the drawing off the screen and stop with an out-of-screen error.
  • The drawing takes several minutes in BASIC, and the program simply stops when it is finished.

This program came from an Oliger (JLO SAFE) disk and was converted to load from tape. It needed no changes and was tested in ZEsarUX.

Appears On

Music with pictures, printer utilities, drawing tools, games and home programs: over fifty programs from the SINCUS library tape that followed tape 103, rescued from disk.

Related Articles

A TS2068 BASIC program that draws intricate floral patterns using polar-coordinate equations. Based on mathematical equations from Oleg D. Jefimenko’s...

Image Gallery

Source Code

   10 REM ..GARLAND                       ..LOAD "GARLAND"
   15 REM ..WITH THANKS TO OLEG           ..D. JEFIMENKO,                 ..TIMELINEZ 4/86                ..PAGE 200
   20 REM ..BY GERTIE ANDERSSON           ..10/86
   25 REM ..THERE ARE 546 PIXELS          ..IN A REUE CIRCLE OF           ..ANY SIZE
   30 REM ..PRIME OF ODD NUMBERS          ..BEST FOR F AND N
   50 REM ..FOR CHRISTMAS COLORS            
   55 BORDER 2: PAPER 2: INK 4: CLS 
  100 REM ..CIRCLE VARIABLES
  110 LET X=128: REM H CENTER
  120 LET Y=87: REM V CENTER
  130 LET R=56: REM RADIUS
  140 LET F=15: REM NUMBER OF                   FLOWERS WANTED
  200 REM ..FLOWER VARIABLES
  210 LET C=360: LET A=180:           REM SHAPE OF FLOWER
  220 LET HH=16: LET VV=16:           REM LENGTH OF PETALS
  230 LET P=.375*PI: REM CURVE                       OF PETALS
  240 LET N=7: REM NUMBER OF                   PETALS
  400 REM ..GARLAND
  405 FOR K=1 TO 2: REM NUMBER                      OF CIRCLES
  410 LET S=546/F: REM STEP FOR                    CIRCLES
  415 LET SS=C/N: REM STEP FOR                    FLOWERS
  420 FOR T=0 TO 2*PI STEP S/87
  430 PLOT X+R*COS T/.82,Y+R*SIN T
  440 FOR I=0 TO C STEP SS
  450 LET H=HH*SIN (I*PI/A)
  460 LET V=VV*COS (I*PI/A)
  470 DRAW H/.82,V,P: DRAW -H/.82,-V,P
  480 NEXT I: NEXT T
  500 LET R=R+15: LET F=F+9
  550 NEXT K

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.