Kamil Ondrousek
/
HyperRossler
4D hyperchaotic rossler attractor
main.cpp@0:276aaf2f7d38, 2011-04-04 (annotated)
- Committer:
- JLS
- Date:
- Mon Apr 04 16:14:50 2011 +0000
- Revision:
- 0:276aaf2f7d38
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
JLS | 0:276aaf2f7d38 | 1 | #include "TFT_4DGL.h" |
JLS | 0:276aaf2f7d38 | 2 | |
JLS | 0:276aaf2f7d38 | 3 | TFT_4DGL lcd(p9,p10,p11); |
JLS | 0:276aaf2f7d38 | 4 | |
JLS | 0:276aaf2f7d38 | 5 | int main() { |
JLS | 0:276aaf2f7d38 | 6 | |
JLS | 0:276aaf2f7d38 | 7 | int xp,yp; |
JLS | 0:276aaf2f7d38 | 8 | |
JLS | 0:276aaf2f7d38 | 9 | int n = WHITE; |
JLS | 0:276aaf2f7d38 | 10 | |
JLS | 0:276aaf2f7d38 | 11 | float x,y,z,w; |
JLS | 0:276aaf2f7d38 | 12 | |
JLS | 0:276aaf2f7d38 | 13 | float a = 0.25; |
JLS | 0:276aaf2f7d38 | 14 | float b = 3; |
JLS | 0:276aaf2f7d38 | 15 | float c = 0.5; |
JLS | 0:276aaf2f7d38 | 16 | float d = 0.05; |
JLS | 0:276aaf2f7d38 | 17 | |
JLS | 0:276aaf2f7d38 | 18 | float dt = 0.005; |
JLS | 0:276aaf2f7d38 | 19 | |
JLS | 0:276aaf2f7d38 | 20 | float x1 = -10; |
JLS | 0:276aaf2f7d38 | 21 | float y1 = -6; |
JLS | 0:276aaf2f7d38 | 22 | float z1 = 0.1; |
JLS | 0:276aaf2f7d38 | 23 | float w1 = 10; |
JLS | 0:276aaf2f7d38 | 24 | |
JLS | 0:276aaf2f7d38 | 25 | x = x1; |
JLS | 0:276aaf2f7d38 | 26 | y = y1; |
JLS | 0:276aaf2f7d38 | 27 | z = z1; |
JLS | 0:276aaf2f7d38 | 28 | w = w1; |
JLS | 0:276aaf2f7d38 | 29 | |
JLS | 0:276aaf2f7d38 | 30 | while(1) |
JLS | 0:276aaf2f7d38 | 31 | |
JLS | 0:276aaf2f7d38 | 32 | { |
JLS | 0:276aaf2f7d38 | 33 | |
JLS | 0:276aaf2f7d38 | 34 | x = x1+(-y1-z1)*dt; |
JLS | 0:276aaf2f7d38 | 35 | y = y1+(x1+(a*y1)+w1)*dt; |
JLS | 0:276aaf2f7d38 | 36 | z = z1+(b+(x1*z1))*dt; |
JLS | 0:276aaf2f7d38 | 37 | w = w1+(-(c*z1)+(d*w1))*dt; |
JLS | 0:276aaf2f7d38 | 38 | |
JLS | 0:276aaf2f7d38 | 39 | xp = (int)floor(3*x); |
JLS | 0:276aaf2f7d38 | 40 | yp = (int)floor(2*y); |
JLS | 0:276aaf2f7d38 | 41 | |
JLS | 0:276aaf2f7d38 | 42 | lcd.pixel(135+yp,260+xp,n); |
JLS | 0:276aaf2f7d38 | 43 | |
JLS | 0:276aaf2f7d38 | 44 | x1 = x; |
JLS | 0:276aaf2f7d38 | 45 | y1 = y; |
JLS | 0:276aaf2f7d38 | 46 | z1 = z; |
JLS | 0:276aaf2f7d38 | 47 | w1 = w; |
JLS | 0:276aaf2f7d38 | 48 | |
JLS | 0:276aaf2f7d38 | 49 | } |
JLS | 0:276aaf2f7d38 | 50 | |
JLS | 0:276aaf2f7d38 | 51 | } |