public static unsafe void Main (string [] args) { FComplex xF = new FComplex ((float) 41, (float) 41); FComplex [] xxF = new FComplex [10], yyF = new FComplex [10]; for (int i = 0; i < xxF.Length; i++) xxF [i] = new FComplex ((float) i, (float) 2 * i); fixed (void* xxf = xxF, yyf = yyF) addComplexS (xxF.Length, xxf, xF, yyf); fixed (void* xxf = xxF, yyf = yyF) addComplexS (xxF.Length, xxf, xF, yyf); }
public static EscapeTime FindEscapeTime(FComplex c, int maxIterations) { if (MandelbulbChecker.IsInsideBulbs(c)) { return(EscapeTime.Infinite); } var zReal = 0.0f; var zImag = 0.0f; var z2Real = 0.0f; var z2Imag = 0.0f; var oldZReal = 0.0f; var oldZImag = 0.0f; int stepsTaken = 0; int stepLimit = 2; for (int i = 0; i < maxIterations; i++) { stepsTaken++; zImag = 2 * zReal * zImag + c.Imaginary; zReal = z2Real - z2Imag + c.Real; if (oldZReal == zReal && oldZImag == zImag) { return(EscapeTime.Infinite); } z2Real = zReal * zReal; z2Imag = zImag * zImag; if ((z2Real + z2Imag) > 4) { return(EscapeTime.Discrete(i)); } if (stepsTaken == stepLimit) { oldZReal = zReal; oldZImag = zImag; stepsTaken = 0; stepLimit = stepLimit << 1; } } return(EscapeTime.Infinite); }
private static extern unsafe void addComplexS (int l, void* x, FComplex y, void* z);
public FEdgeSpan(FComplex inSet, FComplex notInSet) { InSet = inSet; NotInSet = notInSet; }
public static bool IsInsideBulbs(FComplex number) => IsInsideBulbs(number.ToDouble());