469,898 Members | 1,734 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,898 developers. It's quick & easy.

Please Help To Draw A Fractal For Peano/hilbert/koch Snowflake Curve Using C++

Please help me. I am totally beginner of C++ and my tutor give us these huge program to solve within 20 days. As a MSc student I am really gonna cry. Please anyone can help me. sumon1in1@yahoo.com

Here is added assignment:
http://eent3.lsbu.ac.uk/staff/dimitrsa/OOPN/Assignment/OOPN_assignment_2006-07.pdf

Your Application
Example: You can either select to design one of the following recommended fractals:
1. Peano curve
2. Hilbert curve
3. Sierpinski gasket or the Koch snowflake.
Figure 1: Three iterations of the Peano curve, a space-filling curve
Figure 2: Six iterations of the Hilbert curve, a space-filling curve
E.g., for the third one, before giving an IFS description of the Sierpinski Gasket, describe
a simple procedure by which the fractal geometric object Sierpinski gasket can be
obtained.
Algorithm
Draw structure diagrams (design the operations, documenting them using either
functional decomposition diagrams or UML diagrams).

And make a C++ program
Nov 1 '06 #1
4 9596
Banfa
9,065 Expert Mod 8TB
Right, do you know the algorithms to required to solve these fractal problems?

You will need to so if you don't go and get/buy a book on fractals or Google it. This is all well known stuff now so it isn't hard to find.

Once you have the algorithm the code is normally fairly simple to create.
Nov 1 '06 #2
can you please tell me on which book or on which web site i can get informations and initialize the program.
Nov 2 '06 #3
Banfa
9,065 Expert Mod 8TB
Was typing "Koch snowflake" into the search box on Google too hard a task for you?
Nov 2 '06 #4
hi alll
i got some c++ codes for it if some one can compile it and try to make a programm for hillbirt curve it fantstic it would help ful for me as well


enum {
UP,
LEFT,
DOWN,
RIGHT,
};

void hilbert(int level,int direction=UP)
{
if (level==1) {
switch (direction) {
case LEFT:
move(RIGHT); /* move() could draw a line in... */
move(DOWN); /* ...the indicated direction */
move(LEFT);
break;
case RIGHT:
move(LEFT);
move(UP);
move(RIGHT);
break;
case UP:
move(DOWN);
move(RIGHT);
move(UP);
break;
case DOWN:
move(UP);
move(LEFT);
move(DOWN);
break;
} /* switch */
} else {
switch (direction) {
case LEFT:
hilbert_level(level-1,UP);
move(RIGHT);
hilbert_level(level-1,LEFT);
move(DOWN);
hilbert_level(level-1,LEFT);
move(LEFT);
hilbert_level(level-1,DOWN);
break;
case RIGHT:
hilbert_level(level-1,DOWN);
move(LEFT);
hilbert_level(level-1,RIGHT);
move(UP);
hilbert_level(level-1,RIGHT);
move(RIGHT);
hilbert_level(level-1,UP);
break;
case UP:
hilbert_level(level-1,LEFT);
move(DOWN);
hilbert_level(level-1,UP);
move(RIGHT);
hilbert_level(level-1,UP);
move(UP);
hilbert_level(level-1,RIGHT);
break;
case DOWN:
hilbert_level(level-1,RIGHT);
move(UP);
hilbert_level(level-1,DOWN);
move(LEFT);
hilbert_level(level-1,DOWN);
move(DOWN);
hilbert_level(level-1,LEFT);
break;
} /* switch */
} /* if */
}



shameen
Nov 9 '06 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by dimfox | last post: by
1 post views Thread by Paul Nathan | last post: by
5 posts views Thread by nikhila6101017 | last post: by
mia023
13 posts views Thread by mia023 | last post: by
1 post views Thread by Waqarahmed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.