Kamil Ondrousek
/
Sinai
Sinai fractal map
main.cpp@1:6bf4edf04add, 2010-12-26 (annotated)
- Committer:
- JLS
- Date:
- Sun Dec 26 20:10:37 2010 +0000
- Revision:
- 1:6bf4edf04add
- Parent:
- 0:61b645447921
update
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
JLS | 0:61b645447921 | 1 | #include "TFT_4DGL.h" |
JLS | 0:61b645447921 | 2 | |
JLS | 0:61b645447921 | 3 | TFT_4DGL lcd(p9,p10,p11); |
JLS | 0:61b645447921 | 4 | |
JLS | 0:61b645447921 | 5 | int main() { |
JLS | 0:61b645447921 | 6 | |
JLS | 0:61b645447921 | 7 | float a = 0.1; |
JLS | 0:61b645447921 | 8 | |
JLS | 0:61b645447921 | 9 | float pi = 3.141592654; |
JLS | 0:61b645447921 | 10 | |
JLS | 0:61b645447921 | 11 | float x = 0.5; |
JLS | 0:61b645447921 | 12 | float y = 0.5; |
JLS | 0:61b645447921 | 13 | |
JLS | 0:61b645447921 | 14 | int xout = 0; |
JLS | 0:61b645447921 | 15 | int yout = 0; |
JLS | 0:61b645447921 | 16 | |
JLS | 0:61b645447921 | 17 | while (1) { |
JLS | 0:61b645447921 | 18 | |
JLS | 0:61b645447921 | 19 | double oldX = x; |
JLS | 0:61b645447921 | 20 | |
JLS | 0:61b645447921 | 21 | x = fmod(oldX+y+a*cos(2*pi*y),1); |
JLS | 0:61b645447921 | 22 | y = fmod(oldX+2*y,1); |
JLS | 0:61b645447921 | 23 | |
JLS | 0:61b645447921 | 24 | xout = (x*320); |
JLS | 0:61b645447921 | 25 | yout = (y*240); |
JLS | 0:61b645447921 | 26 | |
JLS | 0:61b645447921 | 27 | lcd.pixel(yout,xout,WHITE); |
JLS | 0:61b645447921 | 28 | |
JLS | 0:61b645447921 | 29 | } |
JLS | 0:61b645447921 | 30 | } |