Rotating vector x around vector z

  • Thread starter ddr
  • Start date
  • #1
Is this how it should be done (rotating vector x around vector z for alpha degrees):
assumes |x|*|z|<>0
xonz=(scalar_product(z,x)/(|x|*|z|))*z;
y=x-xonz;
assumes |x|<>0
result=cos(alpha)*x+sin(aplha)*(|y|/|x|)*y;
 

Answers and Replies

  • #2
correction

actually y=croos_vector(z,(x-xonz))/|x-xonz|^2
 
  • #3
arcnets
508
0
Not quite. I should say:

answer = xonz + y cos [alpha] + z/|z| X y sin [alpha].

Where X means vector product. And y = x - xonz.

Note: There should be a simpler form to this. Try yourself, please!
 
Last edited:

Suggested for: Rotating vector x around vector z

  • Last Post
Replies
2
Views
694
Replies
7
Views
189
  • Last Post
Replies
1
Views
517
  • Last Post
Replies
0
Views
281
  • Last Post
Replies
3
Views
409
  • Last Post
Replies
1
Views
437
Replies
7
Views
270
Replies
8
Views
175
  • Last Post
Replies
4
Views
521
  • Last Post
Replies
10
Views
718
Top