title: Rotate a 3D- Point around another one
body: <p>I have a function in my program which rotates a point <code>(x_p, y_p, z_p)</code> around another point <code>(x_m, y_m, z_m)</code> by the angles <code>w_nx</code> and <code>w_ny</code>.</p>
  <p>The new coordinates are stored in global variables <code>x_n</code>, <code>y_n</code>, and <code>z_n</code>. Rotation around the <code>y-axis</code> (so changing value of <code>w_nx</code> - so that the <code>y</code> - values are not harmed) is working correctly, but as soon as I do a rotation around the <code>x-</code> or <code>z-</code> axis (changing the value of <code>w_ny</code>) the coordinates aren't accurate any more. I commented on the line I think my fault is in, but I can't figure out what's wrong with that code.</p>
  <pre><code>void rotate(float x_m, float y_m, float z_m, float x_p, float y_p, float z_p, float w_nx ,float w_ny)
      {
          float z_b = z_p - z_m;
          float x_b = x_p - x_m;
          float y_b = y_p - y_m;
          float length_ = sqrt((z_b*z_b)+(x_b*x_b)+(y_b*y_b));
          float w_bx = asin(z_b/sqrt((x_b*x_b)+(z_b*z_b))) + w_nx;
          float w_by = asin(x_b/sqrt((x_b*x_b)+(y_b*y_b))) + w_ny; //&lt;- there must be that fault
          x_n = cos(w_bx)*sin(w_by)*length_+x_m;
          z_n = sin(w_bx)*sin(w_by)*length_+z_m;
          y_n = cos(w_by)*length_+y_m;
      }
  </code></pre>