*Post by Richard Ashbery*I forgot about the FILL statement which I can also use in my original

code but what I'm really after is a method to overlay the existing

square with other successively smaller squares in alternating colours.

Its easier to see it illustrated...

http://www.riscosbasic.uk/problems/square.zip

This doesn't seems as easy as it should be ...

I tried it with the biggest square plotted first. Then the second on top

of it. But, from this second square on to the last and most little square

the FILL command didn't work anymore in the expected way. I think, the

FILL will only fill if there is an unpainted background colour. It

doesn't work on top of an already painted structure.

So - if one wants to use the FILL - the sqares have to be painted the

other way round; from the little one in the centre to the outmost an

biggest one.

If there is a space filled with background colour between the line of the

new-drawn outermost square an the already painted an filled inner square

the FILL command works in the expected way.

To find a point where the FILL can start in a defined way, I sorted the X-

values and used the one on the left side (XMIN). The y-value wich belongs

to this (XMINY) is corrected by a minimal absolute amount, wich sets the

start of the FILL in a region inside the square.

All this doesn't work if this starting point is located outside of the

square or if the inner square overlaps with the bigger one.

You can try this by setting the maximum square length (F) (F as in

"factor", because it's the zooming factor for the calculated length) from

500 to e.g. 800. Or You can change the STEP to a lesser value (30).

To ease the finding of a good combination of all the factors involved

there is a little CIRCLE drawn at (XMIN,XMINY) wich should be removed,

with a REM command, once a good combination has been found.

The ANGLE is (re)calcuated in a "fancy" form with a SIN to give a fine

rotating effect. This could be exchanged by an addition of a fix value to

increase the ANGLE for every square - ANGLE=ANGLE+25 ; this should give

the effect You initially wanted to plot (without additional animations).

It's a little bit "flickery", but gives a fine little demo ... :)

I hope You enjoy it.

REM BBC BASIC Code , rotating squares - filled with fancy colours

ON ERROR PRINT "ERROR IN ";ERL : END

MODE 1280,1024,8

CLS : ORIGIN 1024,1024

S=RAD(0.5)

FOR R=0 TO 2*PI STEP S

ANGLE=R

FOR F=50 TO 500 STEP 75

GCOL ( F MOD 7 )

X0=SIN(ANGLE)*F : Y0=COS(ANGLE)*F

X1=SIN(ANGLE+1.571)*F : Y1=COS(ANGLE+1.571)*F

X2=SIN(ANGLE+3.141)*F : Y2=COS(ANGLE+3.141)*F

X3=SIN(ANGLE+4.712)*F : Y3=COS(ANGLE+4.712)*F

POINT X0,Y0

DRAW X1,Y1 : DRAW X2,Y2 : DRAW X3,Y3 : DRAW X0,Y0

XMIN=X0 : XMINY=Y0

IF XMIN > X1 THEN XMIN=X1 : XMINY=Y1

IF XMIN > X2 THEN XMIN=X2 : XMINY=Y2

IF XMIN > X3 THEN XMIN=X3 : XMINY=Y3

IF XMINY < 0 THEN XMINY=XMINY+4 ELSE XMINY=XMINY-4

FILL XMIN+15,XMINY

GCOL 200,200,200 : CIRCLE XMIN+15,XMINY,3

ANGLE=ANGLE+RAD( SIN(ANGLE)*7)

NEXT F

FOR I=0 TO 2500 : NEXT I : WAIT : CLS

NEXT R