To rotate a point by an angle omega around the Z axis, do this:

x' = x*cos(omega) - y*sin(omega)

y' = x*sin(omega) + y*cos(omega)

z' = z

Similarly, around the x-axis:

x' = x

y' = y*cos(theta) - z*sin(theta)

z' = y*sin(theta) + z*cos(theta)

Around the y-axis:

x' = z*sin(phi) + x*cos(phi)

y' = y

z' = z*cos(phi) - x*sin(phi)

To perform a sequence of rotations around these axes, just do those transformations in sequence.

x' = x*cos(omega) - y*sin(omega)

y' = x*sin(omega) + y*cos(omega)

z' = z

Similarly, around the x-axis:

x' = x

y' = y*cos(theta) - z*sin(theta)

z' = y*sin(theta) + z*cos(theta)

Around the y-axis:

x' = z*sin(phi) + x*cos(phi)

y' = y

z' = z*cos(phi) - x*sin(phi)

To perform a sequence of rotations around these axes, just do those transformations in sequence.