Thomas cyclically symetric attractor

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 b,x1,y1,z1,x,y,z,t,dt;
00008     int   xp,yp;
00009    
00010     x1 = 0.1;
00011     y1 = 0;
00012     z1 = 0;
00013     
00014     b = 0.19;
00015     
00016     dt = 0.05;
00017 
00018     while(1)
00019     
00020     {
00021     
00022         x = x1+(-b*x1+sin(y1))*dt;
00023         y = y1+(-b*y1+sin(z1))*dt;
00024         z = z1+(-b*z1+sin(x1))*dt;
00025         t = t+dt;
00026 
00027         xp = 160+(int)floor(35*x);
00028         yp = 120+(int)floor(25*z);
00029 
00030         lcd.pixel(yp,xp,WHITE);
00031       
00032         x1 = x;
00033         y1 = y;
00034         z1 = z;
00035 
00036     }
00037  
00038 }