Kamil Ondrousek
/
Rikitake
Rikitake chaotic system
main.cpp@0:0e1b2bdda33f, 2011-03-02 (annotated)
- Committer:
- JLS
- Date:
- Wed Mar 02 18:27:55 2011 +0000
- Revision:
- 0:0e1b2bdda33f
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
JLS | 0:0e1b2bdda33f | 1 | #include "TFT_4DGL.h" |
JLS | 0:0e1b2bdda33f | 2 | |
JLS | 0:0e1b2bdda33f | 3 | TFT_4DGL lcd(p9,p10,p11); |
JLS | 0:0e1b2bdda33f | 4 | |
JLS | 0:0e1b2bdda33f | 5 | int main() { |
JLS | 0:0e1b2bdda33f | 6 | |
JLS | 0:0e1b2bdda33f | 7 | int xp,yp; |
JLS | 0:0e1b2bdda33f | 8 | |
JLS | 0:0e1b2bdda33f | 9 | int n = WHITE; |
JLS | 0:0e1b2bdda33f | 10 | |
JLS | 0:0e1b2bdda33f | 11 | float x,y,z; |
JLS | 0:0e1b2bdda33f | 12 | |
JLS | 0:0e1b2bdda33f | 13 | float a = 2; |
JLS | 0:0e1b2bdda33f | 14 | float s = 10; |
JLS | 0:0e1b2bdda33f | 15 | float u = 2.1; |
JLS | 0:0e1b2bdda33f | 16 | |
JLS | 0:0e1b2bdda33f | 17 | float dt = 0.005; |
JLS | 0:0e1b2bdda33f | 18 | |
JLS | 0:0e1b2bdda33f | 19 | float x1 = 0.1; |
JLS | 0:0e1b2bdda33f | 20 | float y1 = 0.1; |
JLS | 0:0e1b2bdda33f | 21 | float z1 = 0.1; |
JLS | 0:0e1b2bdda33f | 22 | |
JLS | 0:0e1b2bdda33f | 23 | x = x1; |
JLS | 0:0e1b2bdda33f | 24 | y = y1; |
JLS | 0:0e1b2bdda33f | 25 | z = z1; |
JLS | 0:0e1b2bdda33f | 26 | |
JLS | 0:0e1b2bdda33f | 27 | while(1) |
JLS | 0:0e1b2bdda33f | 28 | |
JLS | 0:0e1b2bdda33f | 29 | { |
JLS | 0:0e1b2bdda33f | 30 | |
JLS | 0:0e1b2bdda33f | 31 | x = x1+(-u*x1+s*y1*z1)*dt; |
JLS | 0:0e1b2bdda33f | 32 | y = y1+(-u*y1+(s*z1-a)*x1)*dt; |
JLS | 0:0e1b2bdda33f | 33 | z = z1+(1-s*x1*y1)*dt; |
JLS | 0:0e1b2bdda33f | 34 | |
JLS | 0:0e1b2bdda33f | 35 | xp = (int)floor(x*85); |
JLS | 0:0e1b2bdda33f | 36 | yp = (int)floor(y*75); |
JLS | 0:0e1b2bdda33f | 37 | |
JLS | 0:0e1b2bdda33f | 38 | lcd.pixel(120+yp,160+xp,n); |
JLS | 0:0e1b2bdda33f | 39 | |
JLS | 0:0e1b2bdda33f | 40 | x1 = x; |
JLS | 0:0e1b2bdda33f | 41 | y1 = y; |
JLS | 0:0e1b2bdda33f | 42 | z1 = z; |
JLS | 0:0e1b2bdda33f | 43 | |
JLS | 0:0e1b2bdda33f | 44 | } |
JLS | 0:0e1b2bdda33f | 45 | |
JLS | 0:0e1b2bdda33f | 46 | } |