- void OnPaint(wxPaintEvent& event);
- void Fractal(wxDC& dc, int X1, int Y1, int X2, int Y2, int Z1, int Z2, int Z3, int Z4, int Iteration, double Std, double Ratio);
- wxPen SnowPen, MtnPen, GreenPen;
- wxBrush WaterBrush;
- int Sealevel;
+ void OnPaint(wxPaintEvent& event);
+ void Fractal(wxDC& dc, int X1, int Y1, int X2, int Y2, int Z1, int Z2, int Z3, int Z4, int Iteration, double Std, double Ratio);
+ wxPen SnowPen, MtnPen, GreenPen;
+ wxBrush WaterBrush;
+ int Sealevel;
- int Xmid = (X1 + X2) / 2;
- int Ymid = (Y1 + Y2) / 2;
- int Z23 = (Z2 + Z3) / 2;
- int Z41 = (Z4 + Z1) / 2;
- int Newz = (int)((Z1 + Z2 + Z3 + Z4) / 4 + (double)(Random(17) - 8) / 8.0 * Std);
-
- if (--Iteration)
- {
- int Z12 = (Z1 + Z2) / 2;
- int Z34 = (Z3 + Z4) / 2;
- double Stdmid = Std * Ratio;
-
- Fractal(dc, Xmid, Y1, X2, Ymid, Z12, Z2, Z23, Newz, Iteration, Stdmid, Ratio);
- Fractal(dc, X1, Y1, Xmid, Ymid, Z1, Z12, Newz, Z41, Iteration, Stdmid, Ratio);
- Fractal(dc, Xmid, Ymid, X2, Y2, Newz, Z23, Z3, Z34, Iteration, Stdmid, Ratio);
- Fractal(dc, X1, Ymid, Xmid, Y2, Z41, Newz, Z34, Z4, Iteration, Stdmid, Ratio);
- }
- else
- {
- if (Newz <= Sealevel)
- {
- wxPoint P[4];
- P[0].x = Y1 / 2 + X1; P[0].y = Y1 + Z1;
- P[1].x = Y1 / 2 + X2; P[1].y = Y1 + Z2;
- P[2].x = Y2 / 2 + X2; P[2].y = Y2 + Z3;
- P[3].x = Y2 / 2 + X1; P[3].y = Y2 + Z4;
-
- dc.SetPen(* wxBLACK_PEN);
- dc.SetBrush(* wxBLACK_BRUSH);
-
- dc.DrawPolygon(4, P);
-
- if (Z1 >= -(60+Random(25)))
- dc.SetPen(GreenPen);
- else if (Z1 >= -(100+Random(25)))
- dc.SetPen(MtnPen);
- else
- dc.SetPen(SnowPen);
-
- dc.DrawLine(Ymid/2+X2, Ymid+Z23, Ymid/2+X1, Ymid+Z41);
- }
- }
+ int Xmid = (X1 + X2) / 2;
+ int Ymid = (Y1 + Y2) / 2;
+ int Z23 = (Z2 + Z3) / 2;
+ int Z41 = (Z4 + Z1) / 2;
+ int Newz = (int)((Z1 + Z2 + Z3 + Z4) / 4 + (double)(Random(17) - 8) / 8.0 * Std);
+
+ if (--Iteration)
+ {
+ int Z12 = (Z1 + Z2) / 2;
+ int Z34 = (Z3 + Z4) / 2;
+ double Stdmid = Std * Ratio;
+
+ Fractal(dc, Xmid, Y1, X2, Ymid, Z12, Z2, Z23, Newz, Iteration, Stdmid, Ratio);
+ Fractal(dc, X1, Y1, Xmid, Ymid, Z1, Z12, Newz, Z41, Iteration, Stdmid, Ratio);
+ Fractal(dc, Xmid, Ymid, X2, Y2, Newz, Z23, Z3, Z34, Iteration, Stdmid, Ratio);
+ Fractal(dc, X1, Ymid, Xmid, Y2, Z41, Newz, Z34, Z4, Iteration, Stdmid, Ratio);
+ }
+ else
+ {
+ if (Newz <= Sealevel)
+ {
+ wxPoint P[4];
+ P[0].x = Y1 / 2 + X1; P[0].y = Y1 + Z1;
+ P[1].x = Y1 / 2 + X2; P[1].y = Y1 + Z2;
+ P[2].x = Y2 / 2 + X2; P[2].y = Y2 + Z3;
+ P[3].x = Y2 / 2 + X1; P[3].y = Y2 + Z4;
+
+ dc.SetPen(* wxBLACK_PEN);
+ dc.SetBrush(* wxBLACK_BRUSH);
+
+ dc.DrawPolygon(4, P);
+
+ if (Z1 >= -(60+Random(25)))
+ dc.SetPen(GreenPen);
+ else if (Z1 >= -(100+Random(25)))
+ dc.SetPen(MtnPen);
+ else
+ dc.SetPen(SnowPen);
+
+ dc.DrawLine(Ymid/2+X2, Ymid+Z23, Ymid/2+X1, Ymid+Z41);
+ }
+ }