Class: Artoo::Drivers::Leapmotion::Frame

Inherits:
Object
  • Object
show all
Defined in:
lib/artoo/drivers/leapmotion/frame.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(frame) ⇒ Frame

Public: initialize

frame - params

Returns nil



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/artoo/drivers/leapmotion/frame.rb', line 17

def initialize(frame)
  @id = frame["id"]
  @timestamp = frame["timestamp"]
  @raw = frame

  @hands = Artoo::Drivers::Leapmotion::Hand.list(frame)
  @gestures = Artoo::Drivers::Leapmotion::Gesture.list(frame)
  @pointables = Artoo::Drivers::Leapmotion::Pointable.list(frame)

  @rotation = {
    axis: frame['r'][0],
    angle: frame['r'][1],
    matrix: frame['r'][2]
  }

  @scale_factor = frame["s"]
  @translation = frame["t"]
end

Instance Attribute Details

#gesturesObject (readonly)

Returns the value of attribute gestures.



9
10
11
# File 'lib/artoo/drivers/leapmotion/frame.rb', line 9

def gestures
  @gestures
end

#handsObject (readonly)

Returns the value of attribute hands.



9
10
11
# File 'lib/artoo/drivers/leapmotion/frame.rb', line 9

def hands
  @hands
end

#idObject (readonly)

Returns the value of attribute id.



9
10
11
# File 'lib/artoo/drivers/leapmotion/frame.rb', line 9

def id
  @id
end

#pointablesObject (readonly)

Returns the value of attribute pointables.



9
10
11
# File 'lib/artoo/drivers/leapmotion/frame.rb', line 9

def pointables
  @pointables
end

#rawObject (readonly)

Returns the value of attribute raw.



9
10
11
# File 'lib/artoo/drivers/leapmotion/frame.rb', line 9

def raw
  @raw
end

#rotationObject (readonly)

Returns the value of attribute rotation.



9
10
11
# File 'lib/artoo/drivers/leapmotion/frame.rb', line 9

def rotation
  @rotation
end

#scale_factorObject (readonly)

Returns the value of attribute scale_factor.



9
10
11
# File 'lib/artoo/drivers/leapmotion/frame.rb', line 9

def scale_factor
  @scale_factor
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



9
10
11
# File 'lib/artoo/drivers/leapmotion/frame.rb', line 9

def timestamp
  @timestamp
end

#translationObject (readonly)

Returns the value of attribute translation.



9
10
11
# File 'lib/artoo/drivers/leapmotion/frame.rb', line 9

def translation
  @translation
end