public override void DoCalculation() { DirectBitmap map = Map; if (map == null) { return; } extremas = new Extremas(); InitMap(map); CalcTypePoints(); if (!map.CalculatedTypes.Contains(smoozeType)) { map.CalculatedTypes.Add(smoozeType); } map.Calced_CLR_Z = true; }
protected void CalcExtremas() { float A0 = (float)parameters[0]; float B0 = (float)parameters[6]; extremas = new Extremas(); calcedPoints.Clear(); double V = startPoint.X; double R = startPoint.Y; int P = maxIterations; double A = 1000 * A0; A = A * (float)Math.PI / 180f; double X = 0; double Y = 0; SetExtrema(X, X); calcedPoints.Add(new PointF((float)X, (float)X)); double powMax = Math.Pow(V, P - 1); for (int N = 0; N < (V + 1) * powMax - 1; N++) { int M = N; double B = N * A; int F = 0; if ((M % V) == 0 && F < P - 1) { M = (int)Math.Floor((double)M / (double)V); while ((M % V) == 0 && F < P - 1) { F++; } } double pow = Math.Pow(R, P - F - 1); double X2 = X + pow * Math.Cos(B); double Y2 = Y + pow * Math.Sin(B); X = X2; Y = Y2; SetExtrema(X, Y); calcedPoints.Add(new PointF((float)X, (float)Y)); } }
protected void CalcExtremas2() { float A = (float)parameters[0]; float B = (float)parameters[6]; extremas = new Extremas(); calcedPoints.Clear(); double C = 0.9; double X = StartPoint.X; double Y = StartPoint.Y; for (int n = 0; n < maxIterations; n++) { SetExtrema(X, Y); calcedPoints.Add(new PointF((float)X, (float)Y)); double Z = X; X = C * Y + CloudFunc2(X, A, B); Y = -Z + CloudFunc2(X, A, B); } }
protected void CalcExtremas1() { float A = (float)parameters[0]; float B = (float)parameters[6]; extremas = new Extremas(); calcedPoints.Clear(); for (int k = 0; k < 7; k++) { double X = Xs[k]; double Y = Ys[k]; double P = Ps[k]; for (int n = 0; n < P; n++) { SetExtrema(X, Y); calcedPoints.Add(new PointF((float)X, (float)Y)); double Z = X; X = Y + CloudFunc1(X, A, B); Y = -Z + CloudFunc1(X, A, B); } } }
protected override void CalcTypePoints() { calcedPoints.Clear(); extremas = new Extremas(); CalcExtremas((float)parameters[0], (float)parameters[6]); if (spreadA) { for (float i = 1; i < 5; i++) { CalcExtremas((float)parameters[0] - i * 0.001f, (float)parameters[6]); CalcExtremas((float)parameters[0] + i * 0.001f, (float)parameters[6]); } } if (spreadA) { for (float i = 1; i < 5; i++) { calcedPoints.Clear(); CalcExtremas((float)parameters[0] - i * 0.01f, (float)parameters[6]); CalcPoints((float)parameters[0] - i * 0.001f, (float)parameters[6], Constants.smoozedColors[(int)i % Constants.smoozedColors.Count].color); calcedPoints.Clear(); CalcExtremas((float)parameters[0] + i * 0.01f, (float)parameters[6]); CalcPoints((float)parameters[0] + i * 0.001f, (float)parameters[6], Constants.smoozedColors[((int)i + 5) % Constants.smoozedColors.Count].color); } } calcedPoints.Clear(); CalcExtremas((float)parameters[0], (float)parameters[6]); if (Constants.smoozedColors.Count > 0) { CalcPoints((float)parameters[0], (float)parameters[6], Constants.smoozedColors[0].color); } else { CalcPoints((float)parameters[0], (float)parameters[6], Color.Black); } }
protected void CalcExtremas0() { float A = (float)parameters[0]; float B = (float)parameters[6]; extremas = new Extremas(); calcedPoints.Clear(); double X = startPoint.X; double Y = startPoint.Y; for (int N = 0; N < maxIterations; N++) { if (Math.Abs(X) + Math.Abs(Y) > 200000) { break; } SetExtrema(X, Y); calcedPoints.Add(new PointF((float)X, (float)Y)); double Z = X; X = Y + CloudFunc0(X, A, B); Y = -Z + CloudFunc0(X, A, B); } }
protected void CalcExtremas() { float A = (float)parameters[0]; float B = (float)parameters[6]; extremas = new Extremas(); calcedPoints.Clear(); Random rand = new Random(); B = (float)Math.Sqrt(1 - A * A); double X = A; double Y = B; double C = A; double D = -B; for (int i = 0; i < maxIterations; i++) { double r = rand.NextDouble(); if (r < 0.5) { double Z = X; X = A * X - B * Y; Y = B * Z + A * Y; SetExtrema(X, Y); calcedPoints.Add(new PointF((float)X, (float)Y)); } else { double Z = X; X = C * X - D * Y + 1 - C; Y = D * Z + A * Y - D; SetExtrema(X, Y); calcedPoints.Add(new PointF((float)X, (float)Y)); } } }
protected void CalcExtremas() { float A = (float)parameters[0]; float B = (float)parameters[6]; double P = 1 / Math.Sqrt(2); double Q = P * Math.Sqrt(1 - B * B); extremas = new Extremas(); // Calculate the values. for (long N = -maxIterations / 2; N < maxIterations / 2; N++) { double S = N * Math.PI / 50; double T = Math.Atan(A * S); double X = Math.Cos(S) * Math.Cos(T); double Y = Math.Sin(S) * Math.Cos(T); double Z = Math.Sin(T); double U = P * (Y - X); double V = B * Z - Q * (X + Y); SetExtrema(U, V); } deltaX = (1.0 * extremas.xmax - extremas.xmin); deltaY = (1.0 * extremas.ymax - extremas.ymin); }
protected void CalcExtremas() { float A = (float)parameters[0]; float B = (float)parameters[6]; extremas = new Extremas(); calcedPoints.Clear(); float DELH = 1.6f; float DELV = 1.2f; int N1 = maxIterations; int N2 = (int)Math.Floor(N1 * DELV / DELH); int N3 = 0; if (B != 0) { N3 = -N2; } int XM = 320; int YM = 240; float S = 0; for (int i = 0; i < N1; i++) { for (int j = N3; j < N2; j++) { int i1 = XM + i; int i2 = XM - i; float X = 1.0f * i * DELH / N1; int j1 = YM - j; int j2 = YM + j; float Y = 1.0f * j * DELV / N2; for (int k = 1; k <= 800; k++) { float X1 = X * X - Y * Y + A; float Y1 = 2 * X * Y + B; S = X * X + Y * Y; float S1 = (X - X1) * (X - X1) + (Y - Y1) * (Y - Y1); if (S > 1000) { break;//break k-loop } if (S1 < 0.001) { SetExtrema(i1, j1); SetExtrema(i2, j2); if (B == 0) { SetExtrema(i1, j2); SetExtrema(i2, j1); } break;//break k-loop } else { X = X1; Y = Y1; } } } } }