Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.



Re: Incorrect rotation calculations
Posted:
Jan 17, 2013 1:34 AM


"Eugene" wrote in message <kd7vof$gcu$1@newscl01ah.mathworks.com>... > % rotation angle > a = degtorad(45.0); > %rotation matrix (around X axis) > MX = [1.0 0.0 0.0; > 0.0 cos(a) sin(a); > 0.0 sin(a) cos(a)]; > %source point coords > x = 0.5 > y = 0.5 > z = 0.7071 > > % plot source point > plot3(x,y,z,':go');grid on; > hold on; > %plot radiusvector to source pt > line([0 x],[0 y],[0 z],'color','g'); > > % rotation > new_pt = MX * [x; y; z] > > % plot destination point > x = new_pt(1,1); y = new_pt(2,1); z = new_pt(3,1); > plot3(x, y, z,':ro'); > %plot radiusvector to destination pt > line([0 x],[0 y],[0 z],'color','r'); > > I have source point [0.5 0.5 0.7071], after rotation [0.5 0.1464 0.8535] > But it is incorrect answer! > It seems to me y value can't be negative and z also has invalid value. > What's wrong in my solution?          That rotation looks valid to me. You have rotated the point counterclockwise from the yaxis toward the zaxis by 45 degrees. The point (.5,.5,.7071) should end up at (.5,.1464,.8535) just where you have it. Why don't you think that is right? The original point was more than 45 degrees from the yaxis, so after 45 degrees more it would rotate past the zaxis and produce a negative y. Were you expecting a rotation in the opposite direction? If so, your MX would be incorrect.
Roger Stafford



