Kamil Ondrousek
/
ACT
ACT attractor
main.cpp@0:1c4e0927d6e3, 2011-01-01 (annotated)
- Committer:
- JLS
- Date:
- Sat Jan 01 12:47:14 2011 +0000
- Revision:
- 0:1c4e0927d6e3
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
JLS | 0:1c4e0927d6e3 | 1 | #include "TFT_4DGL.h" |
JLS | 0:1c4e0927d6e3 | 2 | |
JLS | 0:1c4e0927d6e3 | 3 | TFT_4DGL lcd(p9,p10,p11); |
JLS | 0:1c4e0927d6e3 | 4 | |
JLS | 0:1c4e0927d6e3 | 5 | int main() { |
JLS | 0:1c4e0927d6e3 | 6 | |
JLS | 0:1c4e0927d6e3 | 7 | double x1,y1,z1,x,y,z,t,dt; |
JLS | 0:1c4e0927d6e3 | 8 | int xp,yp; |
JLS | 0:1c4e0927d6e3 | 9 | |
JLS | 0:1c4e0927d6e3 | 10 | float a = 1.8; |
JLS | 0:1c4e0927d6e3 | 11 | float b = -0.07; |
JLS | 0:1c4e0927d6e3 | 12 | float d = 1.5; |
JLS | 0:1c4e0927d6e3 | 13 | float m = 0.02; |
JLS | 0:1c4e0927d6e3 | 14 | |
JLS | 0:1c4e0927d6e3 | 15 | x1 = 0.5; |
JLS | 0:1c4e0927d6e3 | 16 | y1 = 0; |
JLS | 0:1c4e0927d6e3 | 17 | z1 = 0; |
JLS | 0:1c4e0927d6e3 | 18 | |
JLS | 0:1c4e0927d6e3 | 19 | dt = 0.005; |
JLS | 0:1c4e0927d6e3 | 20 | |
JLS | 0:1c4e0927d6e3 | 21 | while(1) |
JLS | 0:1c4e0927d6e3 | 22 | |
JLS | 0:1c4e0927d6e3 | 23 | { |
JLS | 0:1c4e0927d6e3 | 24 | |
JLS | 0:1c4e0927d6e3 | 25 | x = x1+(x1-y1)*dt; |
JLS | 0:1c4e0927d6e3 | 26 | y = y1+(-4*a*y1+x1*z1+m*pow(x1,3))*dt; |
JLS | 0:1c4e0927d6e3 | 27 | z = z1+(-d*a*z1+x1*y1+b*pow(z1,2))*dt; |
JLS | 0:1c4e0927d6e3 | 28 | t = t+dt; |
JLS | 0:1c4e0927d6e3 | 29 | |
JLS | 0:1c4e0927d6e3 | 30 | xp = 10+(int)floor(33*x); |
JLS | 0:1c4e0927d6e3 | 31 | yp = 10+(int)floor(10*y); |
JLS | 0:1c4e0927d6e3 | 32 | |
JLS | 0:1c4e0927d6e3 | 33 | lcd.pixel(yp,xp,WHITE); |
JLS | 0:1c4e0927d6e3 | 34 | |
JLS | 0:1c4e0927d6e3 | 35 | x1 = x; |
JLS | 0:1c4e0927d6e3 | 36 | y1 = y; |
JLS | 0:1c4e0927d6e3 | 37 | z1 = z; |
JLS | 0:1c4e0927d6e3 | 38 | |
JLS | 0:1c4e0927d6e3 | 39 | } |
JLS | 0:1c4e0927d6e3 | 40 | |
JLS | 0:1c4e0927d6e3 | 41 | } |