//This is a shortcut for z->z^2+c - implementing it as a //standalone function SHOULD be faster than calling one function //to square the number and a second one to do the add. public void SquareAndAdd(ComplexDouble c) { //(a + bi)(a + bi) + (c+di) =(a^2 - b^2 + c) + (2ab + d)i; double r = (real * real) - (imaginary * imaginary) + c.real; double i = (2.0 * real * imaginary) + c.imaginary; this.real = r; this.imaginary = i; }
private void ZoomOut(Complex center) { Center = center; ViewportWidth *= 2; RenderInternal(); }
public static double GetSquaredDistance(ComplexDouble a, ComplexDouble b) { double dr = a.real - b.real; double di = a.imaginary - b.imaginary; return dr * dr + di * di; }