Sha256: 97ed564f2e86bfd4dfd6af820a129d56bb15b69a038e3eafdbd19a45af331f89
Contents?: true
Size: 1.41 KB
Versions: 5
Compression:
Stored size: 1.41 KB
Contents
require File.join( File.dirname( __FILE__ ), 'tuio_point' ) class TuioContainer < TuioPoint attr_accessor :session_id, :x_pos, :y_pos, :x_speed, :y_speed, :motion_accel 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 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 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 def path @path end 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 def equal_to_local_args?(args) true end private def add_point_to_path( tuio_point ) @path ||= [] @path << tuio_point end end
Version data entries
5 entries across 5 versions & 2 rubygems