hi!

let's say i have a vector pointing into a direction. i want to rotate the vector arount some yaw/pitch to make it point into another direction.

how can i do this without having to implement a matrix system into my project?

thanks in advance :)

Printable View

- 08-04-2009Devils ChildRotate a direction vector around pitch/yaw
hi!

let's say i have a vector pointing into a direction. i want to rotate the vector arount some yaw/pitch to make it point into another direction.

how can i do this without having to implement a matrix system into my project?

thanks in advance :) - 08-04-2009brewbuck
- 08-04-2009Devils Child
no. since in my raytracer (c#) the only place for the use of matrices would be this:

i send a ray for each pixel on the screen. but the camera can be rotated, so i need this ray of the pixel to rotate with the camera, know what i mean? - 08-04-2009VirtualAce
Axis-angle rotation would work for this. Just because your system does not currently use matrices does not mean you will not need them for basic 3D operations.

- 08-05-2009Devils Child
well, do you have an algorithm (code) for that? something with sines and cosines should do the trick but i just don't get it...

- 08-05-2009Shakti
Google is your friend: rotate vector around vector - Google Search

- 08-05-2009Devils Child
call me stupid but i either find 2D stuff, some complex mathematic constructs or porn, but not what i'm looking for.

i just neet this damn formula ;( - 08-05-2009VirtualAceQuote:

some complex mathematic constructs

- 08-06-2009Devils Child
don't attempt raytracers?

this is a pic of my raytracer yet: http://www.dev-ch.de/upload/files/De.../Screen329.png

regarding this picture, i'm not stupid, heh :P - 08-07-2009Devils Child
ALRIGHT, i bothered my brother until he gave me this:

Code:`nx * cos(yaw) + (ny * sin(pitch) + nz * cos(pitch)) * sin(yaw)`

ny * cos(pitch) - nz * sin(pitch)

-nx * sin(yaw) + (ny * sin(pitch) + nz * cos(pitch)) * cos(yaw)