Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Incorrect rotation calculations
Replies: 1   Last Post: Jan 17, 2013 1:34 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View  
Roger Stafford

Posts: 5,867
Registered: 12/7/04
Re: Incorrect rotation calculations
Posted: Jan 17, 2013 1:34 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"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 radius-vector 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 radius-vector 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 y-axis toward the z-axis 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 y-axis, so after 45 degrees more it would rotate past the z-axis and produce a negative y. Were you expecting a rotation in the opposite direction? If so, your MX would be incorrect.

Roger Stafford



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.