Calculating angles for wood joinery This is an actual problem I have faced in woodworking and am now facing again, and figure I ought to understand how to think about this problem geometrically, which is the problem I'm having. I have some wood boards that are initially similar to those in the first picture. It would be simple to join them by cutting each end at a 45° angle.
Boards while flat
However, they will not be laying flat (that is, Z=0 for all bottom edges). The bottom face will be tilted up A° from the outside such that the inside edges are raised above the Z=0 plane. (A = 30° in the picture.) My goal is to cut the ends of the boards with the same angles such that the cut edges will join face to face.
After the boards are tilted up, B cannot have been cut at 45° if the faces are the join. Also, the cut edge is no longer 90° from the face (like the other 3 edges on each board). How do I calculate B and C given an angle A? Essentially, the cut faces need to be parallel to the Z-axis.
The purpose of this calculation is because the boards can only be held steady when laying flat and the saw blade must have its angles adjusted—but to what?
Thanks for any help orienting my thinking about the steps for solving this problem! In other situations there would be more than 4 boards being joined, so the 45° would actually be another number (like 22.5° with 8 boards).
Boards where the inside edges have been rotated up 30°
 A: $\DeclareMathOperator{\acos}{acos}$To keep things general for both clarity and flexibility, let's write $A$ for the angle of inclination of a face ($30$ degrees in the question) and $D$ for the flat angle at the top inside of the joint ($90$ degrees in the question). Finally, let $w$ denote the width of an uncut board.

Formulas In a coordinate system whose origin is the vertex of the angle marked $D/2$ and with the top edge of one board along the $x$-axis, the top joined edge of the mitered boards points in the direction
$$
v = (w\cos A \cot(D/2), w\cos A, w\sin A)
= w(\cos A \cot(D/2), \cos A, \sin A).
$$
Consequently, $B$ is the angle between $v$ and $w(0, \cos A, \sin A)$,
$$
B = \acos\biggl[\frac{1}{\sqrt{1 + \cos^{2} A \cot^{2}(D/2)}}\biggr].
$$
For $D = 90$ degrees (four boards making a mitered rectangular frame) we have $\cot(D/2) = 1$ and the preceding formula simplifies to
$$
B = \acos\biggl[\frac{1}{\sqrt{1 + \cos^{2} A}}\biggr].
$$
The miter angle $E$ for the cut end is given by
$$
E = \acos\Bigl[\sqrt{\sin^{2}(D/2) + \cos^{2} A \cos^{2}(D/2)}\Bigr].
$$
For $A = 30$ degrees (and $D = 90$ degrees), $\cos A = \sqrt{3}/2$, $\sin A = 1/2$, and $\cos^{2}(D/2) = \sin^{2}(D/2) = 1/2$, so
$$
B = \acos \sqrt{4/7} \approx 40.9\ \text{degrees},\qquad
E = \acos \sqrt{7/8} \approx 20.7\ \text{degrees}.
$$
That is, the blade of a miter saw needs to be turned $40.9$ degrees from perpendicular and tilted $20.7$ degrees from vertical.

Derivations Vector algebra is a convenient tool for this type of calculation. Derivation of these formulas follows.
For completeness (possibly reiterating things you know):

*

*An ordered triple $v = (x, y, z)$ can represent either a displacement between two points, or the location of a point relative to an origin.


*The dot product of two triples $v_{1} = (x_{1}, y_{1}, z_{1})$ and $v_{2} = (x_{2}, y_{2}, z_{2})$ is the number
$$
v_{1} \cdot v_{2} = x_{1}x_{2} + y_{1}y_{2} + z_{1}z_{2}.
$$


*The length of an ordered triple is
$$
|v| = \sqrt{v \cdot v} = \sqrt{x^{2} + y^{2} + z^{2}}.
$$
The dot product and length formulas do not depend on angle units.


*The angle $\theta$ between two non-zero vectors satisfies $v_{1} \cdot v_{2} = |v_{1}|\, |v_{2}| \cos\theta$, or
$$
\theta = \acos\frac{v_{1} \cdot v_{2}}{|v_{1}|\, |v_{2}|}.
$$
Usually mathematicians measure angles in radians, and $\acos$ refers to the "radian-valued" inverse cosine. A calculator in degrees mode will calculate angles in degrees.


