Class: TuioContainer

Inherits:
TuioPoint show all
Defined in:
lib/tuio-ruby/tuio_container.rb

Direct Known Subclasses

TuioCursor, TuioObject

Instance Attribute Summary collapse

Attributes inherited from TuioPoint

#updated_at

Instance Method Summary collapse

Methods inherited from TuioPoint

#degrees_to, #distance_to, #eql?, #radians_to

Constructor Details

#initialize(session_id, x_pos, y_pos) ⇒ TuioContainer

Returns a new instance of TuioContainer.



7
8
9
10
11
12
13
14
15
16
# File 'lib/tuio-ruby/tuio_container.rb', line 7

def initialize( session_id, x_pos, y_pos )
  super( x_pos, y_pos )

  @session_id = session_id
  @x_speed = 0.0
  @y_speed = 0.0
  @motion_accel = 0.0
  
  add_point_to_path( TuioPoint.new( x_pos, y_pos ) )
end

Instance Attribute Details

#motion_accelObject

Returns the value of attribute motion_accel.



4
5
6
# File 'lib/tuio-ruby/tuio_container.rb', line 4

def motion_accel
  @motion_accel
end

#session_idObject

Returns the value of attribute session_id.



4
5
6
# File 'lib/tuio-ruby/tuio_container.rb', line 4

def session_id
  @session_id
end

#x_posObject

Returns the value of attribute x_pos.



4
5
6
# File 'lib/tuio-ruby/tuio_container.rb', line 4

def x_pos
  @x_pos
end

#x_speedObject

Returns the value of attribute x_speed.



4
5
6
# File 'lib/tuio-ruby/tuio_container.rb', line 4

def x_speed
  @x_speed
end

#y_posObject

Returns the value of attribute y_pos.



4
5
6
# File 'lib/tuio-ruby/tuio_container.rb', line 4

def y_pos
  @y_pos
end

#y_speedObject

Returns the value of attribute y_speed.



4
5
6
# File 'lib/tuio-ruby/tuio_container.rb', line 4

def y_speed
  @y_speed
end

Instance Method Details

#equal_to_local_args?(args) ⇒ Boolean

Returns:

  • (Boolean)


52
53
54
# File 'lib/tuio-ruby/tuio_container.rb', line 52

def equal_to_local_args?(args)
  true
end

#params_equal?(params) ⇒ Boolean

Returns:

  • (Boolean)


42
43
44
45
46
47
48
49
50
# File 'lib/tuio-ruby/tuio_container.rb', line 42

def params_equal?( params )
  @session_id == params.session_id &&
  @x_pos.approx_equal?( params.x_pos ) &&
  @y_pos.approx_equal?( params.y_pos ) &&
  @x_speed.approx_equal?( params.x_speed ) &&
  @y_speed.approx_equal?( params.y_speed ) &&
  @motion_accel.approx_equal?( params.motion_accel ) && 
  equal_to_local_params?( params )
end

#pathObject



37
38
39
# File 'lib/tuio-ruby/tuio_container.rb', line 37

def path
  @path 
end

#update(x_pos, y_pos, x_speed, y_speed, motion_accel) ⇒ Object



18
19
20
21
22
23
24
25
26
27
# File 'lib/tuio-ruby/tuio_container.rb', line 18

def update( x_pos, y_pos, x_speed, y_speed, motion_accel )  
  super( x_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

#update_from_params(params) ⇒ Object



29
30
31
32
33
34
35
# File 'lib/tuio-ruby/tuio_container.rb', line 29

def update_from_params( params )
  @x_pos = params.x_pos
  @y_pos = params.y_pos
  @x_speed = params.x_speed
  @y_speed = params.y_speed
  @motion_accel = params.motion_accel
end