algorithm - How to calculate (approximate) rotation of a list of (x, y) points -


i detecting multitouch gestures in xna app, such "panels" on screen can accept touch points within bounds, , move, scale or rotate according user fingers' movement.

however, since screen large multitouch screen 10s of touch points, panel can accept 5 (or more) fingers @ same time, , of stuff found online limited gestures using 2 touch points only.

i have handled move , scale gestures calculating center point touches on panel:

  1. calculate center point current touches (avg x, avg y)
  2. calculate center point previous timestamp touches (avg x, avg y)
  3. use difference move , scale panel.

but have no clue how approach rotation. there algorithm (approximate) rotation angle? should calculate angle between each point , center, , use delta value? there perhaps better approach?

how find 2 points largest distance , use those. makes intuitive sense me.

imagine rotating 1 hand spread , 5 fingers on screen, matters in case getting rotation between thumb , pinkie.

or consider 2 handed gesture 2 fingers each hand. again, method ignore rotations within single hand, capture wide sweep of each hand.

the way breaks doing rotation 2 fingers of 1 hand, , hand sitting idle on screen somewhere. rotation appear not work ( e.g. second hand pivoting, looking angle hand hand. )


Comments

Popular posts from this blog

IF statement in MySQL trigger -

c++ - What does MSC in "// appease MSC" comments mean? -

javascript - Blogger related post gadget image Resize s72-c [ Need Expert Help ] -