*The cross product of two triples $v_{1} = (x_{1}, y_{1}, z_{1})$ and $v_{2} = (x_{2}, y_{2}, z_{2})$,
$$
v_{1} \times v_{2} = (y_{1}z_{2} - y_{2}z_{1}, x_{3}z_{1} - x_{1}z_{3}, x_{1}y_{2} - x_{2}y_{1}),
$$
is orthogonal to both factors. (Its magnitude is unneeded here, but turns out to be $|v_{1}|\, |v_{2}| \sin\theta$.)
The diagram shows the top surfaces of the mitered boards. The right triangle with angle marked $A$ has hypotenuse $w$, so its sides are $w\cos A$ and $w\sin A$ as marked. Place the origin as shown, at the vertex of a right triangle with angle $D/2$. The side of this triangle along the $x$-axis is $(w\cos A)\cot(D/2)$, so
$$
v = w(\cos A \cot(D/2), \cos A, \sin A)
$$
as claimed. The magnitude $|v| = w\sqrt{1 + \cos^{2} A \cot^{2}(D/2)}$ may be used as a consistency check to measure the length of the mitered edge before cutting.
The vector perpendicularly across the board is $w(0, \cos A, \sin A)$. The angle $B$ between $v$ and this vector may be calculated using dot products and the scaled vectors $(\cos A \cot(D/2), \cos A, \sin A)$ and $(0, \cos A, \sin A)$, yielding:
\begin{align*}
  \cos B &= \frac{v \cdot (0, \cos A, \sin A)}{|v|} \\
  &= \frac{1}{\sqrt{1 + \cos^{2} A \cot^{2}(D/2)}}.
\end{align*}

To calculate the angle $E$ between a vertical cut and the board's mitered end, we'll calculate unit normal vectors to the uncut vertical end and mitered end of the board.
The plane of the uncut end of the board contains $v$ and $n = (0, -\sin A, \cos A)$, a unit normal to the face of the board. A short calculation gives
\begin{align*}
  v \times n &= w(1, -\cos^{2} A \cot(D/2), -\cos A \sin A \cot(D/2)), \\
  |v \times n| &= w\sqrt{1 + \cos^{2} A \cot^{2}(D/2)}.
\end{align*}
The plane of the cut end of the board contains $v$ and $k = (0, 0, 1)$. A short calculation gives
\begin{align*}
  v \times k &= w(\cos A, -\cos A \cot(D/2), 0) = w\cos A(1, -\cot(D/2), 0), \\
  |v \times k| &= w\cos A \sqrt{1 + \cot^{2}(D/2)} = w\cos A \csc(D/2).
\end{align*}
Consequently,
\begin{align*}
  \cos E &= \frac{v \times n}{|v \times n|} \cdot \frac{v \times k}{|v \times k|} \\
  &= \frac{1 + \cos^{2} A \cot^{2}(D/2)}{\csc(D/2)\sqrt{1 + \cos^{2} A \cot^{2}(D/2)}}.
\end{align*}
Multiplying and dividing by $\sin^{2}(D/2)$ and simplifying gives
$$
E = \acos\Bigl[\sqrt{\sin^{2}(D/2) + \cos^{2} A \cos^{2}(D/2)}\Bigr].
$$
A: Let the right board extend along the $x$ axis, and the left board extend along the $y$ axis.  Both planes pass through the origin.  Due to tilt angle $A$, the equation of the first board is
$ (0, -\sin A , \cos A )  \cdot (x,y,z) = 0 $
while the equation of the second plane is
$ (-\sin A, 0, \cos A ) \cdot (x,y,z) = 0 $
The cross product of the above two normal vectors gives the direction vector of the join line
$ (0, -\sin A, \cos A) \times (-\sin A, 0, \cos A) = (-\sin A \cos A , -\sin A \cos A , - \sin^2 A ) \\= -\sin A ( \cos A, \cos A, \sin A ) $
Angle $B$ is between the above vector and the vector $-(\cos A, 0, \sin A ) $
Therefore,
$ B = \cos^{-1} \bigg( \dfrac{ 1 }{\sqrt{ 1 + \cos^2 A} }  \bigg) = 40.893^\circ$
While angle $C$ is the angle between the normal to the first plane and the join plane,
$ C = \cos^{-1} ( \sin 45^\circ \sin A  ) = 69.295^\circ$
