30 60 90

I made this one to calculate some 30 60 90 triangles for the railings for 1430 in Allendale.

from math import floor, sqrt

def sixt(x):
    return "%d %d/16" % (floor(x), x*16%16)

def sixdegsides(offset):
    for x in range(4):
        y = offset + sqrt(3)*(x * (4 + 1.375) )
        print sixt(y) + " -> " + sixt((31 - (1/16.) - y) * 2 /sqrt(3))
        y = offset + sqrt(3)*(x * (4 + 1.375) + 1.375)
        print sixt(y) + " -> " + sixt((31 - (1/16.) - y) * 2 /sqrt(3))

def thirtydegsides(offset):
    for x in range(9):
        y = offset + (x * (4 + 1.375 ) )*2/sqrt(3)
        print sixt(y) + " -> " + sixt(y * 2)
        y = offset + (x * (4 + 1.375) + 4) *2/sqrt(3)
        print sixt(y) + " -> " + sixt(y * 2)

def aroundthecorner(offset):
    """
    Computes how long til the next one starts, input the horizontal gap
    between the last post and the vertical post, outputs the vertical space
    assumes 4in gap.
    """
    return (8/sqrt(3) - offset) * sqrt(3)
Advertisements