Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
JuliaScopeVariation.cs
1using System;
4
6{
11 {
12 private readonly double dist;
13 private readonly int power;
14
19 : base(new ScriptNode[] { power, dist }, new ArgumentType[] { ArgumentType.Scalar, ArgumentType.Scalar },
21 {
22 this.power = 0;
23 this.dist = 0;
24 }
25
26 private JuliaScopeVariation(int Power, double Dist, ScriptNode power, ScriptNode dist, int Start, int Length, Expression Expression)
27 : base(new ScriptNode[] { power, dist }, new ArgumentType[] { ArgumentType.Scalar, ArgumentType.Scalar },
29 {
30 this.power = Power;
31 this.dist = Dist;
32 }
33
37 public override string[] DefaultArgumentNames
38 {
39 get
40 {
41 return new string[] { "power", "dist" };
42 }
43 }
44
49 {
50 int Power = (int)Expression.ToDouble(Arguments[0].AssociatedObjectValue);
52
53 return new JuliaScopeVariation(Power, Dist, this.Arguments[0], this.Arguments[1], this.Start, this.Length, this.Expression);
54 }
55
59 public override void Operate(ref double x, ref double y)
60 {
61 int p3;
62
63 lock (this.gen)
64 {
65 p3 = this.gen.Next(Math.Abs(this.power));
66 }
67
68 double a = Math.Atan2(y, x);
69 double t;
70
71 if ((p3 & 1) == 0)
72 t = (2 * Math.PI * p3 + a) / this.power;
73 else
74 t = (2 * Math.PI * p3 - a) / this.power;
75
76 double r = Math.Pow(Math.Sqrt(x * x + y * y), this.dist / this.power);
77
78 x = r * Math.Cos(t);
79 y = r * Math.Sin(t);
80 }
81
82 private readonly Random gen = new Random();
83
87 public override string FunctionName => nameof(JuliaScopeVariation);
88 }
89}
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
override IElement Evaluate(IElement[] Arguments, Variables Variables)
TODO
JuliaScopeVariation(ScriptNode power, ScriptNode dist, int Start, int Length, Expression Expression)
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