Basin chaotic map - 640x480 vga
Dependencies: fastlib mbed vga640x480g
main.cpp@0:b4b0ac1d81a2, 2012-03-10 (annotated)
- Committer:
- JLS
- Date:
- Sat Mar 10 22:10:50 2012 +0000
- Revision:
- 0:b4b0ac1d81a2
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
JLS | 0:b4b0ac1d81a2 | 1 | #include "mbed.h" |
JLS | 0:b4b0ac1d81a2 | 2 | #include "vga640x480g.h" |
JLS | 0:b4b0ac1d81a2 | 3 | |
JLS | 0:b4b0ac1d81a2 | 4 | int main() { |
JLS | 0:b4b0ac1d81a2 | 5 | |
JLS | 0:b4b0ac1d81a2 | 6 | init_vga(); |
JLS | 0:b4b0ac1d81a2 | 7 | vga_cls(); |
JLS | 0:b4b0ac1d81a2 | 8 | vga_box(0,0,639,479,WHITE); |
JLS | 0:b4b0ac1d81a2 | 9 | vga_putstring(10,10,"Basin chaotic map",WHITE); |
JLS | 0:b4b0ac1d81a2 | 10 | |
JLS | 0:b4b0ac1d81a2 | 11 | float a = 0.4; |
JLS | 0:b4b0ac1d81a2 | 12 | float x = 0.1; |
JLS | 0:b4b0ac1d81a2 | 13 | float y = 0; |
JLS | 0:b4b0ac1d81a2 | 14 | |
JLS | 0:b4b0ac1d81a2 | 15 | while(1) { |
JLS | 0:b4b0ac1d81a2 | 16 | |
JLS | 0:b4b0ac1d81a2 | 17 | double nx = x; |
JLS | 0:b4b0ac1d81a2 | 18 | x = nx*y+a*nx-y; |
JLS | 0:b4b0ac1d81a2 | 19 | y = nx+y; |
JLS | 0:b4b0ac1d81a2 | 20 | |
JLS | 0:b4b0ac1d81a2 | 21 | vga_plot(271+(194*x),348+(168*y),WHITE); |
JLS | 0:b4b0ac1d81a2 | 22 | |
JLS | 0:b4b0ac1d81a2 | 23 | } |
JLS | 0:b4b0ac1d81a2 | 24 | |
JLS | 0:b4b0ac1d81a2 | 25 | } |