-
Notifications
You must be signed in to change notification settings - Fork 0
/
frame_test.go
99 lines (96 loc) · 2.1 KB
/
frame_test.go
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
package leapmotion
import (
"encoding/json"
"testing"
)
func TestFrame(t *testing.T) {
frame := Frame{}
if err := json.Unmarshal(testFrame, &frame); err != nil {
t.Fatalf("Couln't unmarshal JSON to Frame: %v", err)
}
}
var testFrame = []byte(`
{
"id": 1,
"timestamp": 1,
"currentFrameRate": 100.0,
"r": [
[-1.0, 0, 1.0],
[-1.0, 0, 1.0],
[-1.0, 0, 1.0]
],
"s": -75.0,
"t": [-1.0, 0, 1.0],
"hands": [
{
"id": 100,
"direction": [-1.0, 0, 1.0],
"timeVisible": 1.0,
"palmNormal": [-1.0, 0, 1.0],
"palmPosition": [-1.0, 0, 1.0],
"palmVelocity": [-1.0, 0, 1.0],
"stabilizedPalmPosition": [-1.0, 0, 1.0],
"sphereCenter": [-1.0, 0, 1.0],
"sphereRadius": 50.0,
"r": [
[-1.0, 0, 1.0],
[-1.0, 0, 1.0],
[-1.0, 0, 1.0]
],
"s": 1.0,
"t": [-1.0, 0, 1.0]
},
{
"id": 200,
"direction": [-1.0, 0, 1.0],
"timeVisible": 1.0,
"palmNormal": [-1.0, 0, 1.0],
"palmPosition": [-1.0, 0, 1.0],
"palmVelocity": [-1.0, 0, 1.0],
"stabilizedPalmPosition": [-1.0, 0, 1.0],
"sphereCenter": [-1.0, 0, 1.0],
"sphereRadius": 50.0,
"r": [
[-1.0, 0, 1.0],
[-1.0, 0, 1.0],
[-1.0, 0, 1.0]
],
"s": 1.0,
"t": [-1.0, 0, 1.0]
}
],
"interactionBox": {
"center": [0, 200, 0],
"size": [221.418, 221.418, 154.742]
},
"pointables": [
{
"id": 300,
"handId": 100,
"length": 70.0,
"direction": [-1.0, 0, 1.0],
"timeVisible": 1.0,
"tipPosition": [-1.0, 0, 1.0],
"tipVelocity": [-1.0, 0, 1.0],
"stabilizedTipPosition": [-1.0, 0, 1.0],
"touchZone": "hovering",
"touchDistance": 0.5,
"tool": false
},
{
"id": 300,
"handId": 200,
"length": 70.0,
"direction": [-1.0, 0, 1.0],
"timeVisible": 1.0,
"tipPosition": [-1.0, 0, 1.0],
"tipVelocity": [-1.0, 0, 1.0],
"stabilizedTipPosition": [-1.0, 0, 1.0],
"touchZone": "hovering",
"touchDistance": 0.5,
"tool": false
}
],
"gestures": []
}
`)