How to rotate on given Coordinates

edited December 2014 in How To...

Dear Forum

How do i rotate on a given coordinate ?

I have a matrix which i translate to make it move. Now i wont to rotate it where my current finger on the matrix is. I use the Ketai Gestures Library

lpx and lpy are float vars and point to the last known finger.

void draw()
  //mousecheck, check 
  //Translate it so that i see the given cutting of the map
  translate(width/2 + tempx, height/2 + tempy);
  //Rotate, Angle <- Multitouch Rotation Ketai
  //Draw map, Size <- Multitouch two finger zoom
  shape(s, 10, 10, Size, Size);
  //Pop Matrix

Sorry for my English Thank you in Advance


  • You have to do two translations: one so that the position of the finger is the new origin, around which you do a rotation, then translate it back.

Sign In or Register to comment.