how to solve for length of diagonal board between columns I was watching a youtube video the other day and the guy was figuring out the length of a board needed to fit diagonally between two columns. He did it in an approximate way that worked fine, but it got me to thinking: how would one solve this mathematically?
illustration of board between columns
So, let's call the space between columns "D", and the height "H" (to accommodate the diagonal board), and the width of the board "W". I'm looking for a formula into which you could plug these known dimensions, to compute "L" the overall length of the board, and I suppose the angle "A" of the cut on each end.
One can use the Pythagorean Theorem to compute the diagonal (of L x H), but this does not account for W (board width). Thus the board takes the shape of a parallelogram, sitting above a right triangle, the height of which is less than H. I believe this triangle is "similar" to the piece that would be cut off the end of the board (angles same, but perhaps smaller and rotated/flipped).
I've recognized an equation, H = W/Cos(A) + D*Tan(A), but I've no idea how to solve for A.
I'd greatly appreciate a nudge in the right direction.

$L=\sqrt{D^2+H^2-W^2}$, thank you Jaap
It now occurs to me that knowing the angle A is also important (or at least, knowing the other leg of the little triangles to cut off the ends).
$A=\arctan(\frac{H}{D})-\arctan(\frac{W}{L})$
