I need to plot a spherical surface in computer (like the surface of a lens). I know the normal vector (as an example, say $\ n=(1,2,3) $) of this surface and it originates from the centre of the surface. Since this surface is oriented along an arbitary direction defined by $\ n $, I don't know how to plot it, but I do know how to plot such a surface if its surface normal at the centre points along the z-axis, as shown in the attached diagram (as the polar and azimuthal angle that define the surface become much easier to calculate and implement in a program).

Now my actual problem is that given the cartesian coordinates of all the points on the surface (that is oriented along the z-axis), what is the rotation matrix (or other mathematical object) that can transform this surface to the actual surface I want (defined by $\ n $)?

enter image description here

  • $\begingroup$ I'm a little confused by what you're asking, but I think you are essentially asking for the rotation matrix that takes the z-axis to the n-axis? $\endgroup$ – user226970 Jan 14 '16 at 23:54
  • $\begingroup$ yes, you are right $\endgroup$ – Physicist Jan 15 '16 at 9:12
  • $\begingroup$ Here is a sketch: normalize the cross product $ \hat{n} \times \hat{z} $ to find the vector perpendicular to both. This is the axis of the rotation. The angle is given of course by $ \sin^{-1}( | \hat{n} \times \hat{z} | ) $ and by $ \cos^{-1}( \hat{n} \cdot \hat{z} ) $. Then use the formulas given here: en.wikipedia.org/wiki/…. It should simplify considerably, but I did not work out the algebra. Tell me if you get stuck. $\endgroup$ – user226970 Jan 15 '16 at 23:42

Your Answer

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

Browse other questions tagged or ask your own question.