# Rotate a vector about a plane's normal

Firstly, I apologize for the very vague title, but I really couldn't figure out how to word it better. I hope my explanation below is a bit more thorough.

Let there be two non-colinear but otherwise arbitrary unit vectors $$\vec v_1$$ and $$\vec v_2$$ in $$R^3$$. There will be a unique plane spanned by these two vectors which passes through the origin. Let the normal vector of this plane be $$\vec n$$.

Given a third unit vector $$\vec u_1$$ which is perpendicular to $$\vec v_1$$ (but not necessarily perpendicular to the plane), find the unit vector $$\vec u_2$$ which is perpendicular to $$\vec v_2$$ and is obtained by rotating $$\vec v_1$$ about the normal $$\vec n$$ by $$\theta$$ degrees, where $$\theta$$ is the angle between $$\vec v_1$$ and $$\vec v_2$$ plus the angle between $$\vec u_1$$ projected onto the plane onto the plane and $$\vec v_1$$ (the horizontal angle relative to the plane).

In other words, I would like to find the vector $$\vec u_2$$ which is "relative" to $$\vec v_2$$ the same amount $$\vec u_1$$ is "relative" to $$\vec v_1$$, relative to the plane which $$\vec v_1$$ and $$\vec v_2$$ span. If the vector $$\vec u_1$$ can be thought of as starting from the end of $$\vec v_1$$, then I would like $$\vec u_2$$ to point out in the same direction from the end of $$\vec v_2$$ and be orthogonal to it.

Another way of looking at the problem is that, in the basis formed by $$\vec v_1$$, $$\vec v_2$$ and $$\vec n$$, I would like to find $$\vec u_2$$ such that it is perpendicular to $$\vec v_2$$ and forms the same horizontal angle that $$\vec u_1$$ forms with $$\vec v_1$$.

As some background to further give insight, vector $$\vec v_1$$ represents a direction from point $$P_1$$ to the origin, and vector $$\vec v_2$$ represents a direction from point $$P_2$$ to the origin. If one were to orientate a camera so that it pointed in the direction of $$\vec v_1$$ and tilted it so that the top of its lense top pointed in the direction of $$\vec u_1$$, how could I move the camera to $$\vec v_2$$ along the plane so that it looked at the origin in the same orientation (relative to the plane) from $$P_2$$, and what would the new unit vector $$\vec u_2$$ from the top of its lense be?

tl; dr: Here's a formula (with no arrows over the vectors): $$u_{2} = (u_{1}\cdot v_{1}) v_{2} + [u_{1}\cdot (n \times v_{1})] (n \times v_{2}) + (u_{1}\cdot n) n.$$ Take care that we have $$v_{1}$$ in the dot products and $$v_{2}$$ outside.
Set $$n = \frac{v_{1} \times v_{2}}{|v_{1} \times v_{2}|}$$. The ordered triple $$(v_{1}, n \times v_{1}, n)$$ is a positively-oriented orthonormal basis. Decompose $$u_{1}$$ into components: \begin{align*} u_{1} &= av_{1} + b(n \times v_{1}) + cn \\ &= (u_{1}\cdot v_{1}) v_{1} + [u_{1}\cdot (n \times v_{1})] (n \times v_{1}) + (u_{1}\cdot n) n. \end{align*} (These formulas hold regardless of $$u_{1}$$. In your situation, $$a = 0$$ since $$v_{1} \perp u_{1}$$.) Since rotation about $$n$$ carries $$v_{1}$$ to $$v_{2}$$, it carries $$n \times v_{1}$$ to $$n \times v_{2}$$, and therefore carries $$u_{1}$$ to $$u_{2} = av_{2} + b(n \times v_{2}) + cn.$$ The formula at the top results from substituting the known values of $$a$$, $$b$$, and $$c$$.
• Assuming I've understood your intent, yes, the two questions appear to be "the same". (Given the edit here, however, I have nagging doubts that I've understood your intent. You do want to rotate $u_1$ about $n$ in a way that carries $v_1$ to $v_2$...? :) Aug 4, 2021 at 22:00
• Yes! That's exactly what I want. In the second question, my object is moving from one point to another i.e. it is being carried from $v_1$ to $v_2$, so its normal vector should follow suit. I guess I'll just see if someone else answers my less-wordy question but I think I'll mark your answer as correct! I'm amazed how simple it turned out haha, thank you! Aug 4, 2021 at 22:07