Tinkerbell fractal

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.9;
00008 float b = -0.6013;
00009 float c = 2;
00010 float d = 0.5;
00011 
00012 float x = -0.72;
00013 float y = -0.64;
00014 
00015 int xout = 0;
00016 int yout = 0;
00017  
00018  while (1) {
00019  
00020  double oldX = x;
00021     
00022     x = pow(x,2)-pow(y,2)+a*x+b*y;
00023     y = 2*oldX*y+c*oldX+d*y;
00024             
00025     xout = 210+(x*135);
00026     yout = 170+(y*105); 
00027    
00028     lcd.pixel(yout,xout,WHITE);
00029   
00030 }
00031 }