Axis Rotation to determine new points

49 Views Asked by At

I am looking at this answer . https://math.stackexchange.com/a/62248/474907, but the formula

c = cos(a); // compute trig. functions only once
s = sin(a);
xr = xt * c - yt * s;
yr = xt * s + yt * c;

differs from the wikipedia entry. So, I am a little confused, which one is correct.

$R_{z}(\theta )={\begin{bmatrix}\cos \theta &\sin \theta &0\\[3pt]-\sin \theta &\cos \theta &0\\[3pt]0&0&1\\\end{bmatrix}}$

https://en.wikipedia.org/wiki/Rotation_of_axes#Generalization_to_several_dimensions

EDIT:

AFter answer from @caverac

If not changing the axis $\vec{new} = R_{active} * \vec{old}$

$R_{z}(active)={\begin{bmatrix}\cos \theta &-\sin \theta &0\\[3pt]\sin \theta &\cos \theta &0\\[3pt]0&0&1\\\end{bmatrix}}$

If changing the axis $\vec{new} = R_{passive} * \vec{old}$

and

$R_{z}(passive)={\begin{bmatrix}\cos \theta &\sin \theta &0\\[3pt]-\sin \theta &\cos \theta &0\\[3pt]0&0&1\\\end{bmatrix}}$

The angle is just negated ( clockwise or counter-clockwise ). Is my understanding correct?

2

There are 2 best solutions below

3
On BEST ANSWER

That's the difference between an active and a passive transformation, in an active vectors are rotated, while in the passive the basis vectors are rotated

0
On

If you're referring to the sign difference, this seems to be the key sentence in the SE answer:

In 2D graphic libraries the x-axis goes to the right and the y-axis goes down

The wikipedia entry is based on the y-axis going up. The formula is slightly different depending on whether you consider the angle to be clockwise (as in the SE answer) or counter-clockwise (as in the wikipedia page).