I have a question that's probably very simple to a mathematician, but my college days are now far behind me and I'm not sure exactly how to implement this.
I'm writing a Java application for the Leap Motion controller. It's an IR sensor that lays on a table and illuminates an area above it. You can stick your hand out in this space and it uses time of flight algorithms to detect the location of your hands and fingers. Here is an image representing the field of view as it lay flat on a table:
The sensor will return simple vector (x, y, and z floats) for a given point that it detects. I need to prop the back of the sensor up a little, so the sensor won't be pointing straight up, but at and angle toward the user. What I need is an algorithm that takes the original vector plus the tilt angle of the sensor in radians, and return a new vector to accurately represent the position. I'm assuming this should be as simple as applying a sine or cosine to each of the variables? Can anybody provide any advice for me?
A possible solution to your question may be the rotation matrix.
You have said that the sensor will take "the original vector plus the tilt angle of the sensor in radians, and return a new vector to accurately represent the position." Thus, let $\begin{bmatrix}x\\y\\z\end{bmatrix}$ denote the postition vector. Then, the rotation matrices are $$ \begin{alignat}{1} R_x(\theta) &= \begin{bmatrix} 1 & 0 & 0 \\ 0 & \cos \theta & -\sin \theta \\[3pt] 0 & \sin \theta & \cos \theta \\[3pt] \end{bmatrix} \\[6pt] R_y(\theta) &= \begin{bmatrix} \cos \theta & 0 & \sin \theta \\[3pt] 0 & 1 & 0 \\[3pt] -\sin \theta & 0 & \cos \theta \\ \end{bmatrix} \\[6pt] R_z(\theta) &= \begin{bmatrix} \cos \theta & -\sin \theta & 0 \\[3pt] \sin \theta & \cos \theta & 0\\[3pt] 0 & 0 & 1\\ \end{bmatrix} \end{alignat} $$ These can be acted upon the position vector. So, a rotation by $\pi/2$ radians in the $x$ direction would yield $$\begin{bmatrix} 1 & 0 & 0 \\ 0 & 0 & -1 \\[3pt] 0 & 1 & 0 \\[3pt] \end{bmatrix}\begin{bmatrix}x_i\\y_i\\z_i\end{bmatrix}=\begin{bmatrix}x_i\\-z_i\\y_i\end{bmatrix}$$ You also could compose rotations: $$R=R_x(\theta_i)R_y(\theta_j)R_z(\theta_k)$$