38 : base(new
ScriptNode[] { r, i, dr, R, p, Palette, DimX, DimY },
50 : base(new
ScriptNode[] { r, i, dr, R, p, Palette, DimX },
62 : base(new
ScriptNode[] { r, i, dr, R, p, Palette },
88 return new string[] {
"r",
"i",
"dr",
"R",
"p",
"Palette",
"DimX",
"DimY" };
97 string ColorExpression =
null;
102 double Rr, Ri, pr, pi;
110 if ((Obj =
Arguments[3].AssociatedObjectValue) is Complex)
112 Complex z = (Complex)Obj;
122 if ((Obj =
Arguments[4].AssociatedObjectValue) is Complex)
124 Complex z = (Complex)Obj;
139 ColorExpression = this.Arguments[i].SubExpression;
144 Palette = ColorModels.RandomLinearAnalogousHSL.CreatePalette(128, 4, out
int Seed,
this,
Variables);
145 ColorExpression =
"RandomLinearAnalogousHSL(128,4," + Seed.ToString() +
")";
147 if (i < c && this.Arguments[i] is
null)
163 throw new ScriptRuntimeException(
"Parameter mismatch in call to NovaSmoothFractal(r,c,dr,Coefficients[,Palette][,dimx[,dimy]]).",
167 if (dimx <= 0 || dimx > 5000 || dimy <= 0 || dimy > 5000)
170 return CalcNova(rc, ic, dr, Rr, Ri, pr, pi, Palette, dimx, dimy,
this,
Variables, this.FractalZoomScript,
171 new object[] { Palette, dimx, dimy, Rr, Ri, pr, pi, ColorExpression });
174 private string FractalZoomScript(
double r,
double i,
double Size,
object State)
176 object[] Parameters = (
object[])State;
177 int DimX = (int)Parameters[1];
178 int DimY = (int)Parameters[2];
179 double Rr = (double)Parameters[3];
180 double Ri = (double)Parameters[4];
181 double pr = (double)Parameters[5];
182 double pi = (double)Parameters[6];
183 string ColorExpression = (string)Parameters[7];
185 StringBuilder sb =
new StringBuilder();
187 sb.Append(
"NovaSmoothFractal(");
213 if (!
string.IsNullOrEmpty(ColorExpression))
216 sb.Append(ColorExpression);
220 sb.Append(DimX.ToString());
222 sb.Append(DimY.ToString());
225 return sb.ToString();
233 FractalZoomScript FractalZoomScript,
object State)
235 double r0, i0, r1, i1;
238 double zr, zi, zr2, zi2, zr3, zi3, zr4, zi4;
252 r0 = rCenter - rDelta;
253 r1 = rCenter + rDelta;
255 aspect = ((double)Width) / Height;
257 i0 = iCenter - rDelta / aspect;
258 i1 = iCenter + rDelta / aspect;
260 dr = (r1 - r0) / Width;
261 di = (i1 - i0) / Height;
263 int Size = Width * Height;
264 double[] ColorIndex =
new double[Size];
268 for (y = 0, i = i0, index = 0; y < Height; y++, i += di)
270 for (x = 0, r = r0; x < Width; x++, r += dr)
286 lnz = Math.Log(Math.Sqrt(zr * zr + zi * zi));
287 argz = Math.Atan2(zi, zr);
288 amp = Math.Exp(pr * lnz - pi * argz);
289 phi = pi * lnz + pr * argz;
291 zr2 = amp * Math.Cos(phi) - 1;
292 zi2 = amp * Math.Sin(phi);
299 amp = Math.Exp((pr - 1) * lnz - pi * argz);
300 phi = pi * lnz + (pr - 1) * argz;
302 zr3 = amp * Math.Cos(phi);
303 zi3 = amp * Math.Sin(phi);
305 Temp = pr * zr3 - pi * zi3;
306 zi3 = pr * zi3 + pi * zr3;
311 Temp = 1.0 / (zr3 * zr3 + zi3 * zi3);
312 zr4 = (zr2 * zr3 + zi2 * zi3) * Temp;
313 zi4 = (zi2 * zr3 - zr2 * zi3) * Temp;
315 Temp = Rr * zr4 - Ri * zi4;
316 zi4 = Ri * zr4 + Rr * zi4;
322 Temp = Math.Sqrt(zr4 * zr4 + zi4 * zi4);
324 while ((Temp > Conv) && (Temp < Div) && (n++ < N));
326 if (Temp < Conv && n < N)
327 ColorIndex[index++] = n;
329 ColorIndex[index++] = N;
Script runtime exception.
Class managing a script expression.
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 Nova Smooth Fractal Image
override IElement Evaluate(IElement[] Arguments, Variables Variables)
TODO
override string[] DefaultArgumentNames
TODO
NovaSmoothFractal(ScriptNode r, ScriptNode i, ScriptNode dr, ScriptNode R, ScriptNode p, ScriptNode Palette, int Start, int Length, Expression Expression)
TODO
NovaSmoothFractal(ScriptNode r, ScriptNode i, ScriptNode dr, ScriptNode R, ScriptNode p, ScriptNode Palette, ScriptNode DimX, ScriptNode DimY, int Start, int Length, Expression Expression)
TODO
NovaSmoothFractal(ScriptNode r, ScriptNode i, ScriptNode dr, ScriptNode R, ScriptNode p, int Start, int Length, Expression Expression)
TODO
NovaSmoothFractal(ScriptNode r, ScriptNode i, ScriptNode dr, ScriptNode R, ScriptNode p, ScriptNode Palette, ScriptNode DimX, int Start, int Length, Expression Expression)
TODO
static FractalGraph CalcNova(double rCenter, double iCenter, double rDelta, double Rr, double Ri, double pr, double pi, SKColor[] Palette, int Width, int Height, ScriptNode Node, Variables Variables, FractalZoomScript FractalZoomScript, object State)
TODO
override string FunctionName
TODO
Defines a clickable fractal graph in the complex plane.
static PixelInformation ToPixels(double[] ColorIndex, int Width, int Height, SKColor[] Palette)
TODO
static SKColor[] ToPalette(ObjectVector Vector)
TODO
static double[] FindBoundaries(double[] ColorIndex, int Width, int Height)
TODO
static void Smooth(double[] ColorIndex, double[] Boundary, int Width, int Height, int N, SKColor[] Palette, ScriptNode Node, Variables Variables)
TODO
Handles bitmap-based graphs.
Base class for multivariate funcions.
ScriptNode[] Arguments
Function arguments.
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.
void Preview(Expression Expression, IElement Result)
Reports a preview of the final result.
Basic interface for all types of elements.
delegate string FractalZoomScript(double r, double i, double Size, object State)
Generates new script when zoomed.
ArgumentType
Type of parameter used in a function definition or a lambda definition.