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


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

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 16:24 +0000
Organization None
Message-ID <5812df5497basura@invalid.addr.uk> (permalink)
References (1 earlier) <qqfdpr$n4t$1@solani.org> <58124834ffbasura@invalid.addr.uk> <58125f40fdbasura@invalid.addr.uk> <qqi40d$e0m$1@solani.org> <qqjgq3$dkd$1@solani.org>

Show all headers | View raw


In article <qqjgq3$dkd$1@solani.org>, Sebastian Barthel
<naitsabes@freenet.de> wrote:
> Am Wed, 13 Nov 2019 23:35:41 +0000 schrieb Sebastian Barthel:

> > Am Wed, 13 Nov 2019 17:05:44 +0000 schrieb Richard Ashbery:
> > 
> >> ... but what I'm really after is a method to overlay the
> >> existing square with other successively smaller squares in
> >> alternating colours.
> > 
> >
> > 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.

> This can and probably should be changed to a variant wich
> calculates the startpoint for the FILL command directly.

> To find such a point You could do an

>  XMIN=SIN(ANGLE)*(F-8) : XMINY=COS(ANGLE)*(F-8) FILL XMIN,XMINY

> and delete all the other lines wich include XMIN or XMINY.

It gets better :-) Implemented above which saves 4 lines of code. Came
up with an error to start with but error routine gives no hint as to
what might be wrong. I've found the following more helpful...

ON ERROR REPORT:PRINT " at line ";ERL:END

> But: This starts the filling everytime on another part of the
> screen. Thats why the filling itself will then sometimes go from
> up to down and sometimes down to up and in 50% it starts on the
> left side and in 50% on the right side. I suppose its possible to
> see a difference between these variations of the fill-start. On
> the other hand this is so in original program too. I think the
> best way to do is to find the topmost pixel (or line) and start
> the filling there. But this depends also on how the filling
> routine works.

> Since You are knowing about the fact that there are only squares
> involved eventually the better (best?) solution is to write a
> little fill procedure. This has to find the outmost points
> (leftmost,rightmost) for every line of the screen where the square
> should be plotted. With these coordinates one can draw a
> horizontal line. This should be done for every line in the square.
> Since drawing of a horizontal line can be much faster than a
> comlex FILL command wich needs to test every pixel this is
> eventually faster ; even if the squares are plotted in full and
> from the biggest to the smallest one.

There's a lot of information here - I've got the basics but I'll need
some time to digest it all.

> The other thing one would include in such a demo is
> double-buffering. This can be done in BBC BASIC with an SWI wich
> switches between two alternating drawports. Its not a challenge
> but I can't remember the SWI number at the moment. It won't change
> the rest of the code and can be added afterwards with ease.

As it stands I'm not sure that double-buffering will be enough to
really improve its smoothness - I believe there's something called
triple buffering - would this work I wonder?

This is turning out to be a rather nice little animation. Keep up the
good work. I think it needs more squares (bearing in mind the overlap
issue blanking out the colour) and a larger colour range but is pretty
good as it is. An intesting effect is the rotation speed variation -
probably due to the # of sine/cosine calculations required. This is
obviously what you meant when you said routine needs speeding up with
an array function to work out all the values before doing the
rotation. Could this be a feature perhaps :-)

When "perfected" can I put it on my website?

Regards

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