Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
BlobVariation.cs
1using System;
4
6{
11 {
12 private readonly double high;
13 private readonly double low;
14 private readonly double waves;
15
20 : base(new ScriptNode[] { high, low, waves }, new ArgumentType[] { ArgumentType.Scalar,
21 ArgumentType.Scalar, ArgumentType.Scalar }, Start, Length, Expression)
22 {
23 this.high = 0;
24 this.low = 0;
25 this.waves = 0;
26 }
27
28 private BlobVariation(double High, double Low, double Waves, ScriptNode high, ScriptNode low, ScriptNode waves,
30 : base(new ScriptNode[] { high, low, waves }, new ArgumentType[] { ArgumentType.Scalar,
31 ArgumentType.Scalar, ArgumentType.Scalar }, Start, Length, Expression)
32 {
33 this.high = High;
34 this.low = Low;
35 this.waves = Waves;
36 }
37
41 public override string[] DefaultArgumentNames
42 {
43 get
44 {
45 return new string[] { "high", "low", "waves" };
46 }
47 }
48
53 {
57
58 return new BlobVariation(High, Low, Waves, this.Arguments[0], this.Arguments[1], this.Arguments[2],
59 this.Start, this.Length, this.Expression);
60 }
61
65 public override void Operate(ref double x, ref double y)
66 {
67 double r = Math.Sqrt(x * x + y * y);
68 double a = Math.Atan2(x, y);
69 r *= this.low + (this.high - this.low) * 0.5 * (Math.Sin(this.waves * a) + 1);
70 x = r * Math.Cos(a);
71 y = r * Math.Sin(a);
72 }
73
77 public override string FunctionName => nameof(BlobVariation);
78 }
79}
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 void Operate(ref double x, ref double y)
TODO
BlobVariation(ScriptNode high, ScriptNode low, ScriptNode waves, int Start, int Length, Expression Expression)
TODO
override IElement Evaluate(IElement[] Arguments, Variables Variables)
TODO
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
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
Basic interface for all types of elements.
Definition: IElement.cs:20
ArgumentType
Type of parameter used in a function definition or a lambda definition.
Definition: IFunction.cs:9