Henon quadratic map - Mod3 color

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     float a = 0.425;
00008     float b = 0.382;
00009 
00010     float x = 0.1;
00011     float y = 0.1;
00012 
00013     int xout = 0;
00014     int yout = 0;
00015     int n = WHITE;
00016     int m = 0;
00017  
00018  while (1) {
00019  
00020     double x1 = x;
00021     double y1 = y;
00022   
00023     x = x1*cos(a)-(y1-pow(x1,2))*sin(b);
00024     y = x1*sin(a)+(y1-pow(x1,2))*cos(b);
00025     
00026     m++;
00027     
00028     if (m==150) {
00029     
00030     m = 0;
00031     
00032     n = rand();
00033     
00034     }
00035   
00036     xout = 110+(750*x);
00037     yout = 160+(950*y);
00038    
00039     lcd.pixel(xout,yout,n);
00040   
00041 }
00042 }