SnailShell

Fractals


2016-11-08 595 words 3 minutes read graphics notes

Fractal

naming: fractional dimension

Definition:

self-similar $$\to$ when zoomed in, look the same

Types:

  1. Exactly self-similar
  2. Statistically self-similar

Exactly Self-similar

If zoomed in, there is no way to tell that we have zoomed in.

Sierpinski Carpet

Sierpinski Carpet

Koch Snowflake

Koch Snowflake

The important property is that when we zoom in on an edge, it is arbitrarily “bumpy” - non-smooth. This is similar to things like shorelines. There is a self-similarity in natural shorelines.

However, shorelines are not as bumpy as Koch Snowflakes. They are smoother. Hence, we need a concept to describe the bumpiness.

Length of Koch Snowflake

Each Step increases the length to $$\dfrac{4}{3} \times$ original. Hence, Koch Snowflake is infinitely long.

$$l_k = \dfrac{4}{3} l_{k-1}$

Question: How quickly does Koch Snowflake’s length converge to infinity?

Measuring Length of Fractal Line

Different measuring scales lead to different length.

From the starting point, jump a fixed distance, $$d_u$, and measure how many $d_u$ are there in the line.

Each different $$d_u$ results in a unique length, and as $d_u$ approaches 0, the length measured approaches $\infty$

The scale is related to length and this function describes the bumpiness of a fractal line. This is called Fractal Dimension.

Shoreline/Mountain Topology

Use fractal dimension to model a bumpy line, and computationally derive the line, rather than describing more details.

Statistically Self-similar

Recursive Tree: Tree := Stick + Tree + Tree

Moreover, we need to take care of the angles, length and returning position.

It becomes:

- Stick
- Turn
- Tree  -> this will expand to the same routine
- Turn
- Tree  -> this will expand to the same routine
- Turn
- Backwards

L-System

The above process can be described by CFG:

$$T:S\leftarrow T \rightarrow \rightarrow T \leftarrow \overline{S}$

This use of CFG is called L-System.

Improvement to L-System Tree

The sub-parts are statistically similar to the original image, but not exactly the same.

To create a nice tree, it is important to examine each tree. There is a grammar to each type of tree, describing its patterns.

However, sadly trees don’t grow by the fractal model.

Incorporating Randomness Into Fractals

Example Algorithm (Subdivide and Offset)

repeat
    foreach segment
        offset midpoint for random distance
        hence create two segments

More sophisticated examples:

Height Map

A raster vector of height

Diamond Square

Level 0

The result could look something like:

Diamond Square

The problem is the grid pattern is visible. There are ‘+’ in the graph, so rotating the graph will be noticed (not entirely natural)

Solution: Use

Applications:

Perlin Fractal

A perlin fractal is created by taking in a height map, downsize it, and fill itself with the small height map.