Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 #include "TFT_4DGL.h" 00002 00003 TFT_4DGL lcd(p9,p10,p11); 00004 00005 int main() { 00006 00007 double ImageHeight = 220; 00008 double ImageWidth = 220; 00009 double MinRe = -1.6; 00010 double MaxRe = 0.8; 00011 double MinIm = -1.1; 00012 double MaxIm = MinIm+(MaxRe-MinRe)*ImageHeight/ImageWidth; 00013 double Re_factor = (MaxRe-MinRe)/(ImageWidth-1); 00014 double Im_factor = (MaxIm-MinIm)/(ImageHeight-1); 00015 unsigned MaxIterations = 15; 00016 00017 00018 while (1) { 00019 00020 for(unsigned y=0; y<ImageHeight; ++y) 00021 { 00022 double c_im = MaxIm - y*Im_factor; 00023 for(unsigned x=0; x<ImageWidth; ++x) 00024 { 00025 double c_re = MinRe + x*Re_factor; 00026 00027 double Z_re = c_re, Z_im = c_im; 00028 bool isInside = true; 00029 for(unsigned n=0; n<MaxIterations; ++n) 00030 { 00031 double Z_re2 = Z_re*Z_re, Z_im2 = Z_im*Z_im; 00032 if(Z_re2 + Z_im2 > 4) 00033 { 00034 isInside = false; 00035 break; 00036 } 00037 Z_im = 2*Z_re*Z_im + c_im; 00038 Z_re = Z_re2 - Z_im2 + c_re; 00039 } 00040 if(isInside) { 00041 00042 lcd.pixel(y,60+x,WHITE); 00043 00044 } 00045 } 00046 } 00047 00048 } 00049 }
Generated on Thu Aug 4 2022 15:14:32 by
1.7.2