Polynomial Type B - 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    
00011      float x,y,z;
00012 
00013      float a = -0.237;
00014      float b = 0.453;
00015      float c = 0.486;
00016      float d = 0.616;
00017      float e = 1.141;
00018      float f = 0.483;
00019   
00020      float x1 = 1;
00021      float y1 = 1;
00022      float z1 = 1;
00023 
00024     while(1)
00025     
00026     {
00027     
00028         x = a+y1-z1*(b+y1);
00029         y = c+z1-x1*(d+z1);
00030         z = e+x1-y1*(f+x1);
00031 
00032         xp = (int)floor(x*80);
00033         yp = (int)floor(y*80);
00034 
00035         lcd.pixel(110+xp,70+yp,n);
00036       
00037         x1 = x;
00038         y1 = y;
00039         z1 = z;
00040         
00041     }
00042  
00043 }