Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
ConicVariation.cs
1using System;
4
6{
11 {
12 private readonly double holes;
13 private readonly double eccentricity;
14
18 public ConicVariation(ScriptNode holes, ScriptNode eccentricity, int Start, int Length, Expression Expression)
19 : base(new ScriptNode[] { holes, eccentricity }, new ArgumentType[] { ArgumentType.Scalar, ArgumentType.Scalar },
21 {
22 this.holes = 0;
23 this.eccentricity = 0;
24 }
25
26 private ConicVariation(double Holes, double Eccentricity,
27 ScriptNode holes, ScriptNode eccentricity, int Start, int Length, Expression Expression)
28 : base(new ScriptNode[] { holes, eccentricity }, new ArgumentType[] { ArgumentType.Scalar, ArgumentType.Scalar },
30 {
31 this.holes = Holes;
32 this.eccentricity = Eccentricity;
33 }
34
38 public override string[] DefaultArgumentNames
39 {
40 get
41 {
42 return new string[] { "holes", "eccentricity" };
43 }
44 }
45
50 {
52 double Eccentricity = Expression.ToDouble(Arguments[1].AssociatedObjectValue);
53
54 return new ConicVariation(Holes, Eccentricity, this.Arguments[0], this.Arguments[1],
55 this.Start, this.Length, this.Expression);
56 }
57
61 public override void Operate(ref double x, ref double y)
62 {
63 double r1;
64
65 lock (this.gen)
66 {
67 r1 = this.gen.NextDouble();
68 }
69
70 double a = Math.Atan2(y, x);
71 double r = (r1 - this.holes) * this.eccentricity / (1 + this.eccentricity + Math.Cos(a));
72 x = r * Math.Cos(a);
73 y = r * Math.Sin(a);
74 }
75
76 private readonly Random gen = new Random();
77
81 public override string FunctionName => nameof(ConicVariation);
82 }
83}
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
ConicVariation(ScriptNode holes, ScriptNode eccentricity, 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