![](/media/cache/profiles/03492e99e42e7ea8480cdfb4899604f5.50x50_q85.jpg)
Burke-Shaw chaotic attractor
main.cpp@0:e7733dec1713, 2011-01-04 (annotated)
- Committer:
- JLS
- Date:
- Tue Jan 04 20:05:42 2011 +0000
- Revision:
- 0:e7733dec1713
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
JLS | 0:e7733dec1713 | 1 | #include "TFT_4DGL.h" |
JLS | 0:e7733dec1713 | 2 | |
JLS | 0:e7733dec1713 | 3 | TFT_4DGL lcd(p9,p10,p11); |
JLS | 0:e7733dec1713 | 4 | |
JLS | 0:e7733dec1713 | 5 | int main() { |
JLS | 0:e7733dec1713 | 6 | |
JLS | 0:e7733dec1713 | 7 | double x1,y1,z1,x,y,z,dt; |
JLS | 0:e7733dec1713 | 8 | int xp,yp; |
JLS | 0:e7733dec1713 | 9 | |
JLS | 0:e7733dec1713 | 10 | float u = 11; |
JLS | 0:e7733dec1713 | 11 | float v = 13; |
JLS | 0:e7733dec1713 | 12 | |
JLS | 0:e7733dec1713 | 13 | x1 = 0.6; |
JLS | 0:e7733dec1713 | 14 | y1 = 0; |
JLS | 0:e7733dec1713 | 15 | z1 = 0; |
JLS | 0:e7733dec1713 | 16 | |
JLS | 0:e7733dec1713 | 17 | dt = 0.002; |
JLS | 0:e7733dec1713 | 18 | |
JLS | 0:e7733dec1713 | 19 | while(1) |
JLS | 0:e7733dec1713 | 20 | |
JLS | 0:e7733dec1713 | 21 | { |
JLS | 0:e7733dec1713 | 22 | |
JLS | 0:e7733dec1713 | 23 | x = x1+(-u*x1-u*y1)*dt; |
JLS | 0:e7733dec1713 | 24 | y = y1+(-u*x1*z1-y1)*dt; |
JLS | 0:e7733dec1713 | 25 | z = z1+(u*x1*y1+v)*dt; |
JLS | 0:e7733dec1713 | 26 | |
JLS | 0:e7733dec1713 | 27 | xp = 160+(int)floor(35*x); |
JLS | 0:e7733dec1713 | 28 | yp = 120+(int)floor(14*y); |
JLS | 0:e7733dec1713 | 29 | |
JLS | 0:e7733dec1713 | 30 | lcd.pixel(yp,xp,WHITE); |
JLS | 0:e7733dec1713 | 31 | |
JLS | 0:e7733dec1713 | 32 | x1 = x; |
JLS | 0:e7733dec1713 | 33 | y1 = y; |
JLS | 0:e7733dec1713 | 34 | z1 = z; |
JLS | 0:e7733dec1713 | 35 | |
JLS | 0:e7733dec1713 | 36 | } |
JLS | 0:e7733dec1713 | 37 | |
JLS | 0:e7733dec1713 | 38 | } |