A family of fractals , the mod-curves

Up a level : Fractals

Sometimes in the early 80th I worked at a place where I had access to a rather simple line plotter. Using that I created a family of fractals that I could plot with a higher resolution than what I could do on the computers I had access too.

The program to plot the graphs was written in Pascal. I have just rewritten it using JavaScript. The result can be seen below:

Your browser does not support the HTML5 canvas tag.

As you can see it starts with the famous C-curve, though slightly modified. The colours comes from the fact that the procedure modifies the colour every time a point is overwritten.

The algorithm

To explain the selections in the rows I think we need to have a look at the algorithm used to get the curve.  It is a recursive algorithm, starting  at level 0. At that level we would just get a vertical line.

It start at the lower end directed upward.  At the next level it will add a “knee”. This is done at every level. Each straight line will be replaced by a “knee”.

In our case we will alway start the first knee by changing the direction doing  a quarter turn anticlockwise.

It is at level two things can begin do change. We may turn in left or in the right direction. This is set by the rules, A, B, C and D.  The A rule tells us what direction the first segment will turn in, if the turn to make the segment was to the left. Rule B is for when we started to right. Since we started with a left turn at level 1, we will use rule A to decide the direction of the first “knee”.  Rule C and D so the same for the second (upper) knee.

If rule A and C states that we should turn to the left we get the first of the two level 2 figures. If the rule A says turn to the left, but rule C says turn to the right we get the second variant.

If we don’t want an infinite set of rules, we can reuse older rules. What we do is to-decide an order of the figure. The order is , together with the level, used to determine what rules to use. If the order is say 3, then we will cyclically reuse the rules for the tree first levels. We calculate that what rule to use as one plus level mod order. Hence the name mod-curves.

The settling

Explanation of the rows:

  • L: the level or rather depth it goes to. If 16 is used then it is actually using 20 levels. This to get more spectacular colours.
  • O: The order=point at witch it start to reuse the rules. If you do anything with the rules at levels lower than this, nothing will happen.
  • A: A rule for how to turn the first “knee” if the “parent” did turn left.
  • B: A rule for how to turn the first “knee” if the “parent” did turn right.
  • A: A rule for how to turn the second “knee” if the “parent” did turn left.
  • B: A rule for how to turn the second  “knee” if the “parent” did turn right.

If the box is checked the right turn rule applies.

Some special curves

In the following a rule of say  0011,1100 means that the order is two  and that the rules for level 1 is:
A=left=unchecked, B=left=unchecked, C=right=checked, D=right=checked,
For level 2 we get:
A=right=checked, B=right=checked, C=left=unchecked, D=left=unchecked.

Then we need to set O to 2. The graph for this will by the way be a triangle.

Some rules worth mentioning:

  • 0000 => the C-curve.
  • 0011=> the Dragon curve.
  • 1001=> this is my absolute favourite. I call it the Crab curve (of obvious reasons when you select it). I have not seen this before I made it in the early 80th.
  • 1111,0000,1100,0011,1111,1011,1110,0100,1111,0000 => A beautiful pattern with “islands”.

So, explore and enjoy (^^,).

Up a level : FractalsLast modified: Oct 30, 2019 @ 17:00