-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGrowGraph.pde
More file actions
49 lines (44 loc) · 945 Bytes
/
GrowGraph.pde
File metadata and controls
49 lines (44 loc) · 945 Bytes
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
import peasy.*;
import peasy.org.apache.commons.math.*;
import peasy.org.apache.commons.math.geometry.*;
import java.util.*;
PeasyCam cam;
Graph graph;
Crawler crawler;
boolean run = false;
String test = "108, 1, 6, 110, 2, 2, 15, 3, 6, 89, 4, 1, 54, 5, 7, 83, 6, 7, 26, 7, 5, 92, 8, 2, 67, 9, 5";
void setup()
{
size(640, 480, P3D);
colorMode(HSB);
cam = new PeasyCam(this, 100);
cam.setWheelScale(.1);
graph = new Graph();
graph.cube(10);
crawler = new Crawler(graph);
crawler.loadMachine(test);
}
void keyPressed()
{
if(key == ' ')
run = !run;
else if(key == 'c')
crawler.reinitialize(false);
else if(key == 'x')
crawler.reinitialize(true);
else if(key == 'p')
println(crawler.states);
}
void draw()
{
background(0);
graph.show();
stroke(0, 0, 255);
crawler.show();
if(run)//&& frameCount % 10 == 0)
crawler.update();
for(int i = 0; i < 32; i++)
{
graph.redistribute();
}
}