APPLICATIONSCREATION GRAPHIQUE ★ Fractal techniques ★

CPC Fractals (Computing with the Amstrad)Applications Creation Graphique
★ Ce texte vous est présenté dans sa version originale ★ 
 ★ This text is presented to you in its original version ★ 
 ★ Este texto se presenta en su versión original ★ 
 ★ Dieser Text wird in seiner Originalfassung präsentiert ★ 

CHRIS RATCLIFFE zooms in on the knobbly bits of the Mandelbrot set

IN the March 1987 issue of Computing with the Amstrad Ian Sharpe introduced you to a branch of mathematics known as fractal geometry.

You may have seen similar intricate patterns created as a demonstration of the speed of expensive mainframe computers, or played computer games such as Rescue on Fractalus which use fractal techniques to create landscapes.

But micros can quite easily generate impressive fractal pictures - and you don't need a degree in maths to appreciate them.

CPC Fractals is a program designed to draw different parts of the region around a set of numbers known as the Mandelbrot set, named after B.B.Mandelbrot who has done much of the work in fractal mathematics.

You can think of the Mandelbrot set as a two-dimensional shape and you can see the idea in Figure I.

The interesting thing about the set is that if you zoom in on its edge you can see that the knobbly bits are made up from even smaller knobbly bits.

Greater magnification reveals an intricate arrangement of fine fibres and swirling patterns which connect the main Mandelbrot shape to tiny features on its extremities.

Some of these fibres are like miniature versions of the whole Mandelbrot shape. The edge can be magnified again and again to reveal more and more detail.

Although the area of the Mandelbrot shape is finite, its edge is infinitely complex and has infinite length. In mathematical jargon the shape is "fractal".

This talk of infinitely complex edges may sound as if producing the Mandelbrot set is beyond the poor old Amstrad - it would take an infinite amount of time. But the method, or algorithm, for working out which numbers are in the set is surprisingly simple.

Put mathematically, the Mandelbrot set is the set of complex numbers c , for which the iteration z  -z ^ 2 + c converges.

If that sounds confusing think about it this way. Let's take two numbers, say x and y, which we will use as constants, and two variables, a and b, which we will change and update in a loop.

The formulae for updating a and b are:

new a=(old a) ^ 2-(old b)^2+x new b=2*(old a)*(old b)+y

We give a and b initial values of zero and put them into the formulae. This will give us new values of a and b

number of calculations needed, especially the 100 calculations for values in the Mandelbrot set, means that the process would be very slow.

To get good results in a reasonable time the main calculation and plotting loops are written in machine code, with some Basic attached to set up tables and so on.

This allows most patterns to be produced in a few hours. Considering the program works in Mode 1 and calculates the colour of some 58000 pixels, this is good going.

The machine code is held in data statements and if you make any mistakes typing it in you will be told which line contains the error - though it is still a good idea to save a copy of the program before testing it for the first time.

When the program is run it will spend a few seconds initialising, then you will see a menu at the bottom of the screen. The available options are:

  • SAVE - saves the current pattern to disc or tape. Colour and parameter information is also saved with the pattern.
  • LOAD - loads a previously saved pattern.
  • RUN - draws a pattern using parameters entered from the keyboard. The last y value will be calculated by the program to keep the pattern correctly proportioned.
  • ZOOM - allows you to zoom in on an area of the current pattern. Define the bottom left and top right corners using the cursor keys, pressing Enter to confirm. The program keeps the proportions of the area correct.
  • INK - pressing the 1, 2 or 3 keys on the main keyboard will cycle the corresponding inks through the whole range of colours.

A good way to explore the Mandelbrot set is to first use the Run option to get a picture of the whole set. Enter x1 =-2.3 x2 = 1.1 y1 =-1.19 and when it has finished save it.

This pattern will act as your map of the fractal terrain, so you can magnify interesting areas with the Zoom option.
In general, areas close to the Mandelbrot set are the most attractive, so try and include some black in the picture.

Also it is best to make the difference between x1 and x2 greater than about 0.002 to avoid spoiling the shapes with rounding errors in the calculations. Some good spots to try are shown in Table I.

Due to the nature of fractals the program can be used to look at literally millions of interesting areas around the Mandelbrot set.

When you have created and saved fractal pictures Program II can be used to produce fascinating animated displays. It will load a pattern and cycle the ink values so that the fibres appear to flow into the screen.

CWTA

★ PUBLISHER: Computing With The Amstrad
★ YEAR: 1988
★ CONFIG: 64K + AMSDOS
★ LANGUAGE:
★ LiCENCE: LISTING
★ AUTHOR: CHRIS RATCLIFFE

★ AMSTRAD CPC ★ DOWNLOAD ★

Type-in/Listing:
» CPC  Fractals    (Computing  with  the  Amstrad)    ENGLISH    LISTINGDATE: 2020-08-04
DL: 61 fois
TYPE: PDF
SIZE: 169Ko
NOTE: 5 pages/PDFlib v1.6

Je participe au site:
» Vous avez des infos personnel , des fichiers que nous ne possédons pas concernent ce programme ?
» Vous avez remarqué une erreur dans ce texte ?
» Aidez-nous à améliorer cette page : en nous contactant via le forum ou par email.
★ AMSTRAD CPC ★ A voir aussi sur CPCrulez , les sujets suivants pourront vous intéresser...

Lien(s):
» Applications » Graphic - Fast Screen Filler (CPC Amstrad International)
» Applications » CPC464 Fill Routine
» Applications » Fill (Computing with the Amstrad)
» Applications » RSX-Fill (Happy Computer)
» Applications » RSX-Fill (CPC Magazin)
» Applications » Pattern-Fill / Pattern-Draw (CPC Amstrad International)

CPCrulez[Content Management System] v8.7-desktop/c
Page créée en 329 millisecondes et consultée 232 fois

L'Amstrad CPC est une machine 8 bits à base d'un Z80 à 4MHz. Le premier de la gamme fut le CPC 464 en 1984, équipé d'un lecteur de cassettes intégré il se plaçait en concurrent  du Commodore C64 beaucoup plus compliqué à utiliser et plus cher. Ce fut un réel succès et sorti cette même années le CPC 664 équipé d'un lecteur de disquettes trois pouces intégré. Sa vie fut de courte durée puisqu'en 1985 il fut remplacé par le CPC 6128 qui était plus compact, plus soigné et surtout qui avait 128Ko de RAM au lieu de 64Ko.