I have a point (x,y,z) in the 3D space. This point rotates by theta1 about the arbitrary axis ax1. This axis (ax1) rotates by theta2 about another axis ax2. What will be the new coordinates of the point. I am going to generalize this point transformation to rotation about n arbitrary axes in 3D space. What will be the procedure. Matrix rotation or Quaternion formulation. Thank you very much.
Rodrigues' formula rotates a vector around an arbitrary vector in space. You points of course can be considered vectors and this way you can apply this formula.
You compound the rotation by rotating the point around axis1 then around axis2.
You should look into Denavit-Hartenberg (DH) parameters, which are specifically designed for describing the configuration of a robot arm that consists of a sequence of rotational linkages. This sounds like the problem you are trying to address.
The link above provides matrix rotation formulations for applying the parameters. The formulation includes a translational component for moving along each link in a sequence, but this can be zero if you are dealing with a sequence of only pure rotations (or if you rotate around multiple different axes, but about the same point).