S
Si
I use the following method to rotate a point around the origin.
public void rotate(float a) {
a = (float)Math.toRadians((double)a);
float xtemp;
xtemp = (x * (float)Math.cos(a)) - (y * (float)Math.sin(a));
y = (x * (float)Math.sin(a)) + (y * (float)Math.cos(a));
x = xtemp;
}
However I want to rotate the point around a given pivot point e.g. 200,200.
I can't work out how to modify the above code so I can take in two x and y
co-ords to define the pivot point. Any ideas?
public void rotate(float a) {
a = (float)Math.toRadians((double)a);
float xtemp;
xtemp = (x * (float)Math.cos(a)) - (y * (float)Math.sin(a));
y = (x * (float)Math.sin(a)) + (y * (float)Math.cos(a));
x = xtemp;
}
However I want to rotate the point around a given pivot point e.g. 200,200.
I can't work out how to modify the above code so I can take in two x and y
co-ords to define the pivot point. Any ideas?