Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
HalleySmoothFractal.cs
1using System;
2using System.Numerics;
3using System.Text;
4using SkiaSharp;
10
12{
41 {
46 ScriptNode Palette, ScriptNode DimX, ScriptNode DimY, int Start, int Length, Expression Expression)
47 : base(new ScriptNode[] { z, dr, R, Coefficients, Palette, DimX, DimY },
48 new ArgumentType[] { ArgumentType.Scalar, ArgumentType.Scalar, ArgumentType.Scalar,
49 ArgumentType.Normal, ArgumentType.Vector, ArgumentType.Scalar, ArgumentType.Scalar}, Start, Length, Expression)
50 {
51 }
52
57 ScriptNode Palette, ScriptNode DimX, int Start, int Length, Expression Expression)
58 : base(new ScriptNode[] { z, dr, R, Coefficients, Palette, DimX },
59 new ArgumentType[] { ArgumentType.Scalar, ArgumentType.Scalar, ArgumentType.Scalar,
61 {
62 }
63
68 ScriptNode Palette, int Start, int Length, Expression Expression)
69 : base(new ScriptNode[] { z, dr, R, Coefficients, Palette },
70 new ArgumentType[] { ArgumentType.Scalar, ArgumentType.Scalar, ArgumentType.Scalar,
72 {
73 }
74
80 : base(new ScriptNode[] { z, dr, R, Coefficients },
81 new ArgumentType[] { ArgumentType.Scalar, ArgumentType.Scalar, ArgumentType.Scalar,
83 {
84 }
85
90 : base(new ScriptNode[] { z, dr, R },
91 new ArgumentType[] { ArgumentType.Scalar, ArgumentType.Scalar, ArgumentType.Scalar }, Start, Length, Expression)
92 {
93 }
94
99 : base(new ScriptNode[] { z, dr },
100 new ArgumentType[] { ArgumentType.Scalar, ArgumentType.Scalar }, Start, Length, Expression)
101 {
102 }
103
107 public override string[] DefaultArgumentNames
108 {
109 get
110 {
111 return new string[] { "z", "dr", "R", "Coefficients", "Palette", "DimX", "DimY" };
112 }
113 }
114
119 {
120 string ColorExpression = null;
121 SKColor[] Palette;
122 double[] Coefficients = null;
123 Complex[] CoefficientsZ = null;
124 ILambdaExpression f = null;
125 ScriptNode fDef = null;
126 double rc, ic;
127 double dr;
128 Complex R;
129 int dimx, dimy;
130 int c = Arguments.Length;
131 int i = 0;
132 object Obj;
133
134 Obj = Arguments[i++].AssociatedObjectValue;
135 if (Obj is Complex z)
136 {
137 rc = z.Real;
138 ic = z.Imaginary;
139 }
140 else
141 {
142 rc = Expression.ToDouble(Obj);
143 ic = Expression.ToDouble(Arguments[i++].AssociatedObjectValue);
144 }
145
146 if (i >= c)
147 throw new ScriptRuntimeException("Insufficient parameters in call to HalleySmoothFractal().", this);
148
149 dr = Expression.ToDouble(Arguments[i++].AssociatedObjectValue);
150
151 if (i < c && ((Obj = Arguments[i].AssociatedObjectValue) is double || Obj is Complex))
152 {
153 R = Expression.ToComplex(Obj);
154 i++;
155 }
156 else
157 {
158 R = Complex.One;
159
160 if (i < c && this.Arguments[i] is null)
161 i++;
162 }
163
164 if (i < c)
165 {
166 if (Arguments[i] is DoubleVector)
167 Coefficients = (double[])Arguments[i++].AssociatedObjectValue;
168 else if (Arguments[i] is ComplexVector)
169 CoefficientsZ = (Complex[])Arguments[i++].AssociatedObjectValue;
170 /*else if (Parameters[i] is RealPolynomial)
171 Coefficients = ((RealPolynomial)Arguments[i++].AssociatedObjectValue).Coefficients;
172 else if (Parameters[i] is ComplexPolynomial)
173 CoefficientsZ = ((ComplexPolynomial)Arguments[i++].AssociatedObjectValue).Coefficients;*/
174 else if (Arguments[i] is IVector)
175 {
176 IVector Vector = (IVector)Arguments[i++];
177 int j, d = Vector.Dimension;
178
179 CoefficientsZ = new Complex[d];
180 for (j = 0; j < d; j++)
181 CoefficientsZ[j] = Expression.ToComplex(Vector.GetElement(j).AssociatedObjectValue);
182 }
183 else if (Arguments[i].AssociatedObjectValue is ILambdaExpression)
184 {
186 if (f.NrArguments != 1)
187 throw new ScriptRuntimeException("Lambda expression in calls to HalleySmoothFractal() must be of one variable.", this);
188
189 fDef = this.Arguments[i++];
190 }
191 else
192 {
193 throw new ScriptRuntimeException("Parameter " + (i + 1).ToString() +
194 " in call to HalleySmoothFractal has to be a vector of numbers, containing coefficients " +
195 "of the polynomial to use. Now it was of type " + Arguments[i].GetType().FullName,
196 this);
197 }
198 }
199 else
200 throw new ScriptRuntimeException("Missing coefficients or lambda expression.", this);
201
202 if (i < c && !(this.Arguments[i] is null) && Arguments[i] is ObjectVector)
203 {
204 ColorExpression = this.Arguments[i].SubExpression;
206 }
207 else
208 {
209 Palette = ColorModels.RandomLinearAnalogousHSL.CreatePalette(128, 4, out int Seed, this, Variables);
210 ColorExpression = "RandomLinearAnalogousHSL(128,4," + Seed.ToString() + ")";
211
212 if (i < c && this.Arguments[i] is null)
213 i++;
214 }
215
216 if (i < c)
217 dimx = (int)Expression.ToDouble(Arguments[i++].AssociatedObjectValue);
218 else
219 dimx = 320;
220
221 if (i < c)
222 dimy = (int)Expression.ToDouble(Arguments[i++].AssociatedObjectValue);
223 else
224 dimy = 200;
225
226 if (i < c)
227 {
228 throw new ScriptRuntimeException("Parameter mismatch in call to HalleySmoothFractal(z,dr[,R][,Coefficients][,Palette][,dimx[,dimy]]).",
229 this);
230 }
231
232 if (dimx <= 0 || dimx > 5000 || dimy <= 0 || dimy > 5000)
233 throw new ScriptRuntimeException("Image size must be within 1x1 to 5000x5000", this);
234
235 if (!(f is null))
236 {
237 return CalcHalley(rc, ic, dr, R, f, Variables, Palette, dimx, dimy, this, this.FractalZoomScript,
238 new object[] { Palette, dimx, dimy, R, fDef, ColorExpression });
239 }
240 else if (!(CoefficientsZ is null))
241 {
242 return CalcHalley(rc, ic, dr, R, CoefficientsZ, Palette, dimx, dimy,
243 this, Variables, this.FractalZoomScript,
244 new object[] { Palette, dimx, dimy, R, CoefficientsZ, ColorExpression });
245 }
246 else
247 {
248 return CalcHalley(rc, ic, dr, R, Coefficients, Palette, dimx, dimy,
249 this, Variables, this.FractalZoomScript,
250 new object[] { Palette, dimx, dimy, R, Coefficients, ColorExpression });
251 }
252 }
253
254 private string FractalZoomScript(double r, double i, double Size, object State)
255 {
256 object[] Parameters = (object[])State;
257 //SKColor[] Palette = (SKColor[])Parameters[0];
258 int DimX = (int)Parameters[1];
259 int DimY = (int)Parameters[2];
260 Complex R = (Complex)Parameters[3];
261 string ColorExpression = (string)Parameters[5];
262
263 StringBuilder sb = new StringBuilder();
264
265 sb.Append("HalleySmoothFractal((");
266 sb.Append(Expression.ToString(r));
267 sb.Append(',');
268 sb.Append(Expression.ToString(i));
269 sb.Append("),");
270 sb.Append(Expression.ToString(Size / 4));
271 sb.Append(',');
272 sb.Append(Expression.ToString(R));
273 sb.Append(',');
274
275 if (Parameters[4] is ScriptNode fDef)
276 sb.Append(fDef.SubExpression);
277 else if (Parameters[4] is Complex[] CoefficientsZ)
278 sb.Append(Expression.ToString(CoefficientsZ));
279 else if (Parameters[4] is double[] Coefficients)
280 sb.Append(Expression.ToString(Coefficients));
281
282 if (!string.IsNullOrEmpty(ColorExpression))
283 {
284 sb.Append(',');
285 sb.Append(ColorExpression);
286 }
287
288 sb.Append(',');
289 sb.Append(DimX.ToString());
290 sb.Append(',');
291 sb.Append(DimY.ToString());
292 sb.Append(')');
293
294 return sb.ToString();
295 }
296
300 public static FractalGraph CalcHalley(double rCenter, double iCenter, double rDelta, Complex R,
301 double[] Coefficients, SKColor[] Palette, int Width, int Height, ScriptNode Node, Variables Variables,
302 FractalZoomScript FractalZoomScript, object State)
303 {
304 double RRe = R.Real;
305 double RIm = R.Imaginary;
306 double r0, i0, r1, i1;
307 double dr, di;
308 double r, i;
309 double zr, zi, zr2, zi2, zr3, zi3, zr4, zi4, zr5, zi5, zr6, zi6;
310 double aspect;
311 double Temp;
312 int x, y;
313 int n, N;
314 int index;
315 int Degree = Coefficients.Length - 1;
316
317 N = Palette.Length;
318
319 if (Degree < 3)
320 {
321 Array.Resize(ref Coefficients, 4);
322 while (Degree < 3)
323 Coefficients[++Degree] = 0;
324 }
325
326 double[] Prim = new double[Degree];
327 for (x = 1; x <= Degree; x++)
328 Prim[x - 1] = x * Coefficients[x];
329
330 double[] Bis = new double[Degree - 1];
331 for (x = 1; x < Degree; x++)
332 Bis[x - 1] = x * Prim[x];
333
334 Array.Reverse(Bis);
335 Array.Reverse(Prim);
336 Coefficients = (double[])Coefficients.Clone();
337 Array.Reverse(Coefficients);
338
339 int size = Width * Height;
340 double[] ColorIndex = new double[size];
341 double Conv = 1e-10;
342 double Div = 1e10;
343
344 rDelta *= 0.5;
345 r0 = rCenter - rDelta;
346 r1 = rCenter + rDelta;
347
348 aspect = ((double)Width) / Height;
349
350 i0 = iCenter - rDelta / aspect;
351 i1 = iCenter + rDelta / aspect;
352
353 dr = (r1 - r0) / Width;
354 di = (i1 - i0) / Height;
355
356 for (y = 0, i = i0, index = 0; y < Height; y++, i += di)
357 {
358 for (x = 0, r = r0; x < Width; x++, r += dr)
359 {
360 zr = r;
361 zi = i;
362
363 n = 0;
364 do
365 {
366 // f:
367 zr2 = zi2 = 0;
368 foreach (double C in Coefficients)
369 {
370 Temp = zr2 * zr - zi2 * zi + C;
371 zi2 = zr2 * zi + zi2 * zr;
372 zr2 = Temp;
373 }
374
375 // f':
376 zr3 = zi3 = 0;
377 foreach (double C in Prim)
378 {
379 Temp = zr3 * zr - zi3 * zi + C;
380 zi3 = zr3 * zi + zi3 * zr;
381 zr3 = Temp;
382 }
383
384 // f":
385 zr4 = zi4 = 0;
386 foreach (double C in Bis)
387 {
388 Temp = zr4 * zr - zi4 * zi + C;
389 zi4 = zr4 * zi + zi4 * zr;
390 zr4 = Temp;
391 }
392
393 // 2*f*f'
394
395 zr5 = 2 * (zr2 * zr3 - zi2 * zi3);
396 zi5 = 2 * (zr2 * zi3 + zi2 * zr3);
397
398 // 2f'^2-f*f"
399
400 zr6 = 2 * (zr3 * zr3 - zi3 * zi3) - (zr2 * zr4 - zi2 * zi4);
401 zi6 = 4 * zr3 * zi3 - (zr2 * zi4 + zr4 * zi2);
402
403 // 2*f*f'/(2f'^2-f*f")
404
405 Temp = 1.0 / (zr6 * zr6 + zi6 * zi6);
406 zr4 = (zr5 * zr6 + zi5 * zi6) * Temp;
407 zi4 = (zi5 * zr6 - zr5 * zi6) * Temp;
408
409 // R*2*f*f'/(2f'^2-f*f")
410 Temp = zr4 * RRe - zi4 * RIm;
411 zi4 = zr4 * RIm + zi4 * RRe;
412 zr4 = Temp;
413
414 zr -= zr4;
415 zi -= zi4;
416
417 Temp = Math.Sqrt(zr4 * zr4 + zi4 * zi4);
418 }
419 while ((Temp > Conv) && (Temp < Div) && (n++ < N));
420
421 if (Temp < Conv && n < N)
422 ColorIndex[index++] = n;
423 else
424 ColorIndex[index++] = N;
425 }
426 }
427
428 Variables.Preview(Node.Expression, new GraphBitmap(Variables, FractalGraph.ToPixels(ColorIndex, Width, Height, Palette)));
429
430 double[] Boundary = FractalGraph.FindBoundaries(ColorIndex, Width, Height);
431 FractalGraph.Smooth(ColorIndex, Boundary, Width, Height, N, Palette, Node, Variables);
432
433 return new FractalGraph(Variables, FractalGraph.ToPixels(ColorIndex, Width, Height, Palette),
434 r0, i0, r1, i1, rDelta * 2, true, Node, FractalZoomScript, State);
435 }
436
440 public static FractalGraph CalcHalley(double rCenter, double iCenter, double rDelta, Complex R,
441 Complex[] Coefficients, SKColor[] Palette, int Width, int Height, ScriptNode Node, Variables Variables,
442 FractalZoomScript FractalZoomScript, object State)
443 {
444 double RRe = R.Real;
445 double RIm = R.Imaginary;
446 double r0, i0, r1, i1;
447 double dr, di;
448 double r, i;
449 double zr, zi, zr2, zi2, zr3, zi3, zr4, zi4, zr5, zi5, zr6, zi6;
450 double aspect;
451 double Temp;
452 int x, y;
453 int n, N;
454 int index;
455 int Degree = Coefficients.Length - 1;
456
457 N = Palette.Length;
458
459 if (Degree < 3)
460 {
461 Array.Resize(ref Coefficients, 4);
462 while (Degree < 3)
463 Coefficients[++Degree] = Complex.Zero;
464 }
465
466 Complex[] Prim = new Complex[Degree];
467 for (x = 1; x <= Degree; x++)
468 Prim[x - 1] = x * Coefficients[x];
469
470 Complex[] Bis = new Complex[Degree - 1];
471 for (x = 1; x < Degree; x++)
472 Bis[x - 1] = x * Prim[x];
473
474 Array.Reverse(Bis);
475 Array.Reverse(Prim);
476 Coefficients = (Complex[])Coefficients.Clone();
477 Array.Reverse(Coefficients);
478
479 int j, c = Prim.Length;
480 int c2 = c - 1;
481 double[] ReC = new double[c + 1];
482 double[] ImC = new double[c + 1];
483 double[] RePrim = new double[c];
484 double[] ImPrim = new double[c];
485 double[] ReBis = new double[c2];
486 double[] ImBis = new double[c2];
487 Complex z;
488
489 for (j = 0; j < c; j++)
490 {
491 z = Coefficients[j];
492 ReC[j] = z.Real;
493 ImC[j] = z.Imaginary;
494
495 z = Prim[j];
496 RePrim[j] = z.Real;
497 ImPrim[j] = z.Imaginary;
498
499 if (j < c2)
500 {
501 z = Bis[j];
502 ReBis[j] = z.Real;
503 ImBis[j] = z.Imaginary;
504 }
505 }
506
507 z = Coefficients[j];
508 ReC[j] = z.Real;
509 ImC[j] = z.Imaginary;
510
511 int size = Width * Height;
512 double[] ColorIndex = new double[size];
513 double Conv = 1e-10;
514 double Div = 1e10;
515
516 rDelta *= 0.5;
517 r0 = rCenter - rDelta;
518 r1 = rCenter + rDelta;
519
520 aspect = ((double)Width) / Height;
521
522 i0 = iCenter - rDelta / aspect;
523 i1 = iCenter + rDelta / aspect;
524
525 dr = (r1 - r0) / Width;
526 di = (i1 - i0) / Height;
527
528 for (y = 0, i = i0, index = 0; y < Height; y++, i += di)
529 {
530 for (x = 0, r = r0; x < Width; x++, r += dr)
531 {
532 zr = r;
533 zi = i;
534
535 n = 0;
536 do
537 {
538 // f:
539 zr2 = zi2 = 0;
540 for (j = 0; j <= c; j++)
541 {
542 Temp = zr2 * zr - zi2 * zi + ReC[j];
543 zi2 = zr2 * zi + zi2 * zr + ImC[j];
544 zr2 = Temp;
545 }
546
547 // f':
548 zr3 = zi3 = 0;
549 for (j = 0; j < c; j++)
550 {
551 Temp = zr3 * zr - zi3 * zi + RePrim[j];
552 zi3 = zr3 * zi + zi3 * zr + ImPrim[j];
553 zr3 = Temp;
554 }
555
556 // f":
557 zr4 = zi4 = 0;
558 for (j = 0; j < c2; j++)
559 {
560 Temp = zr4 * zr - zi4 * zi + ReBis[j];
561 zi4 = zr4 * zi + zi4 * zr + ImBis[j];
562 zr4 = Temp;
563 }
564
565 // 2*f*f'
566
567 zr5 = 2 * (zr2 * zr3 - zi2 * zi3);
568 zi5 = 2 * (zr2 * zi3 + zi2 * zr3);
569
570 // 2f'^2-f*f"
571
572 zr6 = 2 * (zr3 * zr3 - zi3 * zi3) - (zr2 * zr4 - zi2 * zi4);
573 zi6 = 4 * zr3 * zi3 - (zr2 * zi4 + zr4 * zi2);
574
575 // R*2*f*f'/2f'^2-f*f"
576
577 Temp = 1.0 / (zr6 * zr6 + zi6 * zi6);
578 zr4 = (zr5 * zr6 + zi5 * zi6) * Temp;
579 zi4 = (zi5 * zr6 - zr5 * zi6) * Temp;
580
581 // R*2*f*f'/(2f'^2-f*f")
582 Temp = zr4 * RRe - zi4 * RIm;
583 zi4 = zr4 * RIm + zi4 * RRe;
584 zr4 = Temp;
585
586 zr -= zr4;
587 zi -= zi4;
588
589 Temp = Math.Sqrt(zr4 * zr4 + zi4 * zi4);
590 }
591 while ((Temp > Conv) && (Temp < Div) && (n++ < N));
592
593 if (Temp < Conv && n < N)
594 ColorIndex[index++] = n;
595 else
596 ColorIndex[index++] = N;
597 }
598 }
599
600 Variables.Preview(Node.Expression, new GraphBitmap(Variables, FractalGraph.ToPixels(ColorIndex, Width, Height, Palette)));
601
602 double[] Boundary = FractalGraph.FindBoundaries(ColorIndex, Width, Height);
603 FractalGraph.Smooth(ColorIndex, Boundary, Width, Height, N, Palette, Node, Variables);
604
605 return new FractalGraph(Variables, FractalGraph.ToPixels(ColorIndex, Width, Height, Palette),
606 r0, i0, r1, i1, rDelta * 2, true, Node, FractalZoomScript, State);
607 }
608
612 public static FractalGraph CalcHalley(double rCenter, double iCenter, double rDelta, Complex R,
613 ILambdaExpression f, Variables Variables, SKColor[] Palette, int Width, int Height,
614 ScriptNode Node, FractalZoomScript FractalZoomScript, object State)
615 {
616 double RRe = R.Real;
617 double RIm = R.Imaginary;
618 double r0, i0, r1, i1;
619 double dr, di;
620 double r, i;
621 double aspect;
622 int x, y;
623 int n, N;
624
625 N = Palette.Length;
626
627 Variables v = new Variables();
628 Variables.CopyTo(v);
629
630 string ParameterName;
631 if (!(f is IDifferentiable Differentiable) ||
632 !(Differentiable.Differentiate(ParameterName = Differentiable.DefaultVariableName, v) is ILambdaExpression fPrim))
633 {
634 throw new ScriptRuntimeException("Lambda expression not differentiable.", Node);
635 }
636
637 if (!(fPrim is IDifferentiable Differentiable2) ||
638 !(Differentiable2.Differentiate(ParameterName, v) is ILambdaExpression fBis))
639 {
640 throw new ScriptRuntimeException("Lambda expression not twice differentiable.", Node);
641 }
642
643 int size = Width * Height;
644 double[] ColorIndex = new double[size];
645 double Conv = 1e-10;
646 double Div = 1e10;
647
648 Complex[] Row;
649 Complex[] Row2;
650 Complex[] Row3;
651 Complex[] Row4;
652 int[] Offset;
653 IElement[] P = new IElement[1];
654 int j, c, x2;
655 IElement Obj, Obj2, Obj3;
656 double Mod;
657 Complex z, z2, z3;
658 Complex R2 = R * 2;
659
660 rDelta *= 0.5;
661 r0 = rCenter - rDelta;
662 r1 = rCenter + rDelta;
663
664 aspect = ((double)Width) / Height;
665
666 i0 = iCenter - rDelta / aspect;
667 i1 = iCenter + rDelta / aspect;
668
669 dr = (r1 - r0) / Width;
670 di = (i1 - i0) / Height;
671
672 for (y = 0, i = i0; y < Height; y++, i += di)
673 {
674 Row = new Complex[Width];
675 Offset = new int[Width];
676
677 c = Width;
678 for (x = 0, x2 = y * Width, r = r0; x < Width; x++, r += dr, x2++)
679 {
680 Row[x] = new Complex(r, i);
681 Offset[x] = x2;
682 }
683
684 n = 0;
685 while (n < N && c > 0)
686 {
687 n++;
688 P[0] = new ComplexVector(Row);
689 Obj = f.Evaluate(P, v);
690 Obj2 = fPrim.Evaluate(P, v);
691 Obj3 = fBis.Evaluate(P, v);
692 Row2 = Obj.AssociatedObjectValue as Complex[];
693 Row3 = Obj2.AssociatedObjectValue as Complex[];
694 Row4 = Obj3.AssociatedObjectValue as Complex[];
695
696 if (Row2 is null || Row3 is null || Row4 is null)
697 {
698 throw new ScriptRuntimeException("Lambda expression (and its first and second derivative) must be able to accept complex vectors, " +
699 "and return complex vectors of equal length. Type returned: " +
700 Obj.GetType().FullName + ", " + Obj2.GetType().FullName + " and " + Obj3.GetType().FullName,
701 Node);
702 }
703 else if (Row2.Length != c || Row3.Length != c)
704 {
705 throw new ScriptRuntimeException("Lambda expression (and its first and second derivative) must be able to accept complex vectors, " +
706 "and return complex vectors of equal length. Length returned: " +
707 Row2.Length.ToString() + ", " + Row3.Length.ToString() + " and " + Row4.Length.ToString() +
708 ". Expected: " + c.ToString(), Node);
709 }
710
711 for (x = x2 = 0; x < c; x++)
712 {
713 j = Offset[x];
714 z = Row2[x];
715 z2 = Row3[x];
716 z3 = Row4[x];
717
718 z = R2 * z * z2 / (2 * z2 * z2 - z * z3);
719 Row[x] -= z;
720
721 Mod = z.Magnitude;
722
723 if (Mod > Conv && Mod < Div)
724 {
725 if (x != x2)
726 Offset[x2] = j;
727
728 x2++;
729 }
730 else
731 {
732 if (n >= N)
733 ColorIndex[j++] = N;
734 else
735 ColorIndex[j++] = n;
736 }
737 }
738
739 if (x2 < x)
740 {
741 Array.Resize(ref Row, x2);
742 Array.Resize(ref Offset, x2);
743 c = x2;
744 }
745 }
746 }
747
748 Variables.Preview(Node.Expression, new GraphBitmap(Variables, FractalGraph.ToPixels(ColorIndex, Width, Height, Palette)));
749
750 double[] Boundary = FractalGraph.FindBoundaries(ColorIndex, Width, Height);
751 FractalGraph.Smooth(ColorIndex, Boundary, Width, Height, N, Palette, Node, Variables);
752
753 return new FractalGraph(Variables, FractalGraph.ToPixels(ColorIndex, Width, Height, Palette),
754 r0, i0, r1, i1, rDelta * 2, true, Node, FractalZoomScript, State);
755 }
756
760 public override string FunctionName => nameof(HalleySmoothFractal);
761 }
762}
Class managing a script expression.
Definition: Expression.cs:39
static Complex ToComplex(object Object)
Converts an object to a complex value.
Definition: Expression.cs:4942
static double ToDouble(object Object)
Converts an object to a double value.
Definition: Expression.cs:4824
static string ToString(double Value)
Converts a value to a string, that can be parsed as part of an expression.
Definition: Expression.cs:4496
HalleySmoothFractal(ScriptNode z, ScriptNode dr, ScriptNode R, ScriptNode Coefficients, ScriptNode Palette, int Start, int Length, Expression Expression)
TODO
HalleySmoothFractal(ScriptNode z, ScriptNode dr, ScriptNode R, ScriptNode Coefficients, int Start, int Length, Expression Expression)
TODO
static FractalGraph CalcHalley(double rCenter, double iCenter, double rDelta, Complex R, ILambdaExpression f, Variables Variables, SKColor[] Palette, int Width, int Height, ScriptNode Node, FractalZoomScript FractalZoomScript, object State)
TODO
HalleySmoothFractal(ScriptNode z, ScriptNode dr, int Start, int Length, Expression Expression)
TODO
HalleySmoothFractal(ScriptNode z, ScriptNode dr, ScriptNode R, int Start, int Length, Expression Expression)
TODO
HalleySmoothFractal(ScriptNode z, ScriptNode dr, ScriptNode R, ScriptNode Coefficients, ScriptNode Palette, ScriptNode DimX, int Start, int Length, Expression Expression)
TODO
static FractalGraph CalcHalley(double rCenter, double iCenter, double rDelta, Complex R, double[] Coefficients, SKColor[] Palette, int Width, int Height, ScriptNode Node, Variables Variables, FractalZoomScript FractalZoomScript, object State)
TODO
static FractalGraph CalcHalley(double rCenter, double iCenter, double rDelta, Complex R, Complex[] Coefficients, SKColor[] Palette, int Width, int Height, ScriptNode Node, Variables Variables, FractalZoomScript FractalZoomScript, object State)
TODO
HalleySmoothFractal(ScriptNode z, ScriptNode dr, ScriptNode R, ScriptNode Coefficients, ScriptNode Palette, ScriptNode DimX, ScriptNode DimY, int Start, int Length, Expression Expression)
TODO
override IElement Evaluate(IElement[] Arguments, Variables Variables)
TODO
Defines a clickable fractal graph in the complex plane.
Definition: FractalGraph.cs:22
static PixelInformation ToPixels(double[] ColorIndex, int Width, int Height, SKColor[] Palette)
TODO
static SKColor[] ToPalette(ObjectVector Vector)
TODO
static double[] FindBoundaries(double[] ColorIndex, int Width, int Height)
TODO
static void Smooth(double[] ColorIndex, double[] Boundary, int Width, int Height, int N, SKColor[] Palette, ScriptNode Node, Variables Variables)
TODO
Handles bitmap-based graphs.
Definition: GraphBitmap.cs:13
Base class for multivariate funcions.
ScriptNode[] Arguments
Function arguments.
Base class for all nodes in a parsed script tree.
Definition: ScriptNode.cs:69
int Length
Length of expression covered by node.
Definition: ScriptNode.cs:101
override string ToString()
Definition: ScriptNode.cs:359
Expression Expression
Expression of which the node is a part.
Definition: ScriptNode.cs:177
int Start
Start position in script expression.
Definition: ScriptNode.cs:92
Collection of variables.
Definition: Variables.cs:25
void Preview(Expression Expression, IElement Result)
Reports a preview of the final result.
Definition: Variables.cs:455
void CopyTo(Variables Variables)
Copies available variables to another variable collection.
Definition: Variables.cs:400
Basic interface for all types of elements.
Definition: IElement.cs:20
object AssociatedObjectValue
Associated object value.
Definition: IElement.cs:33
Basic interface for vectors.
Definition: IVector.cs:9
int Dimension
Dimension of vector.
Definition: IVector.cs:14
IElement GetElement(int Index)
Gets an element of the vector.
Base interface for lambda expressions.
Base interface for lambda expressions.
IElement Evaluate(IElement[] Arguments, Variables Variables)
Evaluates the lambda expression.
delegate string FractalZoomScript(double r, double i, double Size, object State)
Generates new script when zoomed.
ArgumentType
Type of parameter used in a function definition or a lambda definition.
Definition: IFunction.cs:9