Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
FlowerVariation.cs
1using System;
4
6{
11 {
12 private readonly double holes;
13 private readonly double petals;
14
19 : base(new ScriptNode[] { holes, petals }, new ArgumentType[] { ArgumentType.Scalar, ArgumentType.Scalar },
21 {
22 this.holes = 0;
23 this.petals = 0;
24 }
25
26 private FlowerVariation(double Holes, double Petals, ScriptNode holes, ScriptNode petals, int Start, int Length, Expression Expression)
27 : base(new ScriptNode[] { holes, petals }, new ArgumentType[] { ArgumentType.Scalar, ArgumentType.Scalar },
29 {
30 this.holes = Holes;
31 this.petals = Petals;
32 }
33
37 public override string[] DefaultArgumentNames
38 {
39 get
40 {
41 return new string[] { "holes", "petals" };
42 }
43 }
44
49 {
52
53 return new FlowerVariation(Holes, Petals, 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 double r1;
62
63 lock (this.gen)
64 {
65 r1 = this.gen.NextDouble();
66 }
67
68 double a = Math.Atan2(y, x);
69 double r = (r1 - this.holes) * Math.Cos(this.petals * a);
70 x = r * Math.Cos(a);
71 y = r * Math.Sin(a);
72 }
73
74 private readonly Random gen = new Random();
75
79 public override string FunctionName => nameof(FlowerVariation);
80 }
81}
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
FlowerVariation(ScriptNode holes, ScriptNode petals, 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