Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
PieVariation.cs
1using System;
4
6{
11 {
12 private readonly double slices;
13 private readonly double rotation;
14 private readonly double thickness;
15
19 public PieVariation(ScriptNode slices, ScriptNode rotation, ScriptNode thickness, int Start, int Length, Expression Expression)
20 : base(new ScriptNode[] { slices, rotation, thickness }, new ArgumentType[] { ArgumentType.Scalar,
21 ArgumentType.Scalar, ArgumentType.Scalar }, Start, Length, Expression)
22 {
23 this.slices = 0;
24 this.rotation = 0;
25 this.thickness = 0;
26 }
27
31 public PieVariation(double Slices, double Rotation, double Thickness,
32 ScriptNode slices, ScriptNode rotation, ScriptNode thickness, int Start, int Length, Expression Expression)
33 : base(new ScriptNode[] { slices, rotation, thickness }, new ArgumentType[] { ArgumentType.Scalar,
34 ArgumentType.Scalar, ArgumentType.Scalar }, Start, Length, Expression)
35 {
36 this.slices = Slices;
37 this.rotation = Rotation;
38 this.thickness = Thickness;
39 }
40
44 public override string[] DefaultArgumentNames
45 {
46 get
47 {
48 return new string[] { "slices", "rotation", "thickness" };
49 }
50 }
51
56 {
60
61 return new PieVariation(Slices, Rotation, Thickness, this.Arguments[0], this.Arguments[1], this.Arguments[2],
62 this.Start, this.Length, this.Expression);
63 }
64
68 public override void Operate(ref double x, ref double y)
69 {
70 double rnd1;
71 double rnd2;
72 double rnd3;
73
74 lock (this.gen)
75 {
76 rnd1 = this.gen.NextDouble();
77 rnd2 = this.gen.NextDouble();
78 rnd3 = this.gen.NextDouble();
79 }
80
81 double t1 = Math.Round(this.slices * rnd1);
82 double t2 = this.rotation + 2 * Math.PI / this.slices * (t1 + rnd2 * this.thickness);
83 x = rnd3 * Math.Cos(t2);
84 y = rnd3 * Math.Sin(t2);
85 }
86
87 private readonly Random gen = new Random();
88
92 public override string FunctionName => nameof(PieVariation);
93 }
94}
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[] Arguments, Variables Variables)
TODO
Definition: PieVariation.cs:55
override void Operate(ref double x, ref double y)
TODO
Definition: PieVariation.cs:68
PieVariation(double Slices, double Rotation, double Thickness, ScriptNode slices, ScriptNode rotation, ScriptNode thickness, int Start, int Length, Expression Expression)
TODO
Definition: PieVariation.cs:31
PieVariation(ScriptNode slices, ScriptNode rotation, ScriptNode thickness, int Start, int Length, Expression Expression)
TODO
Definition: PieVariation.cs:19
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