27 : base(new
ScriptNode[] { z, dr, R, c, Palette, DimX, DimY },
39 : base(new
ScriptNode[] { z, dr, R, c, Palette, DimX },
51 : base(new
ScriptNode[] { z, dr, R, c, Palette },
65 ArgumentType.Normal },
88 return new string[] {
"z",
"dr",
"R",
"c",
"Palette",
"DimX",
"DimY" };
97 string ColorExpression =
null;
99 double[] Coefficients =
null;
100 Complex[] CoefficientsZ =
null;
109 Obj =
Arguments[i++].AssociatedObjectValue;
110 if (Obj is Complex z)
126 if (i < c && ((Obj =
Arguments[i].AssociatedObjectValue) is
double || Obj is Complex))
135 if (i < c && this.Arguments[i] is
null)
141 Coefficients = (
double[])
Arguments[i++].AssociatedObjectValue;
143 int j, d = Coefficients.
Length;
145 CoefficientsZ =
new Complex[d];
146 for (j = 0; j < d; j++)
147 CoefficientsZ[j] =
new Complex(Coefficients[j], 0);
150 CoefficientsZ = (Complex[])
Arguments[i++].AssociatedObjectValue;
160 CoefficientsZ =
new Complex[d];
161 for (j = 0; j < d; j++)
165 CoefficientsZ =
new Complex[0];
169 ColorExpression = this.Arguments[i].SubExpression;
174 Palette = ColorModels.RandomLinearAnalogousHSL.CreatePalette(128, 4, out
int Seed,
this,
Variables);
175 ColorExpression =
"RandomLinearAnalogousHSL(128,4," + Seed.ToString() +
")";
177 if (i < c && this.Arguments[i] is
null)
193 throw new ScriptRuntimeException(
"Parameter mismatch in call to NewtonBuilderFractal(r,c,dr,Coefficients[,Palette][,dimx[,dimy]]).",
197 if (dimx <= 0 || dimx > 5000 || dimy <= 0 || dimy > 5000)
200 return NewtonFractal.
CalcNewton(
Variables, rc, ic, dr, R, CoefficientsZ, Palette, dimx, dimy,
this, this.FractalZoomScript,
201 new object[] { Palette, dimx, dimy, R, CoefficientsZ, ColorExpression, rc, ic });
204 private string FractalZoomScript(
double r,
double i,
double Size,
object State)
206 object[] Parameters = (
object[])State;
207 int DimX = (int)Parameters[1];
208 int DimY = (int)Parameters[2];
209 Complex R = (Complex)Parameters[3];
210 Complex[] CoefficientsZ = (Complex[])Parameters[4];
211 string ColorExpression = (string)Parameters[5];
212 double rc = (double)Parameters[6];
213 double ic = (double)Parameters[7];
214 Complex z0 =
new Complex(r, i);
217 int c = CoefficientsZ.Length;
218 while (c > 1 && CoefficientsZ[c - 1].
Equals(0))
231 C2 =
new Complex[c + 1];
232 C2[0] = Complex.Zero;
233 for (j = 0; j < c; j++)
234 C2[j + 1] = CoefficientsZ[j];
236 for (j = 0; j < c; j++)
237 C2[j] -= z0 * CoefficientsZ[j];
240 StringBuilder sb =
new StringBuilder();
242 sb.Append(
"NewtonBuilderFractal((");
253 if (!
string.IsNullOrEmpty(ColorExpression))
256 sb.Append(ColorExpression);
260 sb.Append(DimX.ToString());
262 sb.Append(DimY.ToString());
265 return sb.ToString();
Script runtime exception.
Class managing a script expression.
static Complex ToComplex(object Object)
Converts an object to a complex value.
static double ToDouble(object Object)
Converts an object to a double value.
static string ToString(double Value)
Converts a value to a string, that can be parsed as part of an expression.
Calculates a Newton Fractal Image, but when clicked, adds a root to the underying polynomial,...
NewtonBuilderFractal(ScriptNode z, ScriptNode dr, ScriptNode R, int Start, int Length, Expression Expression)
TODO
NewtonBuilderFractal(ScriptNode z, ScriptNode dr, ScriptNode R, ScriptNode c, ScriptNode Palette, int Start, int Length, Expression Expression)
TODO
override IElement Evaluate(IElement[] Arguments, Variables Variables)
TODO
NewtonBuilderFractal(ScriptNode z, ScriptNode dr, ScriptNode R, ScriptNode c, ScriptNode Palette, ScriptNode DimX, int Start, int Length, Expression Expression)
TODO
override string FunctionName
TODO
NewtonBuilderFractal(ScriptNode z, ScriptNode dr, ScriptNode R, ScriptNode c, ScriptNode Palette, ScriptNode DimX, ScriptNode DimY, int Start, int Length, Expression Expression)
TODO
NewtonBuilderFractal(ScriptNode z, ScriptNode dr, ScriptNode R, ScriptNode c, int Start, int Length, Expression Expression)
TODO
override string[] DefaultArgumentNames
TODO
Calculates a Newton Fractal Image
static FractalGraph CalcNewton(Variables Variables, double rCenter, double iCenter, double rDelta, Complex R, double[] Coefficients, SKColor[] Palette, int Width, int Height, ScriptNode Node, FractalZoomScript FractalZoomScript, object State)
TODO
Defines a clickable fractal graph in the complex plane.
static SKColor[] ToPalette(ObjectVector Vector)
TODO
Base class for multivariate funcions.
ScriptNode[] Arguments
Function arguments.
override bool Equals(object obj)
Base class for all nodes in a parsed script tree.
int Length
Length of expression covered by node.
Expression Expression
Expression of which the node is a part.
int Start
Start position in script expression.
Basic interface for all types of elements.
object AssociatedObjectValue
Associated object value.
Basic interface for vectors.
int Dimension
Dimension of vector.
IElement GetElement(int Index)
Gets an element of the vector.
ArgumentType
Type of parameter used in a function definition or a lambda definition.