I've written iPhone - Mac, Client - Server app that allows to use mouse via touchpad.
Now on every packet sent I move cursor by pecific amount of pixels (now 10px). It isn't accurate. When i change sensitivity to 1px it's to slow.
I am wondering how to enhance usability and simulate mouse acceleration.
Any ideas?
I suggest the following procedure:
ON THE IPHONE:
x
andy
direction, let's name thisdx
anddy
.dr = sqrt(dx^2+dy^2)
.v = dr/dt
.v_new = a * v + b * v^2
(start witha=1
andb=0
for no acceleration, and then experiment for optimal values)dr_new = v_new * dt
.x
/y
direction:dx_new = dx * dr_new / dr
anddy_new = dy * dr_new / dr
.dx_new
anddy_new
to the Mac.ON THE MAC:
dx_new
anddy_new
pixels inx
/y
direction.NOTE: This might jitter a lot, you can try averaging the velocity after step (3) with the previous two or three measured velocities if it jitters to much.