Iterated function system (Fractal)

Hello, i am stuck on my last part of assignment

it say i need to write a program, named Fractal.cpp that takes a single command-line argument: the iteration level , and produces a bitmap image of the resulting k-th iterate. For example,

which will give this

https://imgur.com/a/vltxcHZ

but i have no ideas what to do, can someone give me hint by writing some pseudo code that i can look in the direction







full instruction



Iterated function system

Suppose that we have a collection of geometric objects C0. Moreover, let us suppose that we also have a collection of functions F , where each function in the collection maps the plane to itself. We have in mind that the functions in F are simple affine maps obtained by composing translations, rotations, and scaling (although in general, other types of functions are allowed). In particular, each function f from F can be applied to each object c0 in C0 to obtain new geometric objects of the form c1 = f (c0). Thus we obtain a new collection of geometric objects C1. Note that if there are m objects C0 in n and objects in F, there are mn objects in C1, since each function in F will be applied to each object in C0. Of course we may repeat the process: we apply each function in to each object in to obtain another collection of objects.

For example, if
F = {f ,g} and C0 = {a,b}
then
C1 = {f (a),f (b),g(a),g(b)}
and
C2 = {f (f (a)),f (f (b)),f (g(a)),f (g(b)),g(f (a)),g(f (b)),g(g(a)),g(g(b))} In general, we apply each function in F to each object Ck in to obtain a new collection of objects Ck+1. Taking the limit as k goes to infinity, we obtain the collection C∞ = limk→∞C∞. The collectionCk+1 has mnk+1 objects, so we might not expectC∞ to be anything nice. However, if the functions in F are nice (the requirement is essentially that they map a geometric object into an object with a smaller area), the limit set C∞ is actually an interesting self-similar figure in the plane, called a fractal. Although there are other ways of obtaining fractals, the process described here is called an iterated function system. For this part of the assignment, you will render a simple fractal. I will give you the code for two functions from which you will build the fractal.

The functions will be given by in the form of unary function objects:
struct First : std::unary_function<Object*, Object*> { Object* operator()(Object*); }; struct Second : std::unary_function<Object*, Object*> { Object* operator()(Object*); };
that are declared in a header file called FractalObjects.hpp and implemented in a file called FractalObjects.cpp (which I will give to you but note that my implementation will make use of your Clone function). Starting with an initial configuration C0 of geometric objects (you can use any configuration you wish), you will apply the above construction k times to generate an image of the k-th iterate Ck. Specifically, you will write a program, named Fractal.cpp that takes a single command-line argument: the iteration level , and produces a bitmap image of the resulting k-th iterate. For example,
Fractal 10 will produce an image file named Fractal.bmp, that shows the rendering of C10 . For this part of the assignment, you may only include <list>, <vector>, <algorithm>, <iterator>, <functional>, <cstdlib>, FractalObjects.hpp and ObjectFactory.hpp header files. Also, you may only use a single loop and define only a single function object. You are to submit a single source file, named Fractal.cpp that should compile without warnings using warning level 3 of the Visual Studio 2015 compiler. IMPORTANT: Making use of lambda expresions would be considered as defining an extra function object.


my project assignment folder
https://drive.google.com/file/d/1HwBtQ73xpP8F4cdNO3olX9LmyR5nbZ5R/view?usp=sharing


Last edited on
anyone can help me
Topic archived. No new replies allowed.