Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
FlameFractalHsl.cs
1using SkiaSharp;
2using System;
3using System.Text;
4using System.Threading;
5using System.Threading.Tasks;
13
15{
23 {
28 ScriptNode Preview, ScriptNode Parallel, ScriptNode DimX, ScriptNode DimY, ScriptNode SuperSampling,
29 ScriptNode Gamma, ScriptNode LightFactor, ScriptNode Seed, int Start, int Length, Expression Expression)
30 : base(new ScriptNode[] { xc, yc, dr, N, FlameFunctions, Preview, Parallel, DimX, DimY, SuperSampling,
31 Gamma, LightFactor, Seed },
32 new ArgumentType[] { ArgumentType.Scalar, ArgumentType.Scalar, ArgumentType.Scalar,
33 ArgumentType.Scalar, ArgumentType.Vector, ArgumentType.Scalar, ArgumentType.Scalar,
34 ArgumentType.Scalar, ArgumentType.Scalar, ArgumentType.Scalar, ArgumentType.Scalar,
35 ArgumentType.Scalar, ArgumentType.Scalar }, Start, Length, Expression)
36 {
37 }
38
43 ScriptNode Preview, ScriptNode Parallel, ScriptNode DimX, ScriptNode DimY, ScriptNode SuperSampling,
44 ScriptNode Gamma, ScriptNode LightFactor, int Start, int Length, Expression Expression)
45 : base(new ScriptNode[] { xc, yc, dr, N, FlameFunctions, Preview, Parallel, DimX, DimY, SuperSampling,
46 Gamma, LightFactor },
47 new ArgumentType[] { ArgumentType.Scalar, ArgumentType.Scalar, ArgumentType.Scalar,
48 ArgumentType.Scalar, ArgumentType.Vector, ArgumentType.Scalar, ArgumentType.Scalar,
49 ArgumentType.Scalar, ArgumentType.Scalar, ArgumentType.Scalar, ArgumentType.Scalar,
50 ArgumentType.Scalar }, Start, Length, Expression)
51 {
52 }
53
58 ScriptNode Preview, ScriptNode Parallel, ScriptNode DimX, ScriptNode DimY, ScriptNode SuperSampling,
60 : base(new ScriptNode[] { xc, yc, dr, N, FlameFunctions, Preview, Parallel, DimX, DimY, SuperSampling,
61 Gamma },
62 new ArgumentType[] { ArgumentType.Scalar, ArgumentType.Scalar, ArgumentType.Scalar,
63 ArgumentType.Scalar, ArgumentType.Vector, ArgumentType.Scalar, ArgumentType.Scalar,
64 ArgumentType.Scalar, ArgumentType.Scalar, ArgumentType.Scalar, ArgumentType.Scalar },
66 {
67 }
68
73 ScriptNode Preview, ScriptNode Parallel, ScriptNode DimX, ScriptNode DimY, ScriptNode SuperSampling,
75 : base(new ScriptNode[] { xc, yc, dr, N, FlameFunctions, Preview, Parallel, DimX, DimY, SuperSampling },
76 new ArgumentType[] { ArgumentType.Scalar, ArgumentType.Scalar, ArgumentType.Scalar,
77 ArgumentType.Scalar, ArgumentType.Vector, ArgumentType.Scalar, ArgumentType.Scalar,
78 ArgumentType.Scalar, ArgumentType.Scalar, ArgumentType.Scalar },
80 {
81 }
82
87 ScriptNode Preview, ScriptNode Parallel, ScriptNode DimX, ScriptNode DimY, int Start, int Length,
89 : base(new ScriptNode[] { xc, yc, dr, N, FlameFunctions, Preview, Parallel, DimX, DimY },
90 new ArgumentType[] { ArgumentType.Scalar, ArgumentType.Scalar, ArgumentType.Scalar,
91 ArgumentType.Scalar, ArgumentType.Vector, ArgumentType.Scalar, ArgumentType.Scalar,
92 ArgumentType.Scalar, ArgumentType.Scalar },
94 {
95 }
96
101 ScriptNode Preview, ScriptNode Parallel, ScriptNode DimX, int Start, int Length, Expression Expression)
102 : base(new ScriptNode[] { xc, yc, dr, N, FlameFunctions, Preview, Parallel, DimX },
103 new ArgumentType[] { ArgumentType.Scalar, ArgumentType.Scalar, ArgumentType.Scalar,
104 ArgumentType.Scalar, ArgumentType.Vector, ArgumentType.Scalar, ArgumentType.Scalar,
105 ArgumentType.Scalar },
107 {
108 }
109
114 ScriptNode Preview, ScriptNode Parallel, int Start, int Length, Expression Expression)
115 : base(new ScriptNode[] { xc, yc, dr, N, FlameFunctions, Preview, Parallel },
116 new ArgumentType[] { ArgumentType.Scalar, ArgumentType.Scalar, ArgumentType.Scalar,
117 ArgumentType.Scalar, ArgumentType.Vector, ArgumentType.Scalar, ArgumentType.Scalar },
119 {
120 }
121
126 ScriptNode Preview, int Start, int Length, Expression Expression)
127 : base(new ScriptNode[] { xc, yc, dr, N, FlameFunctions, Preview },
128 new ArgumentType[] { ArgumentType.Scalar, ArgumentType.Scalar, ArgumentType.Scalar,
129 ArgumentType.Scalar, ArgumentType.Vector, ArgumentType.Scalar },
131 {
132 }
133
139 : base(new ScriptNode[] { xc, yc, dr, N, FlameFunctions },
140 new ArgumentType[] { ArgumentType.Scalar, ArgumentType.Scalar, ArgumentType.Scalar,
141 ArgumentType.Scalar, ArgumentType.Vector },
143 {
144 }
145
149 public override string[] DefaultArgumentNames
150 {
151 get
152 {
153 return new string[]
154 {
155 "xc", "yc", "dr", "N", "FlameFunctions", "Preview", "Parallel",
156 "DimX", "DimY", "SuperSampling", "Gamma", "LightFactor", "Seed"
157 };
158 }
159 }
160
164 public override string FunctionName => nameof(FlameFractalHsl);
165
170 public override bool IsAsynchronous => true;
171
176 {
177 return this.EvaluateAsync(Arguments, Variables).Result;
178 }
179
183 public override async Task<IElement> EvaluateAsync(IElement[] Arguments, Variables Variables)
184 {
185 double xc, yc;
186 double dr;
187 long N;
188 int dimx, dimy;
189 int i, c;
190 int Seed;
191
192 i = 0;
193 c = Arguments.Length;
194 xc = Expression.ToDouble(Arguments[i++].AssociatedObjectValue);
195 yc = Expression.ToDouble(Arguments[i++].AssociatedObjectValue);
196 dr = Expression.ToDouble(Arguments[i++].AssociatedObjectValue);
197 N = (long)Expression.ToDouble(Arguments[i++].AssociatedObjectValue);
198 if (N <= 0)
199 throw new ScriptRuntimeException("N in calls to FlameFractalHsl() must be a positive integer.", this);
200
201 object Obj = Arguments[i].AssociatedObjectValue;
202 string FunctionsExpression = this.Arguments[i++].SubExpression;
203
204 if (!(Obj is Array FlameArray))
205 throw new ScriptRuntimeException("The fifth parameter to FlameFractalHsl must be an array, containing flame definitions.", this);
206
208 double Weight;
209 double Gamma;
210 double LightFactor;
211 int SuperSampling;
212 FlameFunction CurrentFunction = null;
213
214 foreach (object FlameItem in FlameArray)
215 {
216 if (FlameItem is DoubleMatrix M)
217 {
218 CurrentFunction = new FlameFunction(M, this);
219 FlameFunctions.Add(CurrentFunction);
220 }
221 else if (FlameItem is SKColor || FlameItem is string)
222 {
223 if (CurrentFunction is null)
224 {
225 M = new DoubleMatrix(new double[,] { { 1, 0 }, { 0, 1 } });
226 CurrentFunction = new FlameFunction(M, this);
227 FlameFunctions.Add(CurrentFunction);
228 }
229
230 SKColor cl = Graph.ToColor(FlameItem);
231 cl.ToHsl(out float H, out float S, out float L);
232
233 CurrentFunction.SetColorHsl(H, S, L);
234 CurrentFunction = null;
235 }
236 else if (FlameItem is IFlameVariation FlameVariation)
237 {
238 if (CurrentFunction is null)
239 {
240 M = new DoubleMatrix(new double[,] { { 1, 0 }, { 0, 1 } });
241 CurrentFunction = new FlameFunction(M, this);
242 FlameFunctions.Add(CurrentFunction);
243 }
244
245 CurrentFunction.Add(FlameVariation);
246 }
247 else if (FlameItem is ILambdaExpression LambdaExpression)
248 {
249 if (CurrentFunction is null)
250 {
251 M = new DoubleMatrix(new double[,] { { 1, 0 }, { 0, 1 } });
252 CurrentFunction = new FlameFunction(M, this);
253 FlameFunctions.Add(CurrentFunction);
254 }
255
256 CurrentFunction.Add(LambdaExpression);
257 }
258 else
259 {
260 try
261 {
262 Weight = Expression.ToDouble(FlameItem);
263
264 if (CurrentFunction is null)
265 {
266 M = new DoubleMatrix(new double[,] { { 1, 0 }, { 0, 1 } });
267 CurrentFunction = new FlameFunction(M, this);
268 FlameFunctions.Add(CurrentFunction);
269 }
270
271 CurrentFunction.SetWeight(Weight);
272 }
273 catch (Exception)
274 {
275 throw new ScriptRuntimeException("Invalid flame variation definition.", this);
276 }
277 }
278 }
279
280 if (i < c && Arguments[i].AssociatedObjectValue is bool Preview)
281 i++;
282 else
283 Preview = false;
284
285 if (i < c && Arguments[i].AssociatedObjectValue is bool Parallel)
286 i++;
287 else
288 Parallel = false;
289
290 if (i < c)
291 dimx = (int)Expression.ToDouble(Arguments[i++].AssociatedObjectValue);
292 else
293 dimx = 320;
294
295 if (i < c)
296 dimy = (int)Expression.ToDouble(Arguments[i++].AssociatedObjectValue);
297 else
298 dimy = 200;
299
300 if (i < c)
301 SuperSampling = (int)Expression.ToDouble(Arguments[i++].AssociatedObjectValue);
302 else
303 SuperSampling = 2;
304
305 if (i < c)
306 Gamma = Expression.ToDouble(Arguments[i++].AssociatedObjectValue);
307 else
308 Gamma = 2.2;
309
310 if (i < c)
311 LightFactor = Expression.ToDouble(Arguments[i++].AssociatedObjectValue);
312 else
313 LightFactor = 1.0;
314
315 if (i < c)
316 Seed = (int)Expression.ToDouble(Arguments[i++].AssociatedObjectValue);
317 else
318 {
319 lock (gen)
320 {
321 Seed = gen.Next();
322 }
323
324 Variables.ConsoleOut?.WriteLine("Seed = " + Seed.ToString(), Variables);
325 }
326
327 if (i < c)
328 {
329 throw new ScriptRuntimeException("Parameter mismatch in call to FlameFractalHsl(xc,yc,dr,N,FlameFunctions[,Preview[,Parallel[,dimx[,dimy[,SuperSampling[,Gamma[,LightFactor[,Seed]]]]]]]]).",
330 this);
331 }
332
333 if (dimx <= 0 || dimx > 5000 || dimy <= 0 || dimy > 5000)
334 throw new FractalImageSizeScriptException(this);
335
336 FlameFunction[] Functions = FlameFunctions.ToArray();
337
338 if (dr <= 0)
339 {
340 FlameFractalRgba.EstimateSize(out xc, out yc, out dr, Functions, dimx, dimy, Seed, 5000, Variables, this);
341
342 Variables.ConsoleOut?.WriteLine("X-center: " + Expression.ToString(xc), Variables);
343 Variables.ConsoleOut?.WriteLine("Y-center: " + Expression.ToString(yc), Variables);
344 Variables.ConsoleOut?.WriteLine("Width: " + Expression.ToString(dr), Variables);
345 }
346
347 return await CalcFlame(xc, yc, dr, N, Functions, dimx, dimy, Seed, SuperSampling, Gamma, LightFactor, Preview, Parallel, Variables, this,
348 this.FractalZoomScript, new object[] { dimx, dimy, N, FunctionsExpression, Seed, SuperSampling, Gamma, LightFactor, Preview, Parallel });
349 }
350
351 private readonly static Random gen = new Random();
352
353 private string FractalZoomScript(double r, double i, double Size, object State)
354 {
355 object[] Parameters = (object[])State;
356 int DimX = (int)Parameters[0];
357 int DimY = (int)Parameters[1];
358 long N = (long)Parameters[2];
359 string FunctionsExpression = (string)Parameters[3];
360 int Seed = (int)Parameters[4];
361 int SuperSampling = (int)Parameters[5];
362 double Gamma = (double)Parameters[6];
363 double LightFactor = (double)Parameters[7];
364 bool Preview = (bool)Parameters[8];
365 bool Parallel = (bool)Parameters[9];
366
367 StringBuilder sb = new StringBuilder();
368
369 sb.Append("FlameFractalHsl(");
370 sb.Append(Expression.ToString(r));
371 sb.Append(',');
372 sb.Append(Expression.ToString(i));
373 sb.Append(',');
374 sb.Append(Expression.ToString(Size / 4));
375 sb.Append(',');
376 sb.Append(N.ToString());
377 sb.Append(',');
378 sb.Append(FunctionsExpression);
379 sb.Append(',');
380 sb.Append(Expression.ToString(Preview));
381 sb.Append(',');
382 sb.Append(Expression.ToString(Parallel));
383 sb.Append(',');
384 sb.Append(DimX.ToString());
385 sb.Append(',');
386 sb.Append(DimY.ToString());
387 sb.Append(',');
388 sb.Append(SuperSampling.ToString());
389 sb.Append(',');
390 sb.Append(Expression.ToString(Gamma));
391 sb.Append(',');
392 sb.Append(Expression.ToString(LightFactor));
393 sb.Append(',');
394 sb.Append(Seed.ToString());
395 sb.Append(')');
396
397 return sb.ToString();
398 }
399
403 public static async Task<FractalGraph> CalcFlame(double xCenter, double yCenter, double rDelta, long N,
404 FlameFunction[] Functions, int Width, int Height, int Seed, int SuperSampling, double Gamma,
405 double LightFactor, bool Preview, bool Parallel, Variables Variables, ScriptNode Node,
406 FractalZoomScript FractalZoomScript, object State)
407 {
408 double TotWeight = 0;
409 double Weight;
410 int i, c = Functions.Length;
411 Random Gen = new Random(Seed);
412
413 if (c < 1)
414 throw new ScriptRuntimeException("At least one flame function needs to be provided.", Node);
415
416 if (SuperSampling < 1)
417 throw new ScriptRuntimeException("SuperSampling must be a postitive integer.", Node);
418
420 Preview = false;
421
422 Array.Sort(Functions, (f1, f2) =>
423 {
424 double d = f2.Weight - f1.Weight;
425 if (d < 0)
426 return -1;
427 else if (d > 0)
428 return 1;
429 else
430 return 0;
431 });
432
433 double[] SumWeights = new double[c];
435
436 for (i = 0; i < c; i++)
437 {
438 f = Functions[i];
439 Weight = f.Weight;
440 if (Weight < 0)
441 throw new ScriptRuntimeException("Weights must be non-negative.", Node);
442
443 f.DefinitionDone();
444 TotWeight += Weight;
445 SumWeights[i] = TotWeight;
446 }
447
448 if (TotWeight == 0)
449 throw new ScriptRuntimeException("The total weight of all functions must be postitive.", Node);
450
451 for (i = 0; i < c; i++)
452 SumWeights[i] /= TotWeight;
453
454 double AspectRatio = ((double)Width) / Height;
455 double xMin, xMax, yMin, yMax;
456
457 xMin = xCenter - rDelta / 2;
458 xMax = xMin + rDelta;
459 yMin = yCenter - rDelta / (2 * AspectRatio);
460 yMax = yMin + rDelta / AspectRatio;
461
462 int NrGames = Parallel ? Environment.ProcessorCount : 1;
463
464 if (NrGames <= 1)
465 {
466 FlameState P = new FlameState(Gen, xMin, xMax, yMin, yMax, Width, Height, SuperSampling, N, ColorMode.Hsl, Node);
467 Variables v = new Variables();
468 Variables.CopyTo(v);
469
470 await RunChaosGame(v, Functions, SumWeights, P, Preview, Gamma, LightFactor, Node);
471
472 return new FractalGraph(Variables, P.RenderBitmapHsl(Gamma, LightFactor, false, SKColors.Black), xMin, yMin, xMax, yMax, rDelta,
473 false, Node, FractalZoomScript, State);
474 }
475 else
476 {
477 FlameState[] P = new FlameState[NrGames];
478 WaitHandle[] Done = new WaitHandle[NrGames];
479 Thread[] T = new Thread[NrGames];
480
481 try
482 {
483 for (i = 0; i < NrGames; i++)
484 {
485 Done[i] = new ManualResetEvent(false);
486 P[i] = new FlameState(Gen, xMin, xMax, yMin, yMax, Width, Height, SuperSampling,
487 i < NrGames - 1 ? N / NrGames : N - (N / NrGames) * (NrGames - 1),
488 ColorMode.Hsl, Node);
489
490 Variables v = new Variables();
491 Variables.CopyTo(v);
492
493 T[i] = new Thread(new ParameterizedThreadStart(ChaosGameThread))
494 {
495 Name = "FlameFractal thread #" + (i + 1).ToString(),
496 Priority = ThreadPriority.BelowNormal
497 };
498
499 T[i].Start(new object[] { Done[i], i, v, Functions, SumWeights, P[i],
500 Node, i == 0 && Preview, Gamma, LightFactor });
501 }
502
503 WaitHandle.WaitAll(Done);
504
505 for (i = 1; i < NrGames; i++)
506 P[0].Add(P[i]);
507
508 return new FractalGraph(Variables, P[0].RenderBitmapHsl(Gamma, LightFactor, false, SKColors.Black), xMin, yMin, xMax, yMax, rDelta,
509 false, Node, FractalZoomScript, State);
510 }
511 catch (ThreadAbortException)
512 {
513 for (i = 0; i < NrGames; i++)
514 {
515 try
516 {
517 if (T[i] is null)
518 continue;
519
520 if (Done[i] is null || !Done[i].WaitOne(0))
521 T[i].Abort();
522 }
523 catch (Exception)
524 {
525 // Ignore
526 }
527 }
528
529 return null;
530 }
531 finally
532 {
533 for (i = 0; i < NrGames; i++)
534 {
535 try
536 {
537 Done[i]?.Close();
538 }
539 catch (Exception)
540 {
541 // Ignore
542 }
543 }
544 }
545 }
546 }
547
548 private static void ChaosGameThread(object P)
549 {
550 object[] Parameters = (object[])P;
551 ManualResetEvent Done = (ManualResetEvent)Parameters[0];
552 //int GameNr = (int)Parameters[1];
553 Variables v = (Variables)Parameters[2];
554 FlameFunction[] Functions = (FlameFunction[])Parameters[3];
555 double[] SumWeights = (double[])Parameters[4];
556 FlameState P2 = (FlameState)Parameters[5];
557 ScriptNode Node = (ScriptNode)Parameters[6];
558 bool Preview = (bool)Parameters[7];
559 double Gamma = (double)Parameters[8];
560 double LightFactor = (double)Parameters[9];
561
562 try
563 {
564 RunChaosGame(v, Functions, SumWeights, P2, Preview, Gamma, LightFactor, Node).Wait();
565 }
566 catch (ThreadAbortException)
567 {
568 Thread.ResetAbort();
569 }
570 catch (Exception)
571 {
572 // Ignore.
573 }
574 finally
575 {
576 Done.Set();
577 }
578 }
579
580 private static async Task RunChaosGame(Variables v, FlameFunction[] Functions,
581 double[] SumWeights, FlameState P, bool Preview, double Gamma, double LightFactor,
582 ScriptNode Node)
583 {
584 Random Gen = new Random();
585 FlameFunction f;
586 double Weight;
587 int i, j;
588 int c = Functions.Length;
589
590 for (i = 0; i < 20; i++)
591 {
592 Weight = Gen.NextDouble();
593 j = 0;
594 while (j < c - 1 && SumWeights[j] <= Weight)
595 j++;
596
597 f = Functions[j];
598 if (!f.Operate(P, v))
599 {
600 P.N = 0;
601 break;
602 }
603 }
604
605 if (Preview || v.HandlesStatus)
606 {
607 DateTime Start = DateTime.Now;
608 DateTime NextPreview = Start.AddSeconds(1);
609 DateTime PrevPreview = Start;
610 DateTime Temp;
611 DateTime Temp2;
612 TimeSpan TimeLeft;
613 int NextPreviewDeciSeconds = 10;
614 int NrIterationsPerPreview = 4096;
615 int Pos = NrIterationsPerPreview;
616 long NrIterations;
617 long PrevNrIterations = 0;
618 long NrIterationsSinceLast;
619 double PercentDone;
620 double IterationsPerSeconds;
621
622 do
623 {
624 if (Pos-- <= 0)
625 {
626 Pos = NrIterationsPerPreview;
627 Temp = DateTime.Now;
628 if (Temp > NextPreview)
629 {
630 NextPreview = Temp.AddSeconds(NextPreviewDeciSeconds * 0.1);
631 if (NextPreviewDeciSeconds < 50)
632 NextPreviewDeciSeconds++;
633
634 if (Preview)
635 {
636 await v.Preview(Node.Expression, new GraphBitmap(v, P.RenderBitmapHsl(Gamma, LightFactor, true, SKColors.Black)));
637
638 Temp2 = DateTime.Now;
639
640 double d = (Temp2 - Temp).TotalSeconds;
641 double d2 = (Temp - PrevPreview).TotalSeconds;
642
643 if (d / d2 > 0.1)
644 {
645 NrIterationsPerPreview <<= 1;
646 if (NrIterationsPerPreview < 0)
647 NrIterationsPerPreview = int.MaxValue;
648 }
649 }
650
651 NrIterations = P.N0 - P.N;
652 NrIterationsSinceLast = NrIterations - PrevNrIterations;
653 IterationsPerSeconds = NrIterationsSinceLast / (Temp - PrevPreview).TotalSeconds;
654 PercentDone = (100 * (1.0 - ((double)P.N) / P.N0));
655 TimeLeft = new TimeSpan((long)((Temp - Start).Ticks * 100 / PercentDone));
656 await v.Status(Node.Expression, P.N.ToString() + " iterations left, " + NrIterations.ToString() + " iterations done, " + IterationsPerSeconds.ToString("F0") + " iterations/s, " + PercentDone.ToString("F1") + "% done, Time Left: " + TimeLeft.ToString() + ".");
657 PrevNrIterations = NrIterations;
658 PrevPreview = Temp;
659 }
660 }
661
662 Weight = Gen.NextDouble();
663 j = 0;
664 while (j < c - 1 && SumWeights[j] <= Weight)
665 j++;
666
667 f = Functions[j];
668 if (!f.Operate(P, v))
669 break;
670 }
671 while (P.IncHistogram());
672
673 await v.Status(Node.Expression, string.Empty);
674 }
675 else
676 {
677 do
678 {
679 Weight = Gen.NextDouble();
680 j = 0;
681 while (j < c - 1 && SumWeights[j] <= Weight)
682 j++;
683
684 f = Functions[j];
685 if (!f.Operate(P, v))
686 break;
687 }
688 while (P.IncHistogram());
689 }
690 }
691
692 }
693}
A chunked list is a linked list of chunks of objects of type T .
Definition: ChunkedList.cs:54
Class managing a script expression.
Definition: Expression.cs:41
static double ToDouble(object Object)
Converts an object to a double value.
Definition: Expression.cs:5110
static string ToString(double Value)
Converts a value to a string, that can be parsed as part of an expression.
Definition: Expression.cs:4760
Exception thrown if an image with invalid size is requested.
Defines a clickable fractal graph in the complex plane.
Definition: FractalGraph.cs:23
Calculates a flame fractal in HSL space. Intensity is mapped along the L-axis. Gamma correction is do...
static async Task< FractalGraph > CalcFlame(double xCenter, double yCenter, double rDelta, long N, FlameFunction[] Functions, int Width, int Height, int Seed, int SuperSampling, double Gamma, double LightFactor, bool Preview, bool Parallel, Variables Variables, ScriptNode Node, FractalZoomScript FractalZoomScript, object State)
TODO
FlameFractalHsl(ScriptNode xc, ScriptNode yc, ScriptNode dr, ScriptNode N, ScriptNode FlameFunctions, ScriptNode Preview, ScriptNode Parallel, ScriptNode DimX, ScriptNode DimY, int Start, int Length, Expression Expression)
TODO
FlameFractalHsl(ScriptNode xc, ScriptNode yc, ScriptNode dr, ScriptNode N, ScriptNode FlameFunctions, ScriptNode Preview, ScriptNode Parallel, ScriptNode DimX, ScriptNode DimY, ScriptNode SuperSampling, ScriptNode Gamma, ScriptNode LightFactor, ScriptNode Seed, int Start, int Length, Expression Expression)
TODO
FlameFractalHsl(ScriptNode xc, ScriptNode yc, ScriptNode dr, ScriptNode N, ScriptNode FlameFunctions, ScriptNode Preview, ScriptNode Parallel, ScriptNode DimX, ScriptNode DimY, ScriptNode SuperSampling, int Start, int Length, Expression Expression)
TODO
FlameFractalHsl(ScriptNode xc, ScriptNode yc, ScriptNode dr, ScriptNode N, ScriptNode FlameFunctions, ScriptNode Preview, int Start, int Length, Expression Expression)
TODO
FlameFractalHsl(ScriptNode xc, ScriptNode yc, ScriptNode dr, ScriptNode N, ScriptNode FlameFunctions, ScriptNode Preview, ScriptNode Parallel, ScriptNode DimX, int Start, int Length, Expression Expression)
TODO
FlameFractalHsl(ScriptNode xc, ScriptNode yc, ScriptNode dr, ScriptNode N, ScriptNode FlameFunctions, ScriptNode Preview, ScriptNode Parallel, ScriptNode DimX, ScriptNode DimY, ScriptNode SuperSampling, ScriptNode Gamma, int Start, int Length, Expression Expression)
TODO
FlameFractalHsl(ScriptNode xc, ScriptNode yc, ScriptNode dr, ScriptNode N, ScriptNode FlameFunctions, ScriptNode Preview, ScriptNode Parallel, ScriptNode DimX, ScriptNode DimY, ScriptNode SuperSampling, ScriptNode Gamma, ScriptNode LightFactor, int Start, int Length, Expression Expression)
TODO
override IElement Evaluate(IElement[] Arguments, Variables Variables)
TODO
FlameFractalHsl(ScriptNode xc, ScriptNode yc, ScriptNode dr, ScriptNode N, ScriptNode FlameFunctions, int Start, int Length, Expression Expression)
TODO
FlameFractalHsl(ScriptNode xc, ScriptNode yc, ScriptNode dr, ScriptNode N, ScriptNode FlameFunctions, ScriptNode Preview, ScriptNode Parallel, int Start, int Length, Expression Expression)
TODO
override bool IsAsynchronous
If the node (or its decendants) include asynchronous evaluation. Asynchronous nodes should be evaluat...
override async Task< IElement > EvaluateAsync(IElement[] Arguments, Variables Variables)
TODO
Calculates a flame fractal in RGBA space. Intensity is calculated along the A-axis....
static void EstimateSize(out double xCenter, out double yCenter, out double rDelta, FlameFunction[] Functions, int Width, int Height, int Seed, long N, Variables Variables, ScriptNode Node)
TODO
Handles bitmap-based graphs.
Definition: GraphBitmap.cs:13
Base class for graphs.
Definition: Graph.cs:88
static SKColor ToColor(object Object)
Converts an object to a color.
Definition: Graph.cs:844
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
TextWriter ConsoleOut
Console out interface. Can be used by functions and script to output data to the console.
Definition: Variables.cs:223
async Task Status(Expression Expression, string Result)
Reports current status of execution.
Definition: Variables.cs:424
bool HandlesPreview
If previews are desired.
Definition: Variables.cs:389
bool HandlesStatus
If status messages are desired.
Definition: Variables.cs:434
void CopyTo(Variables Variables)
Copies available variables to another variable collection.
Definition: Variables.cs:334
async Task Preview(Expression Expression, IElement Result)
Reports a preview of the final result.
Definition: Variables.cs:407
Basic interface for all types of elements.
Definition: IElement.cs:21
Base interface for lambda expressions.
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