Special Touch Detection on iphone

I asked myself if there are examples on the Internet that talk about how you can, for example, detect figures in sensory gestures.

for example, a rectangle or circle (or a more complex heart).

or determine the scroll speed (over time (for example, I scroll my iphone against 50 miles per hour))

+3
source share
2 answers

For very simple gestures (horizontal or vertical saber), calculate the difference between x and y between two touches.

dy = abs(y2 - y1)
dx = abs(x2 - x1)
f = dy/dx

f, , . f, 1, . f - ( , dx , x y).

, . :

l = sqrt(dx*dx + dy*dy)

t1 t2, :

tdiff = abs(t2 - t1)
s = l/tdiff

, , s .

, . /// / , .

, , . ,

  • pologyon,
  • .

.

+8

Source: https://habr.com/ru/post/1703114/


All Articles