-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontrol.java
More file actions
executable file
·81 lines (65 loc) · 1.62 KB
/
Copy pathcontrol.java
File metadata and controls
executable file
·81 lines (65 loc) · 1.62 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import processing.core.*;
import controlP5.*;
public class control extends PApplet{
ControlP5 cp5;
KnobMatrix xMatrix;
KnobMatrix yMatrix;
TaylorSeries2D x;
TaylorSeries2D y;
int n;
IntPair limits = new IntPair(-30, 30);
int frames;
public static void main(String[] args){
PApplet.main("control");
}
public void settings(){
size(1024, 768);
}
public void setup(){
background(0);
stroke(0, 255, 0);
n = 4;
frames = 0;
cp5 = new ControlP5(this);
xMatrix = new KnobMatrix(this.cp5, "x", n, 50, new PVector(0, 0));
yMatrix = new KnobMatrix(this.cp5, "y", n, 50, new PVector(400, 0));
x = new TaylorSeries2D(
//must be new array - if same array is passed to
//both, both coords will be the same
TaylorSeries2D.randomFloatArray(this, n, 1.0f), n);
y = new TaylorSeries2D(
TaylorSeries2D.randomFloatArray(this, n, 1.0f), n);
}
public void draw(){
background(0);
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++){
x.setConstant(i, j, xMatrix.getValue(i, j));
y.setConstant(i, j, yMatrix.getValue(i, j));
}
}
/*
if(frames%100 == 0){
x.printConstants();
System.out.println("X^");
y.printConstants();
System.out.println("Y^");
}
frames++;
*/
pushMatrix();
translate(this.width/2, this.height/2);
TaylorSeries2D.drawGrid(this, x, y, limits, limits, 25.0f);
popMatrix();
if(keyPressed){
if(key == '0'){
for(Knob k: cp5.getAll(Knob.class)){
k.setValue(0.0f);
}
}
if(key == 's'){
saveFrame("output-####.png");
}
}
}
}