Class: TuioObject

Inherits:
Object show all
Includes:
TuioContainer
Defined in:
lib/tuio_object.rb

Instance Attribute Summary collapse

Attributes included from TuioContainer

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

Instance Method Summary collapse

Methods included from TuioContainer

#path

Constructor Details

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

Returns a new instance of TuioObject.



8
9
10
11
12
13
14
15
16
# File 'lib/tuio_object.rb', line 8

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_speed = 0.0
  @rotation_accel = 0.0
end

Instance Attribute Details

#angleObject (readonly)

Returns the value of attribute angle.



4
5
6
# File 'lib/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_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_object.rb', line 4

def rotation_accel
  @rotation_accel
end

#rotation_speedObject (readonly)

Returns the value of attribute rotation_speed.



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

def rotation_speed
  @rotation_speed
end

Instance Method Details

#args_equal?(args) ⇒ Boolean

Returns:

  • (Boolean)


26
27
28
29
30
31
# File 'lib/tuio_object.rb', line 26

def args_equal?( args )
  fiducial_id == args[1] &&
  rotation_speed.approx_equal?( args[7] ) && 
  rotation_accel.approx_equal?( args[9] ) &&
  super( args_to_container_from_object( args ) )
end

#inspectObject



46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/tuio_object.rb', line 46

def inspect
  puts "TuioObject:"
  puts "session_id >> #{session_id}"
  puts "fiducial_id >> #{fiducial_id}"
  puts "x_pos >> #{x_pos}"
  puts "y_pos >> #{y_pos}"
  puts "angle >> #{angle}"
  puts "x_speed >> #{x_speed}"
  puts "y_speed >> #{y_speed}"
  puts "rotation_speed >> #{rotation_speed}"
  puts "motion_accel >> #{motion_accel}"
  puts "rotation_accel >> #{rotation_accel}"
end

#to_argsObject



33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/tuio_object.rb', line 33

def to_args
  [ session_id,
    fiducial_id,
    x_pos,
    y_pos,
    angle,
    x_speed,
    y_speed,
    rotation_speed,
    motion_accel,
    rotation_accel]
end

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



18
19
20
21
22
23
24
# File 'lib/tuio_object.rb', line 18

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