Class: NumRu::DCLMousePt

Inherits:
Object
  • Object
show all
Defined in:
lib/numru/dcl_mouse.rb

Constant Summary collapse

@@t_thres =

threshold of time delay [in sec] to judge interaction

0.05

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDCLMousePt

Returns a new instance of DCLMousePt.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/numru/dcl_mouse.rb', line 7

def initialize
  ta = Time.now
  wx = wy = nil
  while(true)
    wx, wy, mb = DCL.swqpnt
    tb = Time.now
    if (tb-ta > @@t_thres)   # OK if it takes a short time 
      break 
    else     # Too fast. It must be due to previous clicks. Take one again.
      ta = tb
    end
  end
  @rx, @ry = NumRu::DCL.stiwtr(wx, wy)
  @vx, @vy = NumRu::DCL.stipr2(rx, ry) 
  @ux, @uy = NumRu::DCL.stitrf(vx, vy)
  @wx = wx
  @wy = wy
end

Instance Attribute Details

#rxObject

Returns the value of attribute rx.



26
27
28
# File 'lib/numru/dcl_mouse.rb', line 26

def rx
  @rx
end

#ryObject

Returns the value of attribute ry.



26
27
28
# File 'lib/numru/dcl_mouse.rb', line 26

def ry
  @ry
end

#uxObject

Returns the value of attribute ux.



26
27
28
# File 'lib/numru/dcl_mouse.rb', line 26

def ux
  @ux
end

#uyObject

Returns the value of attribute uy.



26
27
28
# File 'lib/numru/dcl_mouse.rb', line 26

def uy
  @uy
end

#vxObject

Returns the value of attribute vx.



26
27
28
# File 'lib/numru/dcl_mouse.rb', line 26

def vx
  @vx
end

#vyObject

Returns the value of attribute vy.



26
27
28
# File 'lib/numru/dcl_mouse.rb', line 26

def vy
  @vy
end

#wxObject

Returns the value of attribute wx.



26
27
28
# File 'lib/numru/dcl_mouse.rb', line 26

def wx
  @wx
end

#wyObject

Returns the value of attribute wy.



26
27
28
# File 'lib/numru/dcl_mouse.rb', line 26

def wy
  @wy
end

Instance Method Details

#mark(type = 2, index = 1, size = 0.02) ⇒ Object



40
41
42
# File 'lib/numru/dcl_mouse.rb', line 40

def mark(type=2,index=1,size=0.02)
  DCL.uumrkz([@ux], [@uy], type, index, size)
end

#rxyObject



36
37
38
# File 'lib/numru/dcl_mouse.rb', line 36

def rxy
  [@rx, @ry]
end

#uxyObject



28
29
30
# File 'lib/numru/dcl_mouse.rb', line 28

def uxy
  [@ux, @uy]
end

#vxyObject



32
33
34
# File 'lib/numru/dcl_mouse.rb', line 32

def vxy
  [@vx, @vy]
end