We are about to switch to a new forum software. Until then we have removed the registration on this forum.
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()
{
background(128);
//PushMatrix
pushMatrix();
//mousecheck, check
mousecheck();
//Translate it so that i see the given cutting of the map
translate(width/2 + tempx, height/2 + tempy);
//Rotate, Angle <- Multitouch Rotation Ketai
rotate(Angle);
//Draw map, Size <- Multitouch two finger zoom
shape(s, 10, 10, Size, Size);
//Pop Matrix
popMatrix();
Sorry for my English Thank you in Advance
Answers
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.