Parser error in Pointable.Bases: Write test and fix

This commit is contained in:
Sam Kass 2018-12-28 02:53:13 +01:00 committed by Ron Evans
parent 6f900a8dc2
commit 3bdb4d36a7
2 changed files with 11 additions and 1 deletions

View File

@ -93,4 +93,14 @@ func TestLeapMotionDriverParser(t *testing.T) {
gobottest.Assert(t, parsedFrame.Hands[0].X(), 247.410)
gobottest.Assert(t, parsedFrame.Hands[0].Y(), 275.868)
gobottest.Assert(t, parsedFrame.Hands[0].Z(), 132.843)
gobottest.Assert(t, parsedFrame.Pointables[0].BTipPosition[0], 214.293)
gobottest.Assert(t, parsedFrame.Pointables[0].BTipPosition[1], 213.865)
gobottest.Assert(t, parsedFrame.Pointables[0].BTipPosition[2], 95.0224)
gobottest.Assert(t, parsedFrame.Pointables[0].Bases[0][0][0], -0.468069)
gobottest.Assert(t, parsedFrame.Pointables[0].Bases[0][0][1], 0.807844)
gobottest.Assert(t, parsedFrame.Pointables[0].Bases[0][0][2], -0.358190)
gobottest.Assert(t, parsedFrame.Pointables[0].Width, 19.7871)
}

View File

@ -48,7 +48,7 @@ type Hand struct {
// Pointable is a Leap Motion pointing motion that has been detected
type Pointable struct {
Bases [][]float64 `json:"bases"`
Bases [][][]float64 `json:"bases"`
BTipPosition []float64 `json:"btipPosition"`
CarpPosition []float64 `json:"carpPosition"`
DipPosition []float64 `json:"dipPosition"`