Exemplo n.º 1
0
		private void ThreadedIterate(System.Object obj)
		{
			FractalUtility.ThreadData td = (FractalUtility.ThreadData)obj;
			float xStep = (mMaxX - mMinX) / (mData.GetUpperBound (0) + 1);
			float yStep = (mMaxY - mMinY) / (mData.GetUpperBound (1) + 1);
			for (int y = td.start; y < td.end; ++y) {
				for (int x = 0; x <= mData.GetUpperBound (0); ++x) {
					if (mWorker.CancellationPending)
						break;
					FractalComplexNumber complexPoint = new FractalComplexNumber (mMinX + (x * xStep) - mCenter.x, mMinY + (y * yStep) - mCenter.y);
					float iterated = Iterate (complexPoint, new FractalComplexNumber (mInitialPoint));
					float value = 1;
					if (iterated >= 0) {
						value = iterated;
					} 

					mData [x, y] = value;
				}
				if (mWorker.CancellationPending)
					break;
			}
			mMutex.WaitOne ();
			mFinishedThreadCount++;
			mMutex.ReleaseMutex ();
		}
Exemplo n.º 2
0
        public static void QuadMandelbrotIterate(int iterations, out float returnVal, params FractalComplexNumber[] complexNos)
        {
            returnVal = -1f;
            FractalComplexNumber z = new FractalComplexNumber();
            FractalComplexNumber c = complexNos [0];

            for (int i = 0; i < iterations + 1; ++i)
            {
                z = z * z + c;
                if (z.Absolute >= 2f)
                {
                    returnVal = (float)i / (float)iterations;
                    break;
                }
            }
        }
Exemplo n.º 3
0
        public static void QuadJulietIterate(int iterations, out float returnVal, params FractalComplexNumber[] complexNos)
        {
            returnVal = -1f;
            FractalComplexNumber z = new FractalComplexNumber();

            if (complexNos.Length > 1)
            {
                z = complexNos [1];
            }
            FractalComplexNumber c = complexNos [0];

            for (int i = 1; i < iterations + 1; ++i)
            {
                z = z * z + c;
                if (z.Absolute >= 2f)
                {
                    returnVal = (float)i / (float)iterations;
                    break;
                }
            }
        }
Exemplo n.º 4
0
 public FractalVector2(FractalComplexNumber v)
 {
     this.x = v.Real;
     this.y = v.Imaginary;
 }
Exemplo n.º 5
0
        public override bool Equals(object obj)
        {
            FractalComplexNumber target = (FractalComplexNumber)obj;

            return(this.Real == target.Real && this.Imaginary == target.Imaginary);
        }
Exemplo n.º 6
0
 public FractalComplexNumber(FractalComplexNumber v)
 {
     this.Real      = v.Real;
     this.Imaginary = v.Imaginary;
 }