-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrossler.pde
51 lines (40 loc) · 877 Bytes
/
rossler.pde
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Resources
// https://en.wikipedia.org/wiki/Rössler_attractor
// http://www.lee-mac.com/attractors.html
// http://www.glensstuff.com/hyperrossler/hyperrossler.htm
import peasy.*;
// Constants
float a = 0.2, b = 0.2, c = 5.7;
// Initial values
float x = 0.1, y = 0, z = 0;
// Time
float dt = 0.05;
PeasyCam cam;
ArrayList<PVector> points;
void setup() {
frameRate(60);
size(800, 600, P3D);
colorMode(HSB);
background(0);
cam = new PeasyCam(this, 500);
points = new ArrayList<PVector>();
}
void draw() {
float dx = - y - z;
float dy = x + a * y;
float dz = b + z*(x - c);
x += dx * dt;
y += dy * dt;
z += dz * dt;
points.add(new PVector(x, y, z));
noFill();
background(0);
translate(0, 0, 0);
scale(5);
stroke(25, 255, 255);
beginShape();
for (PVector p : points) {
vertex(p.x, p.y, p.z);
}
endShape();
}