Class: TuioObject

Inherits:
TuioContainer show all
Defined in:
lib/tuio-ruby/tuio_object.rb

Instance Attribute Summary collapse

Attributes inherited from TuioContainer

#motion_accel, #session_id, #x_pos, #x_speed, #y_pos, #y_speed

Attributes inherited from TuioPoint

#updated_at, #x_pos, #y_pos

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from TuioContainer

#equal_to_local_args?, #params_equal?, #path

Methods inherited from TuioPoint

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

Constructor Details

#initialize(session_id, fiducial_id, x_pos, y_pos, angle) ⇒ TuioObject

Returns a new instance of TuioObject.



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

def initialize( session_id, fiducial_id, x_pos,  y_pos, angle )
  super( session_id, x_pos, y_pos )
  
  @fiducial_id = fiducial_id
  @angle = angle
  
  @rotation_vector = 0.0
  @rotation_accel = 0.0
end

Instance Attribute Details

#angleObject (readonly)

Returns the value of attribute angle.



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

def angle
  @angle
end

#fiducial_idObject (readonly)

Returns the value of attribute fiducial_id.



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

def fiducial_id
  @fiducial_id
end

#rotation_accelObject (readonly)

Returns the value of attribute rotation_accel.



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

def rotation_accel
  @rotation_accel
end

#rotation_vectorObject (readonly)

Returns the value of attribute rotation_vector.



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

def rotation_vector
  @rotation_vector
end

Class Method Details

.from_params(params) ⇒ Object



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

def self.from_params( params )
  new(
    params.session_id,
    params.fiducial_id,
    params.x_pos,
    params.y_pos,
    params.angle
  )
end

Instance Method Details

#equal_to_local_params?(params) ⇒ Boolean

Returns:

  • (Boolean)


48
49
50
51
52
# File 'lib/tuio-ruby/tuio_object.rb', line 48

def equal_to_local_params?( params )
  fiducial_id == params.fiducial_id &&
  rotation_vector.approx_equal?( params.rotation_vector ) && 
  rotation_accel.approx_equal?( params.rotation_accel ) 
end

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



40
41
42
43
44
45
46
# File 'lib/tuio-ruby/tuio_object.rb', line 40

def update( x_pos, y_pos, angle, x_speed, y_speed, rotation_vector, motion_accel, rotation_accel )
  super( x_pos, y_pos, x_speed, y_speed, motion_accel )
  
  @angle = angle
  @rotation_vector = rotation_vector
  @rotation_accel = rotation_accel
end

#update_from_params(tuio_params) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/tuio-ruby/tuio_object.rb', line 27

def update_from_params( tuio_params ) 
  update(
    tuio_params.x_pos,
    tuio_params.y_pos,
    tuio_params.angle,
    tuio_params.x_speed,
    tuio_params.y_speed,
    tuio_params.rotation_vector,
    tuio_params.motion_accel,
    tuio_params.rotation_accel
  )
end