I am trying to apply the rotation matrix about the z-axis (altitude or north) correctly, and want to do a sanity check to make sure I understand it.

My goal at the end of this, is to take a local point (x, y, z) and transform it to "north local point" (a point with respect to north), call it (east, north, up).

I used the the rotation across z-axis "Rz" matrix from, where z appears to be altitude or north (axis out of the page).

Rotation matrix - Wikipedia, the free encyclopedia

Code:

theta = 0
%from wiki:
rotation_matrix_to_north = [cosd(theta) -sind(theta) 0; sind(theta) cosd(theta) 0; 0 0 1]
%take a sample point on the earth, call it local point
xg = 1; yg = 1; zg = 1;
local_point = [xg; yg; zg]
%now transform that local point with respect to north via the rotation matrix
north_point = rotation_matrix_to_north * local_point

However, when I rotate with a theta of 180, my rotation_matrix_to_north equals

-1 0 0

0 -1 0

0 0 1

And my north_point after the rotation equals

-1

-1

1

My input or local_point =

1

1

1

I don't think this makes sense, since I would only expect the zg to be altered; looks like that was the only thing that was not altered.

Or, maybe it's not supposed to change, since I'm just facing 180 degrees prior to where I was facing, but my vector from my local point to north is still the same, and maybe my x and y only have to change since I now need to "face north"?

Can someone confirm my understanding...Thanks.