Open In App

Fractals in Computer Graphics

Last Updated : 14 Jan, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

Fractals is a complex picture created using iteration and a single formula. Sometimes, objects cannot be drawn with a given equation or with a given geometry. Examples: mountains, clouds. Their shape cannot be defined so in this case, we use fractals. So these are nothing but natural objects that can be drawn with the help of fractals. Below is an example of a fractal diagram.

Fractals-in-Computer-Graphics-3

fractal diagram

Basically, Fractals are used in many areas for its importance such as −

  • Astronomy: for the analysis purpose of Saturn’s rings, galaxies, etc.
  • Biology/Chemistry: For the purpose of illustrating chemical reactions, human anatomy, molecules, plants, and bacterial cultures.
  • Others: For the purpose of representing the required clouds, borders, the coast, data compression, diffusion, economy, fractal music, fractal art, landscapes, special effects, and so forth.

Generation of Fractals

So, repeating the same shape repeatedly can result in fractals. To get the appropriate shape and size, we can iterate indefinitely. Recursion is the computer language term for making such forms as per requirement.

Geometric Fractals

The shapes with non-integer or fractal dimensions that can be found in nature are the main subject of geometric fractals. In order to create a deterministic nonrandom self-similar fractal mathematically, we begin with an initiator, which is basically a predetermined geometric shape. Next, a pattern which is known as the generator is used to replace as per need some of the initiator’s component pieces.

Types of Fractal

There are three types of fractals:

  • Self-similar: These fractals have parts as a scaled-down version of the entire object. So if we scale up from a smaller part of the fractal, we will scale up to the whole object.
  • Self Affine: It has parts formed with different scaling parameters in different coordinate directions. For example in the direction, the scaling may be different from that t of y-direction. So the fractal will not be exactly similar in all directions.
  • Invariant: Formed with nonlinear transformations. The smaller and bigger objects in the fractal are different.

Fractal Dimension

  • Fractal is a measure of roughness or fragmentation of an object.
  • More fractal dimensions in case of more jagged-looking objects.
  • Using some iterative procedure, we can calculate fractal dimension D.

Koch Curve

Next, we will discuss the Koch curve, which is an example of a fractal, which can be drawn with the help of an equation or with the help of a program. In the Koch curve, initially, you have to take a triangle, and in that triangle, each straight line is replaced with four equal-sized lines of scaling factor 1/3. This Koch curve is also known as the snowflake pattern.

Step 1: Below is the diagram explaining how to draw the Koch curve. We have to first divide each side of the triangle into three equal parts and the middle part is again divided to 1/3rd of its original length. This process will be repeated.

Koch curve

Koch curve

Step 2: After n iterations, we will get a Koch curve that will look like this.

Fractals-in-Computer-Graphics--1

Koch curve

In the Koch curve, the fractal dimension is 1.2619. This value is calculated using the following procedure:

At each iteration, the scaling factor S is 1/3 because each line segment is divided into 1/3 of its original length, and N is 4 because each line segment is replaced by four smaller line segments. Therefore, we can calculate the fractal dimension of the Koch curve as follows:

D = log(4) / log(1 / 3)

D ≈ 1.2619

FAQs on Fractals

Q.1: What is a fractal in computer graphics?

Answer:

A fractal is a complex geometric pattern created through mathematical equations and algorithms, exhibiting self-similarity with smaller copies at different scales.

Q.2: What are some common applications of fractals in computer graphics?

Answer:

Fractals have numerous applications, such as generating lifelike terrain in video games, simulating natural phenomena like clouds and landscapes, creating visually captivating textures and patterns, and producing natural-looking vegetation.

Q.3: How are fractals generated in computer graphics?

Answer:

Iterative algorithms are used to generate fractals by repeatedly applying mathematical formulas to a basic geometric shape or pattern, resulting in more intricate and detailed versions of the original shape.

Q.4: Can fractals be animated in computer graphics?

Answer:

Fractal patterns can be animated in computer graphics by altering parameters over time, resulting in captivating zooming and morphing effects.


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads