## ang_for_axis(ANGLE* vAng, VECTOR* vAxis, var angle)

LC Converts a rotation about an arbitary axis to an Euler angle. Can be used to rotate entities about arbitrary axes.

### Parameters:

 vAng Pointer to an Euler angle vector. vAxis Pointer to a direction vector that serves as rotation axis. angle Rotation about vAxis in 0..360 degrees counterclockwise.

Medium

### Example (lite-C):

```// calculate rotation for aligning an axis to a normal vector
function ang_align(ANGLE* ang, VECTOR* to, VECTOR* axis) {  vec_normalize(axis,1);  vec_normalize(to,1);
// calculate a rotation axis perpendicular to both vectors  VECTOR rot;  vec_cross(rot,axis,to); // rotate by the angle difference between both vectors  ang_for_axis(ang,rot,acosv(vec_dot(to,axis)));}
...
// align an entity to the floor normal
c_trace(my.x,vector(my.x,my.y,my.z-1000),IGNORE_ME); // set floor normal hit.nx
ang_align(my.pan,hit.nx,vector(0,0,1)); // align vertical axis to the floor normal
ang_rotate(my.pan,vector(angle,0,0));   // rotate the entities' pan angle
...```