The Alhambra Granada Ad Quadratum Ground Plan calculator will calculate the angles and rafter lengths for a roof that is like the roof over the Hall of Abencerrajes @ Alhambra Granada Spain.
Just about every medieval cathedral has an octagonal baptismal and the Alhambra in Granada Spain has several octagonal ground plans. The roof over the Hall of the Abencerrajes is unique because the roof actually follows the Ad Quadratum ground plan that is used to develop the octagonal ground plan. 2 squares rotated in the circle.
The ground plan is based on Ad Quadratum.

Ad Quadratum Ground Plan Base supported in Rafter Tools:
 Octagon Base 16 Sides
 Dodecagon Base 24 Sides
 Hexadecagon Base 32 Sides
Input variables
 Roof Pitch or Angle
 Input Length
 Overhang Run
 Jack Rafter Spacing
 Hip Rafter Width
 Hip Rafter Depth
 Rafter Width
 Rafter Depth
 Seat Cut Level Cut Length
 Ground Plan Base
Roof Pitch or Angle
Select the input type from the input menu, Imperial/English Inch base 12 —— default, enter roof pitches from 1—24
like 8 for an 8:12 pitched roof, Metric 300mm base, enter millimeters like 200 for a 33.69007° roof pitch angle,
Decimal Inch base 10 —— enter base 10 decimal numbers like 5.7735 for a 30° roof pitch angle,
Degrees input —— use any roof angle in degrees like 33.69007°
 Length/Dimensions Input Menu Mode
 Imperial/English Inch base 12 —— default.. use American standard pitches over 12.
 Metric 300mm base —— 300mm is 11.81102 inches, similar usage to the American framing squares printed in inches.
 Decimal Inch base 10 —— use this option when working with tangents or using the Chappell Master Framing Square multiply the tangent of the angle by 10
The output mode selection can be completely different from the input mode
 Length/Dimensions Output Menu Mode
 Imperial/English Inch base 12 —— default.. use American standard pitches over 12.
 Metric 300mm base —— 300mm is 11.81102 inches, similar usage to the American framing squares.
 Decimal Inch base 10 —— use this option when working with tangents or using the Chappell Master Framing Square
Input Length
This menu option allows you to set the length for calculating the angles and dimensions of the
roof.
 Input Length Types:
 Main Hip Rafter RunRadius
 Adjacent Valley Rafter RunRadius
 Common Rafter Run
 Common Rafter Rise
 Side Wall Length
Overhang Run
This menu option allows you to set the rafter overhang run. The rafter overhang run will be used to calculate the common rafter overhang length.
Jack Rafter Spacing
This menu option allows you to set the jack rafter On Center spacing of the jack rafters. The calculator will retun the jack rafter length difference for
the main hip rafter and the valley rafter jack rafters.
Hip Rafter Width
This menu option allows you to set the width of the hip rafter. The width of the hip rafter is used to calculate the size of the king post.
Hip Rafter Material Depth , Main Material Depth
This menu option allows you to set the depth of the rafters that is used to calculate:
 Hip Rafter Plumb Cut Height
 Minimum King Post Height
Rafter Material Width
Enter the rafter material width that will be used for the roof. Not really used at this time.
Rafter Material Depth
Enter the rafter material depth that will be used to determine the HAP of the rafters.
Seactcut Length
Enter a rafter seatcut length that will be used to determine the height of the heel cut (HAP).
Calculated Results will look something like the following:
 Ground Plan Base Type  Octagon Base 16 Sides
 Input Length Mode Type  Main Hip Rafter RunRadius
 Main Plan Angle  45.00000°
 Adjacent Plan Angle  112.50000°
 Central Angle  22.50000°
 Polygon Angle  67.50000°
 Main Roof Slope Angle  33.69007°
 Main Pitch  8 in\12in
 Main Hip Rafter Angle  25.23940°
 Main Hip Rafter Pitch  5 11/16 in\12in
 Main Hip Rafter Backing Angle  23.09347°
 Main Hip Rafter Side Cut Angle  42.13041°
 Main Jack Rafter Side Cut Angle  39.76216°
 Main Jack Rafter Length Difference  19 1/4''in
 Adjacent Valley Rafter Angle  31.62973°
 Adjacent Valley Rafter Pitch  7 3/8 in\12in
 Adjacent Valley Rafter Backing Angle  12.25568°
 Adjacent Valley Rafter Side Cut Angle  19.42694°
 Adjacent Jack Rafter Side Cut Angle  19.01633°
 Adjacent Jack Rafter Length Difference  27 3/16''in
 Main Rafter Run  101 13/16''in
 Theoretical Common Rafter Rise  67 7/8''in
 Main Rafter Theoretical Length  122 3/8''in
 Main Rafter Seatcut Length  3 1/2''in
 Main Rafter Overhang Length  28 7/8''in
 Side Wall Length  59 5/8''in
 Main Hip Rafter Run  144 ''in
 Main Hip Rafter Length  159 3/16''in
 Adjacent Valley Rafter Run  110 3/16''in
 Adjacent Valley Rafter Length  129 7/16''in
 HAP  Height Above Plate (Heel Height)  9 1/16''in
 Major Rafter Plumb Cut Height  11 7/16''in
 Main Hip Rafter Plumb Height  10 1/2''in
 Valley Rafter Plumb Height  11 3/16''in
 King Post Radius  8 15/16''in
 King Post Minimum Height  15 5/16''in
 Main Hip Rafter To King Post Length  149 1/2''in
 Valley Rafter To King Post Length  119 1/8''in
See the Roof Framing Geometry Blog for more information for the Alhambra Granada Ad Quadratum Ground roof rafters.
Alhambra Granada Ad Quadratum Ground Plan
Connecting the eight points of intersection of the circle and the sides of the square form an octagon.
Alhambra Granada Ad Quadratum Ground Plan Part 2
Geometry has been passed down through the centuries.So, my best guest is the Islamic Moors used regulating lines of geometry to develop the roof plan and the hip rafter head cuts for the roof at Alhambra, Granada Spain over the Hall of Abencerrajes. The Islamic Moors most likely used a Hexadecagon King Post, Ad Quadratum King Post 4  Squares Rotated in Circle. 16 sided polygon king post for the 8 hip rafters and 8 valley rafters.