Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
RadialBlurVariation.cs
1using System;
4
6{
11 {
12 private readonly double angle;
13
18 : base(Parameter, Start, Length, Expression)
19 {
20 }
21
22 private RadialBlurVariation(double Angle, ScriptNode Parameter, int Start, int Length, Expression Expression)
23 : base(Parameter, Start, Length, Expression)
24 {
25 this.angle = Angle;
26 }
27
32 {
33 return new RadialBlurVariation(Expression.ToDouble(Argument.AssociatedObjectValue), this.Argument, this.Start, this.Length, this.Expression);
34 }
35
39 public override void Operate(ref double x, ref double y)
40 {
41 double p1 = this.angle * Math.PI / 2;
42 double r1, r2, r3, r4;
43
44 lock (this.gen)
45 {
46 r1 = this.gen.NextDouble();
47 r2 = this.gen.NextDouble();
48 r3 = this.gen.NextDouble();
49 r4 = this.gen.NextDouble();
50 }
51
52 double t1 = (r1 + r2 + r3 + r4 - 2) / this.variationWeight;
53 double t2 = Math.Atan2(y, x) + t1 * Math.Sin(p1);
54 double t3 = t1 * Math.Cos(p1) - 1;
55 double r = Math.Sqrt(x * x + y * y);
56 x = (Math.Cos(t2) * r + t3 * x) / this.variationWeight;
57 y = (Math.Sin(t2) * r + t3 * y) / this.variationWeight;
58 }
59
60 private readonly Random gen = new Random();
61
65 public override string FunctionName => nameof(RadialBlurVariation);
66 }
67}
Class managing a script expression.
Definition: Expression.cs:39
static double ToDouble(object Object)
Converts an object to a double value.
Definition: Expression.cs:4824
override IElement Evaluate(IElement Argument, Variables Variables)
TODO
override void Operate(ref double x, ref double y)
TODO
RadialBlurVariation(ScriptNode Parameter, int Start, int Length, Expression Expression)
TODO
ScriptNode Argument
Function argument.
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
int Start
Start position in script expression.
Definition: ScriptNode.cs:92
Collection of variables.
Definition: Variables.cs:25
Basic interface for all types of elements.
Definition: IElement.cs:20