Pickover fractal map

Dependencies:   mbed

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.75;
00014      float b = 2.44;
00015      float c = 1.25;
00016      float d = 1.5;
00017   
00018      float x1 = 0.1;
00019      float y1 = -0.4;
00020      float z1 = 0.1;
00021 
00022     while(1)
00023     
00024     {
00025     
00026         x = sin(a*y1)-z1*cos(b*x1);
00027         y = z*sin(c*x1)-cos(d*y1);
00028         z = sin(x1);
00029 
00030         xp = (int)floor(x*265);
00031         yp = (int)floor(y*245);
00032 
00033         lcd.pixel(80+xp,270+yp,n);
00034       
00035         x1 = x;
00036         y1 = y;
00037         z1 = z;
00038         
00039     }
00040  
00041 }