Important alert: (current site time 7/16/2013 2:34:33 AM EDT)
 

winzip icon

Real Tree (Branches & Leaves)

Email
Submitted on: 9/15/2006 7:47:16 AM
By: Mohammad Reza Khosravi  
Level: Beginner
User Rating: By 26 Users
Compatibility: VB 6.0
Views: 19802
author picture
(About the author)
 
     Think 3D ! Sometimes in programming, the current loop statements such as for...next or do...while can't help us and we need more. This is a simple and funny program that shows you how a function can refer to itself and make a loop. I use this function to make a tree, because I like trees, but you can use it for making virus growth simulation!, if you like. This program may help beginners learn more about graphics, mathematical algorithms, fractals, API, recursive functions, sounds and some VB controls. I'd like to hear from you, so please leave me a note. __________________________________________________________ August 15... First release. __________________________________________________________ August 17... Added "Leaf Level" & "Width". __________________________________________________________ August 21... Added "Change Background" & a few small changes in source code. __________________________________________________________ August 26... Added "Wind Direction" & "OnTop" & improved for using higher values of "Branches per Step". __________________________________________________________ August 30... Added "Width Scale".

 
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
  3. Scan the source code with Minnow's Project Scanner

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 4 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments
8/15/2006 9:59:38 AMT Jackson

This is pretty cool. Dunno what you're on about with your statement about the for..next or do..while can't help us.
There's hardly any code in this and it works well. 5/5 *****
(If this comment was disrespectful, please report it.)

 
8/15/2006 10:05:11 AMaz1d

I like it, nicely done for begginers code.
-az1d
(If this comment was disrespectful, please report it.)

 
8/16/2006 5:20:44 AMRobert Rayment

There is a similar fractal tree at CodeId=23556 but yours is a nicer implementation. Other tree/bush shapes, in case your interested, at CodeId=36449. 5/5
(If this comment was disrespectful, please report it.)

 
8/16/2006 5:42:42 AMPaul Turcksin

Very nice. I get however "strange" results when setting more than 20 steps.
(If this comment was disrespectful, please report it.)

 
8/16/2006 8:26:02 AMMohammad Reza Khosravi

thanks for all of your comments .
for higher steps you must activate "Brocken Branchs", this make your Tree faster and real,
and also I add 2 new controls to program, see it again ! and please vote for me :D


(If this comment was disrespectful, please report it.)

 
8/17/2006 3:08:14 AMRobert Rayment

Nice enhancements (Leaf level & Width) in your update.
(If this comment was disrespectful, please report it.)

 
8/17/2006 4:28:10 AMgrigri

Very nice indeed. An excellent learning tool for beginners.

T Jackson: I think Mohammad is talking about recursive functions, and how they solve the problems that normal, iterative, routines cause. Although it's perfectly possible to code a routine like this iteratively, a recuerive implementation is much easier to code and understand.
(If this comment was disrespectful, please report it.)

 
8/17/2006 4:31:03 AMPaul Turcksin

Yep, it's getting better and better.
(If this comment was disrespectful, please report it.)

 
8/17/2006 7:48:21 AMPersianCity

It's very nice Mohammad.
Thanks and eyval baba :D
(If this comment was disrespectful, please report it.)

 
8/18/2006 10:51:04 AMApeiron

Really nice, try adding "* (Rnd * 10 / 8)" to the end of the mySize line in the next branch function. It makes it look even more realistic. I always look forward to code like this, simple straight forward but produces complex, nice effects.
(If this comment was disrespectful, please report it.)

 
8/20/2006 12:01:41 PMMohammad Reza Khosravi

Thanks again.
grigri: very nice comment .
Apeiron: I wil use your suggestion in next version.
(If this comment was disrespectful, please report it.)

 
8/28/2006 2:25:38 PMLight Templer

Very nice with a good look for details! My ***** for and regards! LiTe
(If this comment was disrespectful, please report it.)

 
8/30/2006 2:32:04 PMaz1d

Some nice updates. Keep them coming.
-az1d
(If this comment was disrespectful, please report it.)

 
9/13/2006 12:23:39 PMLisandro Grassini

Awesome!!!
(If this comment was disrespectful, please report it.)

 
9/13/2006 2:57:57 PMMohammad Reza Khosravi

I would like to thank all of you for comments, suggestions, voting and making this code a contest winner. it is truly appreciated. Mohammad
(If this comment was disrespectful, please report it.)

 
9/26/2006 6:03:35 AMBrian Ail

recall own function...interesting. but this might lead to overflow. as long as the input is controlled well this is good as well.
(If this comment was disrespectful, please report it.)

 
9/26/2006 8:53:14 AMMohammad Reza Khosravi

Brian : thanks. Yes, overflows are everywhere, but we must control them.


(If this comment was disrespectful, please report it.)

 
10/4/2006 8:27:25 AMMohammad Reza Khosravi

Now you can find 2nd version at the following address:

http://www.planet-source-code.com/vb/scripts/BrowseCategoryOrSearchResul ts.asp?lngWId=1&blnAuthorSearch=TRUE&lngAuthorId=33153859942&strAuthorName=Mohammad%20Reza%20Khosrav i&txtMaxNumberOfEntriesPerPage=25

(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.