Quantcast rotating vector x around vector z Text - Physics Forums Library

PDA

View Full Version : rotating vector x around vector z


ddr
Aug12-03, 04:56 AM
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;

ddr
Aug12-03, 09:50 AM
actually y=croos_vector(z,(x-xonz))/|x-xonz|^2

arcnets
Aug12-03, 05:01 PM
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!