Simple chaotic flow attractor

Dependencies:   mbed

main.cpp

Committer:
JLS
Date:
2011-02-10
Revision:
0:59b205692ef0

File content as of revision 0:59b205692ef0:

#include "TFT_4DGL.h"

TFT_4DGL lcd(p9,p10,p11);

int main() {

     int   xp,yp;
     
     int n = WHITE;
   
     float x,y,z,xn,yn,zn;

     float dt = 0.05;
  
     float x1 = 0.1;
     float y1 = 0;
     float z1 = 0;


    while(1)
    
    {
    
        xn = -y1+(z1*z1);
        yn = x1+0.43*y1;
        zn = x1-z1;

        x = x+xn*dt;
        y = y+yn*dt;
        z = z+zn*dt;
        

        xp = (int)floor(x*32);
        yp = (int)floor(y*48);

        lcd.pixel(170+xp,60+yp,n);
     
        x1 = x;
        y1 = y;
        z1 = z;
        
    }
 
}