I have 2 unit vectors, o and v.
o is the orientation of a cylinder and v is a direction I wish to move inside this cylinder.
However, I want to allow v to only move perpendicular to the cylinder, so it cannot move along the axis defined as moving along o.
I've been banging my head together and trying various equations I can apply to v to get a vector that will move perpendicular to the cylinder in the direction of v, but not along that axis.
My current idea is to rotate o and v such that o points along one of the cardinal axes (I was thinking Z for visualization purposes) and then setting the Z component of v to 0, before rotating back, but there surely must be a more condensed way of doing this.
I think part of the problem is that I just cannot think of the correct search terms for this. Anybody got any ideas?
Thanks
$\frac{o\cdot v}{|o|}=|v|\cos(\theta)$ is the length of the component of $v$ that lies along $o$. Subtract that component from $v$ to get the perpendicular component. This is a part of what's known as the Gram-Schmidt orthogonalization process. So your formula for the perpendicular component is
$$v-\frac{o\cdot v}{|o|^2}o$$