Class: NumRu::DCLMousePt
- Inherits:
-
Object
- Object
- NumRu::DCLMousePt
- 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
-
#rx ⇒ Object
Returns the value of attribute rx.
-
#ry ⇒ Object
Returns the value of attribute ry.
-
#ux ⇒ Object
Returns the value of attribute ux.
-
#uy ⇒ Object
Returns the value of attribute uy.
-
#vx ⇒ Object
Returns the value of attribute vx.
-
#vy ⇒ Object
Returns the value of attribute vy.
-
#wx ⇒ Object
Returns the value of attribute wx.
-
#wy ⇒ Object
Returns the value of attribute wy.
Instance Method Summary collapse
-
#initialize ⇒ DCLMousePt
constructor
A new instance of DCLMousePt.
- #mark(type = 2, index = 1, size = 0.02) ⇒ Object
- #rxy ⇒ Object
- #uxy ⇒ Object
- #vxy ⇒ Object
Constructor Details
#initialize ⇒ DCLMousePt
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
#rx ⇒ Object
Returns the value of attribute rx.
26 27 28 |
# File 'lib/numru/dcl_mouse.rb', line 26 def rx @rx end |
#ry ⇒ Object
Returns the value of attribute ry.
26 27 28 |
# File 'lib/numru/dcl_mouse.rb', line 26 def ry @ry end |
#ux ⇒ Object
Returns the value of attribute ux.
26 27 28 |
# File 'lib/numru/dcl_mouse.rb', line 26 def ux @ux end |
#uy ⇒ Object
Returns the value of attribute uy.
26 27 28 |
# File 'lib/numru/dcl_mouse.rb', line 26 def uy @uy end |
#vx ⇒ Object
Returns the value of attribute vx.
26 27 28 |
# File 'lib/numru/dcl_mouse.rb', line 26 def vx @vx end |
#vy ⇒ Object
Returns the value of attribute vy.
26 27 28 |
# File 'lib/numru/dcl_mouse.rb', line 26 def vy @vy end |
#wx ⇒ Object
Returns the value of attribute wx.
26 27 28 |
# File 'lib/numru/dcl_mouse.rb', line 26 def wx @wx end |
#wy ⇒ Object
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 |
#rxy ⇒ Object
36 37 38 |
# File 'lib/numru/dcl_mouse.rb', line 36 def rxy [@rx, @ry] end |
#uxy ⇒ Object
28 29 30 |
# File 'lib/numru/dcl_mouse.rb', line 28 def uxy [@ux, @uy] end |
#vxy ⇒ Object
32 33 34 |
# File 'lib/numru/dcl_mouse.rb', line 32 def vxy [@vx, @vy] end |