25 : base(new
ScriptNode[] { z, dr, R, Coefficients, Palette, DimX, DimY },
36 : base(new
ScriptNode[] { z, dr, R, Coefficients, Palette, DimX },
47 : base(new
ScriptNode[] { z, dr, R, Coefficients, Palette },
58 : base(new
ScriptNode[] { z, dr, R, Coefficients },
82 return new string[] {
"z",
"dr",
"R",
"Coefficients",
"Palette",
"DimX",
"DimY" };
91 string ColorExpression =
null;
93 double[] Coefficients =
null;
94 Complex[] CoefficientsZ =
null;
103 Obj =
Arguments[i++].AssociatedObjectValue;
104 if (Obj is Complex z)
120 if (i < c && ((Obj =
Arguments[i].AssociatedObjectValue) is
double || Obj is Complex))
129 if (i < c && this.Arguments[i] is
null)
135 Coefficients = (
double[])
Arguments[i++].AssociatedObjectValue;
137 int j, d = Coefficients.
Length;
139 CoefficientsZ =
new Complex[d];
140 for (j = 0; j < d; j++)
141 CoefficientsZ[j] =
new Complex(Coefficients[j], 0);
144 CoefficientsZ = (Complex[])
Arguments[i++].AssociatedObjectValue;
154 CoefficientsZ =
new Complex[d];
155 for (j = 0; j < d; j++)
159 CoefficientsZ =
new Complex[0];
163 ColorExpression = this.Arguments[i].SubExpression;
168 Palette = ColorModels.RandomLinearAnalogousHSL.CreatePalette(128, 4, out
int Seed,
this,
Variables);
169 ColorExpression =
"RandomLinearAnalogousHSL(128,4," + Seed.ToString() +
")";
171 if (i < c && this.Arguments[i] is
null)
187 throw new ScriptRuntimeException(
"Parameter mismatch in call to HalleyBuilderFractal(z,dr[,R][,Coefficients][,Palette][,dimx[,dimy]]).",
191 if (dimx <= 0 || dimx > 5000 || dimy <= 0 || dimy > 5000)
194 return HalleyFractal.
CalcHalley(
Variables, rc, ic, dr, R, CoefficientsZ, Palette, dimx, dimy,
this, this.FractalZoomScript,
195 new object[] { Palette, dimx, dimy, R, CoefficientsZ, ColorExpression, rc, ic });
198 private string FractalZoomScript(
double r,
double i,
double Size,
object State)
200 object[] Parameters = (
object[])State;
201 int DimX = (int)Parameters[1];
202 int DimY = (int)Parameters[2];
203 Complex R = (Complex)Parameters[3];
204 Complex[] CoefficientsZ = (Complex[])Parameters[4];
205 string ColorExpression = (string)Parameters[5];
206 double rc = (double)Parameters[6];
207 double ic = (double)Parameters[7];
208 Complex z0 =
new Complex(r, i);
211 int c = CoefficientsZ.Length;
212 while (c > 1 && CoefficientsZ[c - 1].
Equals(0))
225 C2 =
new Complex[c + 1];
226 C2[0] = Complex.Zero;
227 for (j = 0; j < c; j++)
228 C2[j + 1] = CoefficientsZ[j];
230 for (j = 0; j < c; j++)
231 C2[j] -= z0 * CoefficientsZ[j];
234 StringBuilder sb =
new StringBuilder();
236 sb.Append(
"HalleyBuilderFractal((");
247 if (!
string.IsNullOrEmpty(ColorExpression))
250 sb.Append(ColorExpression);
254 sb.Append(DimX.ToString());
256 sb.Append(DimY.ToString());
259 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
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.