By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,227 Members | 1,429 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,227 IT Pros & Developers. It's quick & easy.

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

P: 4
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
Share this Question
Share on Google+
4 Replies


Banfa
Expert Mod 5K+
P: 8,916
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

P: 4
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
Expert Mod 5K+
P: 8,916
Was typing "Koch snowflake" into the search box on Google too hard a task for you?
Nov 2 '06 #4

P: 1
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.