A light source at $(0,0,0)$ emitts a ray in direction $(0,0,1)$ which hits a plane 1 unit away perpendicular (so the surface normal of the plane is $\pm(0,0,1)$, and the plane is $z=1$). The light source is rotated around the x-axis by $\theta$ and around the y-axis by $\phi$. What is the angle of intersection between the surface and the resulting ray?

My initial guess is for $\theta = \phi = 45°$, that after the first rotation, the ray hits the plane at $(0,1,1)$ because the distance it moves on the plane is $\tan(\theta)$ and same for the other direction, so that we end up at $(1,1,1)$ on the plane. The angle between $(1,1,1)$ and $(0,0,1)$ is $\arccos(\frac{1}{1\cdot\sqrt{3}})$ (scalar product). Is this correct?

  • $\begingroup$ This particular rotated ray doen’t intersect the $z=1$ plane at $(1,1,1)$. You neglected to take into account that this point is offset from the $z$-axis when the second rotation is applied. In any case, what does rotating the ray “upward” mean when it’s already pointing “up” (in the direction of positive $z$)? $\endgroup$ – amd May 30 '17 at 18:40
  • $\begingroup$ Maybe I wasn't clear with 'up', 'down', 'right', 'left'. This is not a vector-rotation but a rotation of an imaginary light source, that sits at the origin. So, rotations of two different axis should be lineary independent from each other and lead to the same result, no matter the order in which they are applied. I edited out the directions, to be more exact. $\endgroup$ – Dschoni May 31 '17 at 12:13
  • $\begingroup$ But you are rotating a vector: that of the direction of the light ray. What has linear independence got to do with composition of rotations? Moreover, rotations in 3-D do not in general commute. Even for your simple example, exchanging the order of the two rotations produces a different result. $\endgroup$ – amd Jun 1 '17 at 8:47

You have a few misconceptions in your reasoning. The crucial one is that the effects of a sequence of rotations are in fact not independent of each other in general, so that you can’t simply add up the effects of the individual rotations. Moreover, the order in which you apply the two rotations also matters.

The first rotation (about the $x$-axis) does indeed move the spot at which the light ray hits the plane $z=1$ from $(0,0,1)$ to $(0,1,1)$. Look a little more closely at what’s going on here: the rotation moves the original spot to some other location in the $y$-$z$ plane that’s no longer on $z=1$, and so we have to trace the ray back to this plane to find the new spot. Similarly, the second rotation (about the $y$-axis) moves the spot to some other location on a plane parallel to the $x$-$z$ plane that’s also no longer on $z=1$, so when we retrace the new ray, both the $x$- and $y$- coordinates of the intersection will have been changed by the second rotation.

As I mentioned in my comments, you really are rotating a vector here—that of the direction of the ray. The resulting intersection spot is the rotated vector scaled by the reciprocal of its $z$-coordinate so that the value of this coordinate becomes $1$. The net rotation can be represented by the product of two basic rotation matrices: $$R=\pmatrix{\cos\phi&0&\sin\phi\\0&1&0\\-\sin\phi&0&\cos\phi}\pmatrix{1&0&0\\0&\cos\theta&-\sin\theta\\0&\sin\theta&\cos\theta}=\pmatrix{\cos\phi&\sin\theta\sin\phi&\cos\theta\sin\phi\\0&\cos\theta&-\sin\theta\\-\sin\phi&\sin\theta\cos\phi&\cos\theta\cos\phi}.$$ The result of rotating $(0,0,1)$ by this matrix is simply its last column, so the intersection point of the rotated ray with the plane $z=1$ is $(\tan\phi,-{\tan\theta\sec\phi},1)$. Compared to your result, there’s an extra factor of $\sec\phi$ in the $y$-coordinate. The rotations in your example correspond to $\theta=-\frac\pi4$, $\phi=\frac\pi4$, giving $(1,\sqrt2,1)$ for the shifted spot. If instead you rotate about the $y$-axis first, the spot ends up at $(\sqrt2,1,1)$.

If all you want is the resulting angle, there’s no need to project the rotated ray onto the plane. You’re rotating a unit vector that starts off pointing in the direction of the positive $z$-axis, so the cosine of the angle between the $z$-axis and the rotated vector is given by the dot product of the original vector with its image, which in this case is just the $z$-coordinate of the rotated unit vector, i.e., the lower-right entry of the rotation matrix: $\cos\theta\cos\phi$. Not entirely unsurprisingly, this value is the same regardless of the order in which you apply the two rotations.

  • $\begingroup$ I did not believe this, until I drew it in my CAD programm. You are completely right and now it makes sense to me. $\endgroup$ – Dschoni Jun 7 '17 at 8:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.