Module: TuioContainer
- Included in:
- TuioCursor, TuioObject
- Defined in:
- lib/tuio_container.rb
Instance Attribute Summary collapse
-
#motion_accel ⇒ Object
Returns the value of attribute motion_accel.
-
#session_id ⇒ Object
Returns the value of attribute session_id.
-
#x_pos ⇒ Object
Returns the value of attribute x_pos.
-
#x_speed ⇒ Object
Returns the value of attribute x_speed.
-
#y_pos ⇒ Object
Returns the value of attribute y_pos.
-
#y_speed ⇒ Object
Returns the value of attribute y_speed.
Instance Method Summary collapse
- #args_equal?(args) ⇒ Boolean
- #initialize(session_id, x_pos, y_pos) ⇒ Object
- #path ⇒ Object
- #update(x_pos, y_pos, x_speed, y_speed, motion_accel) ⇒ Object
Instance Attribute Details
#motion_accel ⇒ Object
Returns the value of attribute motion_accel.
4 5 6 |
# File 'lib/tuio_container.rb', line 4 def motion_accel @motion_accel end |
#session_id ⇒ Object
Returns the value of attribute session_id.
4 5 6 |
# File 'lib/tuio_container.rb', line 4 def session_id @session_id end |
#x_pos ⇒ Object
Returns the value of attribute x_pos.
4 5 6 |
# File 'lib/tuio_container.rb', line 4 def x_pos @x_pos end |
#x_speed ⇒ Object
Returns the value of attribute x_speed.
4 5 6 |
# File 'lib/tuio_container.rb', line 4 def x_speed @x_speed end |
#y_pos ⇒ Object
Returns the value of attribute y_pos.
4 5 6 |
# File 'lib/tuio_container.rb', line 4 def y_pos @y_pos end |
#y_speed ⇒ Object
Returns the value of attribute y_speed.
4 5 6 |
# File 'lib/tuio_container.rb', line 4 def y_speed @y_speed end |
Instance Method Details
#args_equal?(args) ⇒ Boolean
34 35 36 37 38 39 40 41 |
# File 'lib/tuio_container.rb', line 34 def args_equal?( args ) @session_id == args[0] && @x_pos.approx_equal?( args[1] ) && @y_pos.approx_equal?( args[2] ) && @x_speed.approx_equal?( args[3] ) && @y_speed.approx_equal?( args[4] ) && @motion_accel.approx_equal?( args[5] ) end |
#initialize(session_id, x_pos, y_pos) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/tuio_container.rb', line 7 def initialize( session_id, x_pos, y_pos ) @session_id = session_id @x_pos = x_pos @y_pos = y_pos @x_speed = 0.0 @y_speed = 0.0 @motion_accel = 0.0 add_point_to_path( TuioPoint.new( x_pos, y_pos ) ) end |
#path ⇒ Object
30 31 32 |
# File 'lib/tuio_container.rb', line 30 def path @path end |
#update(x_pos, y_pos, x_speed, y_speed, motion_accel) ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/tuio_container.rb', line 19 def update( x_pos, y_pos, x_speed, y_speed, motion_accel ) @x_pos = x_pos @y_pos = y_pos @x_speed = x_speed @y_speed = y_speed @motion_accel = motion_accel new_point = TuioPoint.new( x_pos, y_pos ) add_point_to_path( new_point ) unless new_point == @path.last end |