Ikeda fractal

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     double  u,x,y,t,xa,ya;
00008 
00009     int xout = 0;
00010     int yout = 0;
00011     
00012     u = 0.8;
00013 
00014     xa = 0.1;
00015     ya = 0.1;
00016     
00017     t = 0.4-6.0/(1+(xa*xa)+(ya*ya));
00018  
00019  while (1) {
00020  
00021     x = 1 + u*(xa*cos(t)-ya*sin(t));
00022     y = u*(xa*sin(t) + ya*cos(t));
00023     t = 0.4-6.0/(1+(x*x)+(y*y));
00024   
00025     xout = 20+(x*145);
00026     yout = 195+(y*140);
00027    
00028     lcd.pixel(xout,yout,WHITE);
00029     
00030     xa = x;
00031     ya = y;
00032 }
00033 }