I am working on a Guitar application and so have a trapezoid as the fretboard. I am currently writing code to display the frets along the fretboard, but am stuck trying to calculate what the width is for each fret - I have calculated each fret's distance from the nut (top of fretboard) but it's the width, as in the shorter side, that I now need. Obviously, calculating the median width is straightforward but I have 22 frets and the distance between each one decreases the higher up the fretboard you go.
Could someone please suggest a formula, given that I know the length of all 4 sides, and know the X position of each fret? There are spreadsheets available online for luthiers that have a formula I could use, but I would far rather understand the calculation.
Thanks!