VOOZH about

URL: https://www.geeksforgeeks.org/cpp/creating-butterfly-themed-fractal-in-c-using-graphics/

⇱ Creating Butterfly themed Fractal in C++ Using Graphics - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Creating Butterfly themed Fractal in C++ Using Graphics

Last Updated : 12 Jul, 2025
In Layman's terms, Fractals are beautiful patterns brought into existence upon the intertwining of computation and mathematics. To get a bit technical they are recursive in nature such that when looked upon a certain subset of a given fractal a similar pattern appears to emerge out of it. 👁 Image
In this article, a new type of fractal pattern is generated, given as below: 👁 Image
Approach:
  1. Recursively go to the end branch of a Fractal tree.
  2. When the length of the branch reaches our threshold value, draw out that particular branch and exit out of the function.
  3. To keep the colors similar for a few iterations, we use type casting since ((colorVal%15000)/1000+1) would give out spectrums of same values, i.e. same colour thousand times before it iterates.
Below is the implementation of the above approach: Output: 👁 Image
Comment
Article Tags: