Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.acorn.programmer > #5907

Re: Rotating a Colour-Filled Square

From Richard Ashbery <basura@invalid.addr.uk>
Newsgroups comp.sys.acorn.programmer
Subject Re: Rotating a Colour-Filled Square
Date 2019-11-14 14:09 +0000
Organization None
Message-ID <5812d2f3a8basura@invalid.addr.uk> (permalink)
References <5811cae024basura@invalid.addr.uk> <qqfdpr$n4t$1@solani.org> <58124834ffbasura@invalid.addr.uk> <58125f40fdbasura@invalid.addr.uk> <qqi40d$e0m$1@solani.org>

Show all headers | View raw


In article <qqi40d$e0m$1@solani.org>, Sebastian Barthel
<naitsabes@freenet.de> wrote:
> Am Wed, 13 Nov 2019 17:05:44 +0000 schrieb 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.

That's what I've discovered - the FILL command is quite limited. What
a pity we haven't got a RECTANGLE command rather like ELLIPSE FILL
with an angle parameter. Perhaps I should take it to the ROOL forum.

> 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.

I agree.

> 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.

Yes I've also discovered that issue :-(

> 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).

The problem here is the lower your STEP size the greater the chance of
the second and subsequent squares loosing their colour through
overlap. My compromise is FOR F=50 TO 800 STEP 100 making the
graphic quite large on the screen. 

> 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.

I've used that exact same method in another graphic (easier because it
had no animation) to locate the precise co-ordinates for the FILL
command. 

> 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).

To rotate each square independently is really effective. Fixed is not
as good.

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

Replacing last line but one with a shadow memory routine...

OSCLI"FX112,"+S1$:OSCLI"FX113,"+S2$:SWAP S1$,S2$:WAIT:FOR
I=0 TO 20000 : NEXT I: CLS

(S1$="1":S2$="2" can be assigned near the top of the program)

seems to improve the flicker.

Many thanks again - you've obviously spent quite a bit of time coming
up with a solution :-))

You may have guessed that what I'm after is to draw a persuit curve
with its elegant spiral arms - originally non-animated but animation
certainly improves things.

All the best

Richard

Back to comp.sys.acorn.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Rotating a Colour-Filled Square Richard Ashbery <basura@invalid.addr.uk> - 2019-11-12 14:05 +0000
  Re: Rotating a Colour-Filled Square Sebastian Barthel <naitsabes@freenet.de> - 2019-11-12 23:04 +0000
    Re: Rotating a Colour-Filled Square Richard Ashbery <basura@invalid.addr.uk> - 2019-11-14 16:24 +0000
      Re: Rotating a Colour-Filled Square Sebastian Barthel <naitsabes@freenet.de> - 2019-11-14 19:29 +0000
        Re: Rotating a Colour-Filled Square Sebastian Barthel <naitsabes@freenet.de> - 2019-11-15 21:26 +0000
        Re: Rotating a Colour-Filled Square Sebastian Barthel <naitsabes@freenet.de> - 2019-11-15 22:23 +0000
          Re: Rotating a Colour-Filled Square Sebastian Barthel <naitsabes@freenet.de> - 2019-11-15 22:31 +0000
            Re: Rotating a Colour-Filled Square Richard Ashbery <basura@invalid.addr.uk> - 2019-11-16 14:05 +0000
              Re: Rotating a Colour-Filled Square Sebastian Barthel <naitsabes@freenet.de> - 2019-11-16 19:47 +0000
                Re: Rotating a Colour-Filled Square druck <news@druck.org.uk> - 2019-11-18 20:02 +0000
          Re: Rotating a Colour-Filled Square Steve Fryatt <news@stevefryatt.org.uk> - 2019-11-16 00:39 +0000
            Re: Rotating a Colour-Filled Square Richard Ashbery <basura@invalid.addr.uk> - 2019-11-16 12:21 +0000
              Re: Rotating a Colour-Filled Square Steve Fryatt <news@stevefryatt.org.uk> - 2019-11-17 10:04 +0000
                Re: Rotating a Colour-Filled Square Richard Ashbery <basura@invalid.addr.uk> - 2019-11-17 13:50 +0000
                Re: Rotating a Colour-Filled Square Richard Ashbery <basura@invalid.addr.uk> - 2019-11-17 14:19 +0000
                Re: Rotating a Colour-Filled Square Steve Fryatt <news@stevefryatt.org.uk> - 2019-11-17 14:21 +0000
                Re: Rotating a Colour-Filled Square Richard Ashbery <basura@invalid.addr.uk> - 2019-11-17 15:34 +0000
                Re: Rotating a Colour-Filled Square Steve Fryatt <news@stevefryatt.org.uk> - 2019-11-17 16:25 +0000
                Re: Rotating a Colour-Filled Square Richard Ashbery <basura@invalid.addr.uk> - 2019-11-18 16:17 +0000
                Re: Rotating a Colour-Filled Square Richard Ashbery <basura@invalid.addr.uk> - 2019-11-18 16:55 +0000
          Re: Rotating a Colour-Filled Square druck <news@druck.org.uk> - 2019-11-16 11:48 +0000
            Re: Rotating a Colour-Filled Square Richard Ashbery <basura@invalid.addr.uk> - 2019-11-16 14:21 +0000
              Re: Rotating a Colour-Filled Square druck <news@druck.org.uk> - 2019-11-18 20:04 +0000
                Re: Rotating a Colour-Filled Square Richard Ashbery <basura@invalid.addr.uk> - 2019-11-19 14:48 +0000
                Re: Rotating a Colour-Filled Square druck <news@druck.org.uk> - 2019-11-19 20:26 +0000
                Re: Rotating a Colour-Filled Square Brian Jordan <brian.jordan9@btinternet.com> - 2019-11-19 20:39 +0000
                Re: Rotating a Colour-Filled Square Dave <dave@triffid.co.uk> - 2019-11-20 07:50 +0000
                Re: Rotating a Colour-Filled Square Alan Adams <alan@adamshome.org.uk> - 2019-11-20 11:26 +0000
            Re: Rotating a Colour-Filled Square Sebastian Barthel <naitsabes@freenet.de> - 2019-11-16 19:27 +0000
              Re: Rotating a Colour-Filled Square Steve Fryatt <news@stevefryatt.org.uk> - 2019-11-16 23:37 +0000
      Re: Rotating a Colour-Filled Square druck <news@druck.org.uk> - 2019-11-14 20:47 +0000
    Re: Rotating a Colour-Filled Square druck <news@druck.org.uk> - 2019-11-14 20:44 +0000
      Re: Rotating a Colour-Filled Square Richard Ashbery <basura@invalid.addr.uk> - 2019-11-15 13:35 +0000
        Re: Rotating a Colour-Filled Square Steve Fryatt <news@stevefryatt.org.uk> - 2019-11-16 00:32 +0000
    Re: Rotating a Colour-Filled Square Richard Ashbery <basura@invalid.addr.uk> - 2019-11-13 12:54 +0000
      Re: Rotating a Colour-Filled Square Richard Ashbery <basura@invalid.addr.uk> - 2019-11-13 17:05 +0000
        Re: Rotating a Colour-Filled Square Sebastian Barthel <naitsabes@freenet.de> - 2019-11-13 23:35 +0000
          Re: Rotating a Colour-Filled Square Sebastian Barthel <naitsabes@freenet.de> - 2019-11-14 12:20 +0000
          Re: Rotating a Colour-Filled Square Richard Ashbery <basura@invalid.addr.uk> - 2019-11-14 14:09 +0000
  Re: Rotating a Colour-Filled Square Richard Ashbery <basura@invalid.addr.uk> - 2019-11-14 15:21 +0000
  Re: Rotating a Colour-Filled Square news@sprow.co.uk - 2019-11-14 05:00 -0800

csiph-web