Logiciel libre de géométrie, d'analyse et de simulation multiplateforme par Yves Biton
Accueil - Exemples

Creation of a dragon fractal with MathGraph32

publication dimanche 2 mars 2014.

New version 4.8 of MathGraph32 allows to create fractal constructions through recursive implementation of constructions.

In this example we will show how to create a dragon fractal curve.

We will first create a first figure as below in which we will create a construction we will then implement in a recursive way.

Use icon to create a new figure.

Then create two free points we will call A and B (indeed it is not useful to name them in the figure), with A left of B as below.

Our first final object will be a clone of point A : create this clone with menu item Create - Object clone.

Create the midpoint of segment [AB] (icône ) then the perpendicular bisector of segment [AB] (icône ), the circle of center the midpoint and going through point A (icon ). We will call C the highest intersection point as below. Point C will be our second final object.

Now use menu item Create - Object clone to create a clone of point B and a clone of point C, in that ordrer (F9 to re-activate the tool).

Use tool to create segments [AC] et [CB] (when asked, choose the clone points but it is not important).

Through our recursive calls, the construction will first apply to segment [clone of A , C] then [Clone of B, clone of C].

Now we can define our construction.

Use menu item Constructions - Sources objects choice - Graphical and click A and B B, in that order (choose the free points).

The use menu item Constructions - Final objects choice- Graphical and click on A clone, point C, B clone, C clone nd the two segments. It is the creation order of these objects which is important, note the click order).

We don’t want our fractal to be full on visible points, so use icon to mask the point clone of A, C, the clone of C and clone of B.

Now use menu item Constructions - Finish current construction.

In the dialog box popping up, enter Dragon for the construction name.

Save your figure in a file and use menu item Constructions - Save a construction of figure to file to save the construction Dragon in a file Dragon.mgc on your computer.

We will now create a new figure in which we will implement our construction.

Use icon to create a new figure in which you will create two free points we will call A and B as below.

With menu itemConstructions - Incorporate a construction in figure from file, incorporate in this new figure the construction Dragon you just saved on your computer.

Now use menu item Macros - New macro - Construction macro - recursive and fill the dialog box in as below. Don’t forget to check the checkbox Create only objects of last generation. Then click on points A and B as asked in the indication at the bottom of the frame. The macro appears.

The iteration step is 2 because, once the construction applied to points A clone and C, it will the be applied to B clone and C clone. So we must skip two final objets before re-implentnig the construction.

You can see below the final figure. Click on the macro to create the fractal construction.

To be noted :In MathGraph32, the figure is very fluide when capturing A and B, less fluid below because the animation is made through JavaScript, less performing (the figure contains approximately 25 000 objects).