QuadrupTwo fractal map

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "TFT_4DGL.h"
00002 
00003 TFT_4DGL lcd(p9,p10,p11);
00004 
00005 int main() {
00006 
00007      int   xp,yp;
00008      
00009      int n = WHITE;
00010      int m = 0;
00011    
00012      float x,y;
00013 
00014      float a = 34;
00015      float b = 0.9;
00016      float c = 5;
00017   
00018      float x1 = 1;
00019      float y1 = 0;
00020 
00021     while(1)
00022     
00023     {
00024     
00025         x = y1 - (x1/x1) * sin(log(abs(b * x1 - c))) * atan(abs((pow(c * x1 - b,2))));
00026         y = a-x1;
00027 
00028         xp = (int)floor(3*x);
00029         yp = (int)floor(3*y);
00030         
00031         m++;
00032     
00033         if (m==300) {
00034     
00035         m = 0;
00036     
00037         n = rand();
00038     
00039         }
00040 
00041         lcd.pixel(70+xp,110+yp,n);
00042       
00043         x1 = x;
00044         y1 = y;
00045 
00046     }
00047  
00048 }