Kamil Ondrousek
/
Lozi
Lozi fractal map
main.cpp@0:c883783e1e12, 2010-12-25 (annotated)
- Committer:
- JLS
- Date:
- Sat Dec 25 14:02:33 2010 +0000
- Revision:
- 0:c883783e1e12
- Child:
- 1:89b1a06c1828
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
JLS | 0:c883783e1e12 | 1 | #include "TFT_4DGL.h" |
JLS | 0:c883783e1e12 | 2 | |
JLS | 0:c883783e1e12 | 3 | TFT_4DGL lcd(p9,p10,p11); |
JLS | 0:c883783e1e12 | 4 | |
JLS | 0:c883783e1e12 | 5 | int main() { |
JLS | 0:c883783e1e12 | 6 | |
JLS | 0:c883783e1e12 | 7 | float a = 1.7; |
JLS | 0:c883783e1e12 | 8 | float b = 0.5; |
JLS | 0:c883783e1e12 | 9 | |
JLS | 0:c883783e1e12 | 10 | float x = -0.1; |
JLS | 0:c883783e1e12 | 11 | float y = 0.1; |
JLS | 0:c883783e1e12 | 12 | |
JLS | 0:c883783e1e12 | 13 | int xout = 0; |
JLS | 0:c883783e1e12 | 14 | int yout = 0; |
JLS | 0:c883783e1e12 | 15 | |
JLS | 0:c883783e1e12 | 16 | lcd.baudrate(600000); |
JLS | 0:c883783e1e12 | 17 | |
JLS | 0:c883783e1e12 | 18 | while (1) { |
JLS | 0:c883783e1e12 | 19 | |
JLS | 0:c883783e1e12 | 20 | double oldX = x; |
JLS | 0:c883783e1e12 | 21 | |
JLS | 0:c883783e1e12 | 22 | x = 1-a*abs(oldX)+b*y; |
JLS | 0:c883783e1e12 | 23 | y = oldX; |
JLS | 0:c883783e1e12 | 24 | |
JLS | 0:c883783e1e12 | 25 | xout = 160+(x*100); |
JLS | 0:c883783e1e12 | 26 | yout = 120+(y*80); |
JLS | 0:c883783e1e12 | 27 | |
JLS | 0:c883783e1e12 | 28 | lcd.pixel(yout,xout,WHITE); |
JLS | 0:c883783e1e12 | 29 | |
JLS | 0:c883783e1e12 | 30 | } |
JLS | 0:c883783e1e12 | 31 | } |