The q-vector in fact has three components:

Consider that the x-ray beam points along +y, so that on the detector, the horizontal is x, and the vertical is z. We assume that the x-ray beam hits the flat 2D area detector at 90° at detector (pixel) position
. The scattering angles are then:

where
is the sample-detector distance,
is the out-of-plane component (angle w.r.t. to y-axis, rotation about x-axis), and
is the in-plane component (rotation about z-axis). The alternate angle,
, is the elevation angle in the plane defined by
.
The momentum transfer components are:

Or:

And, of course:
