So i am building some framing generators to do walls, windows, doorways etc… i have the 3 done already but now im working on a roof framing generator. ive run into a problem now that angles are involved. I need to figure out how to make the rafter automatically adjust its angle, and its attach points to the ridge beam as the height between the joist and ridge beam change. i drew a picture.. i basically know i need to use the Pythagorean Theorem to get the lengths and what not.. but im not sure how to attach at the 3 blue points i have.. i know the pivot for the rafter will be at the base connection of the rafter. at least thats the way i see it. but any help would be greatly appreciated. not sure if this is something for VEX or a point sop or what not.

Thanks in Advance

Drawing

https://i.imgur.com/1UfbcmF.png [i.imgur.com]


A = (Ridge Board Height + 1/2 Ridgeboard Width) - (Ceiling Joist Height - 1/2 Ceiling Joist Width)
B = (Ceiling Joist Length) + (1/2 Width of Rafter)
C = (Square rt of A + Square rt of B)




Houdini layout

https://i.imgur.com/Qu1iPaU.png [i.imgur.com]