I would like to rotate an array of data around an arbitary axis that passes from the centre of a sphere though a given point on its surface.
I have no issue rotation around the x,y,z axes - if we consider a point on a sphere at the spherical coordinate $(r,\theta,\phi)=(1.0,\pi/2,0)$, convert it to cartesian coordinates via
$x^\prime=r\cos(\phi)\sin(\theta)$
$y^\prime=r\sin(\phi)\sin(\theta)$
$z^\prime=r\cos(\theta)$
and rotate it by around the y-axis by $\psi=40^\circ$ using (in radians)
$x^\prime=x\cos(\psi) + z\sin(\psi)$
$y^\prime=y$
$z^\prime=-x\sin(\psi) + z\cos(\psi)$
I would then like to rotate the data around the axis that connects the sphere centre and the rotated point.
Many thanks