Popcorn fractal map

Dependencies:   mbed

main.cpp

Committer:
JLS
Date:
2010-12-25
Revision:
0:732044ed2f1d
Child:
1:77a27904e76e

File content as of revision 0:732044ed2f1d:

#include "TFT_4DGL.h"

TFT_4DGL lcd(p9,p10,p11);

int main() {
   
    float h = 0.05;

    int iter = 0;
    int maxiter = 5000;

    float x = 0.5;
    float y = 0;

    int xout = 0;
    int yout = 0;

    lcd.baudrate(600000);
 
 while (1) {
 
    double oldX = x;
    double oldY = y;
  
    x = oldX-h*sin(oldY+tan(3*oldY));
    y = oldY-h*sin(oldX+tan(3*oldX));
  
  iter++;
  
  if (iter == maxiter) {
  
    iter = 0;
    x=0.5;
    y=0;
    lcd.cls();
    
  }
            
  xout = 50+(x*35);
  yout = 120+(y*35);
  
    lcd.pixel(yout,xout,WHITE);

}
}