# Thread: Rotate a direction vector around pitch/yaw

1. ## Rotate 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  2. Originally Posted by Devils Child 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 To distinguish between yaw and pitch you need to know which way is "up" which means you need another vector. Vectors, vectors, vectors... And you DON'T want to use matrices? 3. 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? 4. 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. 5. 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... 6. 7. 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 ;( 8. some complex mathematic constructs
If you don't like math then don't attempt 3D graphics or raytracers. If you can read the formulas then stop complaining and figure it out. 9. 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 10. 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)```
that's what i really needed. Popular pages Recent additions 