Getting a vector given an angle and bearing from another vector

Hey folks

I’ve got a math problem that I thought should be simple but I’m struggling with.

What I have is a normal Vector3 (Vec31) and I am trying to calculate another normal Vector3 (Vec32).

I know the angle between the two vectors (Theta1) and the bearing of Vec32 around Vec31 (Theta2).

Apologies for the shoddy diagram:

alt text

Is there a formula that will give me Vec32? I feel like there should be an inverse of the dot-product or something.


To answer my own question: I had to play with Quaternions to rotate my original vector:

		// We make a quaternion that faces the original vector
		Quaternion rotation = Quaternion.LookRotation(vec31, Vector3.up);
		// And a quaternion for our rotations
		Quaternion offsetZ = Quaternion.Euler(0.0f, 0.0f, Mathf.Rad2Deg * theta2);
		Quaternion offsetX = Quaternion.Euler(Mathf.Rad2Deg * theta1, 0.0f, 0.0f);
		rotation *= offsetZ;
		rotation *= offsetX;
		// Finally we return the new face direction of the new quaternion
		return rotation * (Vector3.forward * vec31.magnitude);