-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSpline.pde
31 lines (31 loc) · 1004 Bytes
/
Spline.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
public class Spline {
private boolean state;
int outNodeID, outNodeSocketID;
public Spline(int outNodeID, int outNodeSocketID, boolean state) {
this.state = state;
this.outNodeID = outNodeID;
this.outNodeSocketID = outNodeSocketID;
}
public boolean getState() {
return state;
}
public boolean calcState() {
this.state = nodes.get(outNodeID).getOutput(outNodeSocketID); //<>//
return this.state;
}
public boolean recCalcState() {
this.state = nodes.get(outNodeID).recOutput(outNodeSocketID);
return this.state;
}
public void display(int x, int y) {
if(this.state) stroke(SPLINE_ELECTRICITY_COLOR);
else stroke(NODE_STROKE_COLOR);
strokeWeight(SPLINE_THICKNESS);
Circuit n = nodes.get(outNodeID);
int l = SPLINE_NOODLENESS;
noFill();
bezier(x, y,x-l, y, n.x+n.w+l, n.y+n.outputOffset*(this.outNodeSocketID+1), n.x+n.w, n.y+n.outputOffset*(this.outNodeSocketID+1));
stroke(NODE_STROKE_COLOR);
strokeWeight(1);
}
}