-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmarker.pde
70 lines (57 loc) · 1.3 KB
/
marker.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// callbacks for when objects are added, updated or removed
void addTuioObject(TuioObject o) {
println(
"add obj",
o.getSymbolID(),
"(" + o.getSessionID() + ")",
o.getX(),
o.getY(),
o.getAngle()
);
}
void updateTuioObject (TuioObject o) {
println(
"set obj ",
o.getSymbolID(),
"(" + o.getSessionID() + ")",
o.getX(),
o.getY(),
o.getAngle(),
o.getMotionSpeed(),
o.getRotationSpeed(),
o.getMotionAccel(),
o.getRotationAccel()
);
}
void removeTuioObject(TuioObject o) {
println(
"del obj ",
o.getSymbolID(),
"(" + o.getSessionID() + ")"
);
}
void drawObjects() {
for (TuioObject o : tuioClient.getTuioObjectList()) {
// get location and rotation
int w = o.getScreenX(width);
int h = o.getScreenY(height);
float ang = o.getAngle();
float d = 60;
stroke(255, 0, 0);
fill(255, 200, 200, 200);
// rectangle, representing the fiducial
pushMatrix();
translate(w, h);
rotate(ang);
rect(-d/2, -d/2, d, d);
// triangle, representing the upwards direction
fill(255, 200, 200, 100);
stroke(255, 0, 0, 100);
triangle(-d/2, -d/2, 0, -d, d/2, -d/2);
popMatrix();
// draw label on top
int id = o.getSymbolID();
fill(0);
text(id, w, h);
}
}