You will need to make a drawing with three orthogonal axis representing the three plane you are trying to combine. From there you the apply the law of cosinus and sinus. Then if you are good with geometry and know you law it is a piece of cake. Or if you want to make if harder for you or you are good with what "transformation affine functions" you can create a simple mathematical model with equation. When you have it it is then easy to plug in any x,y or z coordonnees and get the resulting location (but not angle) So you then have two choice you either translate into angles or you re use your three dimensional axis. But as you need a final cut with your saw I guess you will probably have to position your blade within this axis. Much too complex for a novice. The best bet is then convert the position into angles.
In anyway the first non mathematical solution (cosine and sinuss) are probably the easiest.
I am French and I studied spatial type of mathematics in high school (yep we did that in my last year of high school) then in university a bit too. So, i can guaranty it works if you can see visually or conceptually what you are trying too achieve.
I had the same problems for an angular buidling addition I build on a slope patio. My problem was a bit more complexe however: I had an horizontal angle between the framing and the sloped and beveled patio floor. And I had the reverse (or mirored) situation on the other side of the building. I guesses the number BUT keeping in mind my math. It work so well. I did many cuts by hand with hand saw and jig saw on 2 by 4 framing lumber for the framing and the even the sloped roof. As well as the 5 feet long 6 feet wide seal of the leveled patio door.
Guess what: it is absolutely tight and seal. It all worked fine. Indeed, I had to do twice the French door sill because I used first a 4 by 4 lumber but with the bug fence added to the door I need a wider beam. I re did it another cut by hand with my saw (it took me three hours for each cut as it was pressure treated lumber.
But I am French and we never makes thinks quick and easy.
Have fun guys.
If you want more here is one of the US links I found that explain you. I do not even try to submit you with a french site because usually we assume the reader know the ""basics"" of advanced math and geometry. The US site is surely easier for anyone.
You will notice we use matrix (so this in itself requires knowing how to use matrix and practice advanced mathematics. You will also notice some basics such as the basic theorem that two 90 degree rotation equal to 1 translation and so on... have fun. So, next time you start a woodworking project or buy a mitter saw for instance you will be able to use it to its fullest extend... LOL
How did you think we went on the moon ... with math 101 ... lol. It is all advanced math.
Have fun cutting your stick :>)