aaguilerav / space-filling-curves

Some known designs and some of my own, Space Filling Curves

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Space Filling Curves


Build Status

<Projects like this one are prototypes, that means that special attention was given to the problem itself rather than having a perfect software design.>

There is a mathematical curious thing called "Space Filling Curves" that caught my attention several years ago, and ever since I've been studying its mathematical properties.

Some people in MIT defines it the following way:

"A space-filling curve is a parameterized function which maps a unit line segment to a continuous curve in the unit square, cube, hypercube, etc, which gets arbitrarily close to a given point in the unit cube as the parameter increases."

A more simple (yet incomplete) explanation would be:

A 1-dimensional geometrical figure that fills a 2-dimensional or higher space when its length increases to a limit based on a parameter, and never crosses itself.

The first person that discovered this kind of mathematical curiosities was Giuseppe Peano. One of his first discoveries was the following curve:

Fig1 (Three iterations of the Peano curve construction, whose limit is a space-filling curve.)

And after him there have been many others that have contributed with their own designs, some examples are: David Hilbert and Wacław Sierpiński.

My contribution

Once I got into the computer programming behind the creation of these curves the results were very surprising.

The first one I programmed is a very well known curve on the internet:

Fig2

It is built by dividing in 3 parts a right triangle and uniting it's centroid points.

Here are the first three iterations:

Fig3 (Iteration 1)

Fig4 (Iteration 2)

Fig5 (Iteration 3)

My Own Designs

Using the same methodology, let's see what happens when we divide the same right triangle into 4 parts. The design becomes very interesting, some kind of "cellular" like patterns appear after several iterations.

Fig6

Here are the first three iterations:

Fig7 (Iteration 1)

Fig8 (Iteration 2)

Fig9 (Iteration 3)

Even more interesting patterns appear when the right triangle is divided into 5 parts.

Fig10

Again, here are the first three iterations:

Fig11 (Iteration 1)

Fig12 (Iteration 2)

Fig13 (Iteration 3)

Now, I realized that the "speed" in which these curves converge to the limit where they completely fill the 2-dimensional space has no need to be a constant, what do I mean by that?, take any of the curves above, every part of the curve as a result of the division (by 3, 4 or 5) of the whole area into smaller parts is more or less the same in terms of length.

The following curves vary in length dramatically depending of the particular sub-section of the area you chose to look, yet, they are also space-filling curves. The fractal appearance is more evident on these cases:

Fig14

Fig15

Again, here are the first three iterations for each one of these curves:

Fig16 (Iteration 1)

Fig17 (Iteration 2)

Fig18 (Iteration 3)

Fig16 (Iteration 1)

Fig17 (Iteration 2)

Fig18 (Iteration 3)

The Software

I wrote the program that creates these curves 18 years ago aprox. but never published it until now. I used Java Swing for the drawings, I'm planning to update the technology to ReactJS or another web based framework.

Compiling, Packaging and Executing the software

There is a script named compile.sh that you can use in order to compile and package the project. Or, just execute the following command: mvn clean compile assembly:single.

The JAR file is created at space-filling-curves/target, just execute a java -jar <jar file generated>. The GUI that will appear looks like this:

Fig19

Next Steps

  • Analyzing more in detail the mathematical properties of my designs.
  • And of course, creating new designs.

Comments

Please send any comment about this article to aaguilerav@me.com or alejandro.aguilera.vega@gmail.com. Your contributions or critics are always welcome.

About

Some known designs and some of my own, Space Filling Curves


Languages

Language:Java 99.9%Language:Shell 0.1%