Euler's angles from plane normal vector I have a plane surface which is defined by its normal vector (distance to the plane is irrelevant at this point).  The normal vector looks like {0, 0, 1}, for a flat ground, for example.
I need to rotate a 3D object to position it as if it was "standing" on that surface, with the yaw of the object (its heading) decided programmaticly by other bits of logic.
So I just need to find the pitch and roll angles in order for the object to look like it's standing on the plane (of which, I repeat, we know the normal vector).
I've been looking all over for a simple solution, but the explanations always seem to involve math concepts I have no idea about.  I have no plans on becoming good at geometry, just need a quick solution to this problem.
All help or pointers is welcome!
PS: please talk to me almost as if I was 5 y/o :)  Thanks.
 A: Assume the plane and the object are described in a global coordinate system.  You can rotate the plane so that its normal becomes $(0,0,1)$ in the global coordinate system.  One way to rotate a unit vector $\vec{n}$ so that it becomes $(0,0,1)$ is to first rotate $\vec{n}$ into the positive $x$ half of the $xz$ plane about the $z$ axis and then rotate $\vec{n}$ about the $y$ axis so that it becomes $(0,0,1)$.  The single rotation matrix that performs these two rotations is
$$
  P = 
  \begin{pmatrix}
  n_xn_z/r & n_yn_z/r & -r \\
  -n_y/r & n_x/r & 0 \\
  n_x & n_y & n_z
  \end{pmatrix}
$$
where $r=\sqrt{n_x^2 + n_y^2}$.  Apply $P$ to the object.  Suppose your object is a person and you know the unit vector vertical axis $\vec{w}$ of the person.  After applying $P$, the vertical axis of the person is $P\vec{w}$.  Now apply the rotation matrix $Q$ that transforms $P\vec{w}$ to $(0,0,1)$ (use the formula for $P$ given above with $\vec{n}$ replaced by $P\vec{w}$ to find $Q$).  This makes it so that the person is "standing" on the plane rotated by $P$.  The last step is inverting the original rotation $P$ so that the rotated plane is the original plane and the person is "standing" on the original plane.  So all together, you need to apply the product of rotation matrices $P^{\textrm{T}}QP$ to your object.  The superscript above $P$ stands for transpose; the transpose of a rotation matrix is its inverse.
