Seitz

This one is for the Seitz’s house.

from math import floor, sqrt, sin, cos, tan, atan, pi

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)

def side(length, angle):
    summ = 0
    for x in range(9):
        y = (x * (4 + 1.375)    )/sin(2*angle)
        #sixt(y) + ' -> ' + 
        print sixt(length-y)
        y = (x * (4 + 1.375) + 4)/sin(2*angle)
        #sixt(y) + ' -> ' + 
        print sixt(length-y)
        if length-y > 0:
            summ += length-y
    print sixt(summ)
    return summ

def getangle(length):
    print atan(31./length)*180/pi
    return atan(31./length)

def notch(length):
    angle = getangle(length)
    hyp = length/cos(angle)
    print "length: " + sixt(hyp)
    short = hyp/2 - 1.375/(2*tan(angle))
    longs = hyp/2 - (1.375/2)*tan(angle)
    print sixt(short)+ ", "+sixt(longs)
    return short, longs
Advertisements