Chapter 8 – Starcharts (Stellar Magnitudes)

Starmaps, display a simple starmap
Constellation Plot, entering star patterns with CHR$ CODEs
Stellar Magnitudes, plotting differing star brightnesses
Star Graphics, constructing complex shapes
Flashing Stars, two ways to make stars flash
Startrax, watch the changing shapes of the constellations over hundreds of thousands of years
Stellar Magnitude, magnitude ranges of stars.

Stellar Magnitudes

Stars that we see in the sky vary enormously in brightness — by a factor of over 100: from brightest to faintest. The programs in this book generally omit such differences for the sake of simplicity, and use a single pixel to PLOT each star on, for example, the Starmaps program. There are two basic ways to distinguish these stellar differences on the Spectrum screen and the three routines which follow can easily be incorporated into programs.

The first method relies on PLOTting additional pixels to form a larger image: the second uses progressively darker shades of INK to PLOT the pixel. Obviously the latter is only suitable for a monochrome presentation and the star positions must be sufficiently well separated so as not to occur in the same character square (as this will only support a single INK colour.). Nevertheless the second method has the merit of realism (in monochrome) in that the star images remain small. The third method combines the first two — again this is only suitable for monochrome but has the maximum potential of brightness range.

1: Extra pixel plotting
Key in and RUN the Star Magnitudes 1 routine in Figure 8.10, and the screen is filled with star-like images that get progressively smaller down the screen as a regular grid. Each star is PLOTted initially only as a single pixel but is enlarged by the conditional DRAW routines that immediately follow. This takes the form of a FOR/NEXT n loop and stars that are PLOTted first (with the lower n values in their PLOT position) are conditionally dealt with as:

IF n<3 THEN DRAW 0,1
IF n<6 THEN DRAW 1,0
IF n<9 THEN DRAW 0,-1

Figure 8.10
3000 PRINT “Star Magnitudes 1 @”
3030 BORDER 0: PAPER 1: INK 9
3040 LET z=0
3050 FOR n=1 TO 12
3060 PLOT z,n*10-150
3070 IF n<3 THEN DRAW 0,1
3080 IF n<6 THEN DRAW 1,0
3090 IF n<9 THEN DRAW 0,-1
3100 NEXT n
3200 LET z=z+20: GO TO 3050

Figure 8.11 shows precisely how each image is PLOTted and then DRAWn. Only one extra pixel is added by each conditional line — the value 1 in each DRAW statement.

Figure 8.11
Using conditional DRAW statements to enlarge a single pixel into a brighter star. Shown here in four steps. Because the individual pixels are not easily seen at normal viewing distances from the TV, the image just appears enlarged.


2: Colour tone (in monochrome) plus extra pixel plotting
Amend Star Magnitudes 1 to Star Magnitudes 2 (Figure 8.12) and RUN it. If a colour set is used for the display then the colour control should be adjusted to a monochrome picture. This then shows how the INK tone considerably extends the apparent range of star brightness, particularly for fainter stars. The limitations of such a scheme are mentioned earlier in this section.

Figure 8.12
3000 PRINT “Star Magnitudes 2 @”
3030 BORDER 0: PAPER 1: INK 9
3040 LET z=0
3050 FOR n=1 TO 12
3051 INK 9-n/2
3060 PLOT z,n*10-150
3070 IF n<3 THEN DRAW 0,1
3080 IF n<6 THEN DRAW 1,0
3090 IF n<9 THEN DRAW 0,-1
3100 NEXT n
3200 LET z=z+20: GO TO 3050

3: Colour tone (in monochrome)
The third version (Figure 8.13) is prepared by deleting all the conditional DRAW lines in the second routine before it is RUN. A practical version of this routine, for incorporating into a longer program (with the limitations already mentioned), would take the form:

PAPER 0: INK 9: REM dark tone most stars = INK 2
FOR n = 1 TO 12
IF n5 THEN PLOT; INK 2; x(n), y(n): REM faint stars

The relative brightness of the stars are controlled by the expression

INK 8-n

for the first five stars (n5) would have an INK tone value of 2 (INK pixel colour red). It is possible to extend the range to include an extremely faint star by using an INK tone value 1 (INK pixel colour blue) but on a black sky (PAPER 0) a single pixel may be undetectable.

Figure 8.13

3000 PRINT “Star Magnitudes 3 @”
3030 BORDER 0: PAPER 1: INK 9
3040 LET z=0
3045 BRIGHT 1
3050 FOR n=1 TO 12
3051 INK 9-n/1.5
3060 PLOT z,n*10-150
3100 NEXT n
3200 LET z=z+20: GO TO 3050

Starcharts with magnitude control
To incorporate any of the above routines into a longer program, you will need to take care in the order in which you PLOT each star. The brightest stars should be listed first and so on in decreasing order of brightness. If a particular constellation has no bright stars it is necessary to repeatedly PLOT the same star before PLOTting the next star, until the correct INK tone is used. This means that more apparent star positions will be listed than finally appear on the screen.

To satisfy the above condition with the first method (extra pixel plotting) then the PLOTting may have to include more conditional statements so that a particular constellation skips some of the extra pixels that otherwise would be DRAWn. This could take the form:

FOR n = 1 TO 30: REM 30 constellations
FOR f = 1 TO (no of star positions) STEP 2
PLOT x(n,f), y(n,f+1): REM x,y = star coordinates
IF n=5 AND f=1 THEN GOTO XXXX : REM skip DRAW routine for constellation no 5, star 1
IF f<3 THEN DRAW 0,1
IF f…
NEXT f: NEXT n (NB line XXXX)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s