The graphics implemented by the program are:
I think it is more beautiful than the tree in nature.
The tree is one of the strongest life. On the western part of my country, the place where life is rare, but it can often see a piece of Populus. About Poplar, there is a beautiful assertion, you must have heard:
She is in the Gobi, will be survive and not dead for a thousand years. After death, I will not fall in a thousand years.
The tree is also the most elegant life. You come in the country to see it. ---
How many poems have, how much, is singing them ~~~
No good, there will be no happiness!
The fractal will bring you a wonderful, and the fractal can make you happy ~~~
I will post more trees in the future, constantly repeat this theme, because in my life, the tree is so important!
The code of the program (C #) is:
Using system;
Using system.drawing;
Using system.collections;
Using system.componentmodel;
Using system.windows.forms;
Using system.data;
Namespace Picture
{
///
/// Form1 summary description.
/// summary>
Public Class Form1: System.Windows.Forms.form
{
///
/// The required designer variable.
/// summary>
Private system.componentmodel.Container Components = NULL;
Private Pen Greenpen = New Pen (Color.green, 0);
Private random randnum = new random (unchecked ((int) datetime.now.ticks)
Public Form1 ()
{
//
// Windows Form Designer Support
//
InitializationComponent ();
//
// Todo: Add any constructor code after INITIALIZECOMPONENT call
//
}
///
/// Clean all the resources being used.
/// summary>
Protected Override Void Dispose (Bool Disposing)
{
IF (Disposing)
{
IF (Components! = NULL)
{
Components.dispose ();
}
}
Base.dispose (Disposing);
}
#Region Windows Form Designer Generated Code
///
/// Designer supports the required method - do not use the code editor to modify
/// This method is content.
/// summary>
Private vidinitiRizeComponent ()
{
//
// Form1
//
THIS.AUTOSCALEBASESIZE = New System.drawing.size (6, 14);
THIS.BACKCOLOR = system.drawing.systemcolors.windowText;
THIS.CLIENTSIZE = New System.drawing.size (488, 333);
THIS.NAME = "Form1";
THIS.TEXT = "Beautiful Fractal";
This.WindowsTate = system.windows.forms.formwindowsTate.maximized;
}
#ndregion
///
/// The main entry point for the application. /// summary>
[Stathread]
Static void main ()
{
Application.run (New Form1 ());
}
///
// / Overload onPaint
/// summary>
/// param>
Protected Override Void Onpaint (Painteventargs E)
{
DrawTree (e);
Base.onpaint (e);
}
///
/// Draw fractal graphics
/// summary>
/// param>
/// param>
Private void DrawTree (Painteventargs E)
{
Graphics DC = E.GRAPHICS;
INT K = 0, RAND;
Double x = 0, y = 0;
Double maxx = this.width, maxy = this.height;
Double [,] d = new double [4,6];
D [0, 0] = 0; D [0, 1] = 0; D [0, 3] = 0.5; D [0, 4] = 0; D [0, 5 ] = 0;
D [1,0] = 0.42; D [1, 2] = 0.42; D [1, 3] = 0.42; D [1, 4] = 0; D [1, 5] = 0.2;
D [2,0] = 0.42; D [2, 2] = - 0.42; D [2, 3] = 0.42; D [2, 4] = 0; D [2, 5] = 0.2;
D [3,0] = 0.1; D [3, 1] = 0; D [3, 2] = 0; D [3, 3] = 0.1; D [3, 4] = 0; D [3, 5 ] = 0.2;
For (int i = 0; i <30001; i )
{
Rand = randnum.next (0,100);
IF (Rand <= 40)
K = 1;
IF (Rand> 40 && Rand <81)
K = 2;
IF (Rand> = 81 && rand <95)
K = 3;
IF (Rand> = 95)
K = 0;
X = D [k, 0] * x d [k, 1] * Y D [k, 4];
Y = D [k, 2] * x d [k, 3] * y D [k, 5];
IF (i> 10)
Dc.drawellipse (Greenpen, 50 (int) Math.Round (Maxy / 2 3 * Maxy * x),
(int) Math.Round (MAXY-3 * MAXY * Y), 1, 1);
}
}
}
}
Uploaded iterative function system transformation, relevant definitions, please see a post in the fractal point:
http://www.9cbs.net/develop/read_article.asp?id=17613