To solve the problem for the case you have suggested means that the directions of the Normals to the two Planes have to be found, so I will try and give some background.
For any any line or vector in space there are three angles between itself and the axis system that it is in. The term Direction Cosines refers to the cosines of each of these angles. Here I call them i,j,k but they may also be called l,m,n. It doesn't matter what they are called, the important thing about them is that the sum of their squares is 1. The cosines of the angles between the line and the axes X,Y,Z are i,j,k respectively.
To find the Direction Cosines of a Line that starts at (x1,y1,z1) and finishes at (x2,y2,z2) then the distance (D) between the two Points is divided by itself to become a unit length (1). This means that the orthogonal virtual 'box' that encloses the line has dimensions, and if these are divided by D then these are equal to the Direction Cosines.
So, if a line of length 1 (inches, metres, etc.) goes from one point to another in space and the values of the start point are considered to be (x1,y1,z1) and the finish point (x2,y2,z2) then the length of the line is;
D = [(x1-x2)^2 + (y1-y2)^2 + (z1-z2)^2]^0.5
Then the Direction Cosines (i,j,k) are;
i = (x1-x2)/D
j = (y1-y2)/D
k = (z1-z2)/d
And
i^2 + j^2 + k" = 1
In the original Thread the two roof slopes were at rightangles to each other - the gutter of one being along X of a local axis system and the other along Y. Therefore the Normals to the roof planes both lay on two of principal planes (Xz and YZ) which means that in each case one of the angles is 90 degree, the cosine of which = 0.
The Origin of the axis system is at the lower end of the Hip, which is also the intersection of the gutters.
Giving some values to the roof slope angles will make it easier to see what is happening;
Roof (1) with gutter in X direction = 35 degrees = Angle (A)
Roof (2) with gutter in Y direction = 60 degrees = Angle (B)
Therefore Normal (1) has angles of 90,55 & 35 to X,Y & Z
and Normal (2) has angles of 30,90 & 60 to X,Y & Z
The Cosines of these angles will values of i,j & k in each case;
Normal (1) : i1=0.000000 , j1=0.573576 , k1=0.819152
Normal (2) : i2=0.866025 , j2=0.000000 , k2=0.500000
Putting these values into equation to find Theta (Hip Ridge Angle)
cos(Theta) = [(i1*i2)+(j1*j2)+(k1*k2)]
= [(0)+(0)+(0.409576)]
Theta = 65.82 degrees or 114.18 degrees included angle.
( Theta is the angle between the two Normals
so 180 - Theta is the angle bewteen the planes )
In the case of the window bays being at 135 degrees then the Roof (2) is rotated about Z by 45 degrees = Angle (C)
The Direction Cosines can be rotated directly by;
i3 = i2 * cos(45) = 0.612372
j3 = j2 * sin(45) = 0.612372
k3 = k2 = 0.500000
Note : the sum of each of these values squared is 1
Putting these values into equation gives;
# using (i1,j1,k1)&(i3,j3,k3)
cos(Theta) = [(0)+(0.351242)+(0.409576)]
Theta = 40.46 or 139.54 degrees included angle.
This can all be compressed and re-written as;
cos(Theta) = (sin(A)*sin(B)*sin(C))+(cos(A)*cos(B))]
Where A & B are Roof Angles and C is the Bay Window Angle,
(C = the rotation out of the rectangular bay shape).