These are ACTUAL screen shots of the Liquidware TouchSlide running Mandlebrot cacalulations!
#define kQmax 340 #define kStartColor 1 #define kMaxItterations 255 #define kMandel_FarLeft -2.01 #define kMandel_FarRight 1.0 #define kMandel_FarTop -1.2 #define kMandel_FarBottom 1.2 //******************************************************************************* void DoMandleBrot(void) { float XMax, YMax, XMin, YMin; float X, Y, Xsquare, Ysquare; float QQtemp; float QQ[kQmax]; float PP, deltaP, deltaQ; long color; short row, col; short maxcol; short maxrow; RGBColor rgbColor; short itteration; Boolean keepGoing; short deltaColumn; short ii; short startOffset[10] = {0, 16, 8, 4, 2, 1, 3, 0}; short columnSteps[10] = {32, 32, 16, 8, 4, 4, 4, 0}; #ifdef _ENABLE_SCREEN_ROTATION_ byte oldScreenOrientation; oldScreenOrientation = SetScreenOrientation(kScreenOrientation_Landscape); #endif XMin = kMandel_FarLeft; XMax = kMandel_FarRight; YMin = kMandel_FarTop; YMax = kMandel_FarBottom; itteration = 0; keepGoing = true; while (keepGoing) { switch(itteration) { case 0: XMin = kMandel_FarLeft * 3; XMax = kMandel_FarRight * 3; YMin = kMandel_FarTop * 3; YMax = kMandel_FarBottom * 3; break; case 1: XMin = kMandel_FarLeft * 2; XMax = kMandel_FarRight * 2; YMin = kMandel_FarTop * 2; YMax = kMandel_FarBottom * 2; break; case 2: XMin = kMandel_FarLeft; XMax = kMandel_FarRight; YMin = kMandel_FarTop; YMax = kMandel_FarBottom; break; case 3: XMin = (kMandel_FarLeft / 3) - 1.5; XMax = (kMandel_FarRight / 3) - 1.5; YMin = kMandel_FarTop / 3; YMax = kMandel_FarBottom / 3; break; case 4: XMin = -1.7018; XMax = -1.7016; YMin = -0.000075; YMax = 0.000075; break; case 5: XMin = -0.197272275682447305; XMax = -0.196537412401197305; YMin = -0.67495234375; YMax = -0.67436640625; itteration = -1; //* this will reset back to the first break; } maxcol = GetScreenWidth(); maxrow = GetScreenHeight(); deltaP = (XMax - XMin) / (maxcol); deltaQ = (YMax - YMin) / (maxrow); QQ[0] = YMin; for (row=1; row<=maxrow; row++) { QQ[row] = QQ[row-1] + deltaQ; } ii = 0; while (columnSteps[ii] > 0) { deltaColumn = columnSteps[ii]; for (col=startOffset[ii]; col < maxcol; col += deltaColumn) { PP = XMin + (deltaP * col); for (row=0; row < maxrow; row++) { X = Y = Xsquare = Ysquare = 0.0; color = kStartColor; QQtemp = QQ[row]; while ((color < kMaxItterations) && ((Xsquare + Ysquare) < 4)) { Xsquare = X * X; Ysquare = Y * Y; Y *= X; Y += Y + QQtemp; X = Xsquare - Ysquare + PP; color++; } rgbColor.red = (255 - color) & 0xe0; rgbColor.green = ((255 - color) << 3) & 0xe0;; rgbColor.blue = ((255 - color) << 6) & 0xe0;; setPixel(col, row, rgbColor); } if (gettouch()) { keepGoing = false; break; } } ii++; if (gettouch()) { keepGoing = false; break; } } if (keepGoing) { delay(500); } itteration++; } #ifdef _ENABLE_SCREEN_ROTATION_ SetScreenOrientation(oldScreenOrientation); #endif } |