26 : base(new
ScriptNode[] { z, dr, R, Coefficients, Palette, DimX, DimY },
37 : base(new
ScriptNode[] { z, dr, R, Coefficients, Palette, DimX },
48 : base(new
ScriptNode[] { z, dr, R, Coefficients, Palette },
59 : base(new
ScriptNode[] { z, dr, R, Coefficients },
83 return new string[] {
"z",
"dr",
"R",
"Coefficients",
"Palette",
"DimX",
"DimY" };
92 string ColorExpression =
null;
94 double[] Coefficients =
null;
95 Complex[] CoefficientsZ =
null;
104 Obj =
Arguments[i++].AssociatedObjectValue;
105 if (Obj is Complex z)
121 if (i < c && ((Obj =
Arguments[i].AssociatedObjectValue) is
double || Obj is Complex))
130 if (i < c && this.Arguments[i] is
null)
136 Coefficients = (
double[])
Arguments[i++].AssociatedObjectValue;
138 int j, d = Coefficients.
Length;
140 CoefficientsZ =
new Complex[d];
141 for (j = 0; j < d; j++)
142 CoefficientsZ[j] =
new Complex(Coefficients[j], 0);
145 CoefficientsZ = (Complex[])
Arguments[i++].AssociatedObjectValue;
155 CoefficientsZ =
new Complex[d];
156 for (j = 0; j < d; j++)
160 CoefficientsZ =
System.Array.Empty<Complex>();
164 ColorExpression = this.Arguments[i].SubExpression;
169 Palette = ColorModels.RandomLinearAnalogousHSL.CreatePalette(128, 4, out
int Seed,
this,
Variables);
170 ColorExpression =
"RandomLinearAnalogousHSL(128,4," + Seed.ToString() +
")";
172 if (i < c && this.Arguments[i] is
null)
188 throw new ScriptRuntimeException(
"Parameter mismatch in call to HalleyBuilderFractal(z,dr[,R][,Coefficients][,Palette][,dimx[,dimy]]).",
192 if (dimx <= 0 || dimx > 5000 || dimy <= 0 || dimy > 5000)
195 return HalleyFractal.
CalcHalley(
Variables, rc, ic, dr, R, CoefficientsZ, Palette, dimx, dimy,
this, this.FractalZoomScript,
196 new object[] { Palette, dimx, dimy, R, CoefficientsZ, ColorExpression, rc, ic });
199 private string FractalZoomScript(
double r,
double i,
double Size,
object State)
201 object[] Parameters = (
object[])State;
202 int DimX = (int)Parameters[1];
203 int DimY = (int)Parameters[2];
204 Complex R = (Complex)Parameters[3];
205 Complex[] CoefficientsZ = (Complex[])Parameters[4];
206 string ColorExpression = (string)Parameters[5];
207 double rc = (double)Parameters[6];
208 double ic = (double)Parameters[7];
209 Complex z0 =
new Complex(r, i);
212 int c = CoefficientsZ.Length;
213 while (c > 1 && CoefficientsZ[c - 1].
Equals(0))
226 C2 =
new Complex[c + 1];
227 C2[0] = Complex.Zero;
228 for (j = 0; j < c; j++)
229 C2[j + 1] = CoefficientsZ[j];
231 for (j = 0; j < c; j++)
232 C2[j] -= z0 * CoefficientsZ[j];
235 StringBuilder sb =
new StringBuilder();
237 sb.Append(
"HalleyBuilderFractal((");
248 if (!
string.IsNullOrEmpty(ColorExpression))
251 sb.Append(ColorExpression);
255 sb.Append(DimX.ToString());
257 sb.Append(DimY.ToString());
260 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 Halley Fractal Image, but when clicked, adds a root to the underying polynomial,...
HalleyBuilderFractal(ScriptNode z, ScriptNode dr, ScriptNode R, ScriptNode Coefficients, ScriptNode Palette, ScriptNode DimX, int Start, int Length, Expression Expression)
TODO
HalleyBuilderFractal(ScriptNode z, ScriptNode dr, ScriptNode R, ScriptNode Coefficients, int Start, int Length, Expression Expression)
TODO
override IElement Evaluate(IElement[] Arguments, Variables Variables)
TODO
override string[] DefaultArgumentNames
TODO
override string FunctionName
TODO
HalleyBuilderFractal(ScriptNode z, ScriptNode dr, ScriptNode R, int Start, int Length, Expression Expression)
TODO
HalleyBuilderFractal(ScriptNode z, ScriptNode dr, ScriptNode R, ScriptNode Coefficients, ScriptNode Palette, ScriptNode DimX, ScriptNode DimY, int Start, int Length, Expression Expression)
TODO
HalleyBuilderFractal(ScriptNode z, ScriptNode dr, ScriptNode R, ScriptNode Coefficients, ScriptNode Palette, int Start, int Length, Expression Expression)
TODO
Calculates a Halley Fractal Image
static FractalGraph CalcHalley(Variables Variables, double rCenter, double iCenter, double rDelta, Complex R, double[] Coefficients, SKColor[] Palette, int Width, int Height, ScriptNode Node, FractalZoomScript FractalZoomScript, object State)
Calculates a Halley Fractal
Exception thrown if an image with invalid size is requested.
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.