コード例 #1
0
def main(x1, y1, x2, y2, x3, y3, xt, yt, xf, yf, d, xs, ys):

    points = []
    temp = one_color.struc()

    line1 = translation.main(x1, y1, x2, y2, xt, yt)
    line2 = translation.main(x2, y2, x3, y3, xt, yt)
    line3 = translation.main(x3, y3, x1, y1, xt, yt)

    line1 = rotation.main(line1[0].x, line1[0].y, line1[1].x, line1[1].y, xf,
                          yf, d)
    line2 = rotation.main(line2[0].x, line2[0].y, line2[1].x, line2[1].y, xf,
                          yf, d)
    line3 = rotation.main(line3[0].x, line3[0].y, line3[1].x, line3[1].y, xf,
                          yf, d)

    line1 = scale.main(line1[0].x, line1[0].y, line1[1].x, line1[1].y, xf, yf,
                       xs, ys)
    line2 = scale.main(line2[0].x, line2[0].y, line2[1].x, line2[1].y, xf, yf,
                       xs, ys)
    line3 = scale.main(line3[0].x, line3[0].y, line3[1].x, line3[1].y, xf, yf,
                       xs, ys)

    line = draw_polygon.main(line1[0].x, line1[0].y, line2[0].x, line2[0].y,
                             line3[0].x, line3[0].y)

    return line
コード例 #2
0
def main(x1, y1, x2, y2, x3, y3, x4, y4, x5, y5, xt, yt, xTrans, yTrans, xs,
         ys, d):

    line1 = translation.main(x1, y1, x2, y2, xTrans, yTrans)
    line2 = translation.main(x2, y2, x3, y3, xTrans, yTrans)
    line3 = translation.main(x3, y3, x4, y4, xTrans, yTrans)
    line4 = translation.main(x4, y4, x5, y5, xTrans, yTrans)
    line5 = translation.main(x5, y5, x1, y1, xTrans, yTrans)

    x1 = line1[0].x
    y1 = line1[0].y
    x2 = line2[0].x
    y2 = line2[0].y
    x3 = line3[0].x
    y3 = line3[0].y
    x4 = line4[0].x
    y4 = line4[0].y
    x5 = line5[0].x
    y5 = line5[0].y

    line1 = scale.main(x1, y1, x2, y2, xt, yt, xs, ys)
    line2 = scale.main(x2, y2, x3, y3, xt, yt, xs, ys)
    line3 = scale.main(x3, y3, x4, y4, xt, yt, xs, ys)
    line4 = scale.main(x4, y4, x5, y5, xt, yt, xs, ys)
    line5 = scale.main(x5, y5, x1, y1, xt, yt, xs, ys)

    x1 = line1[0].x
    y1 = line1[0].y
    x2 = line2[0].x
    y2 = line2[0].y
    x3 = line3[0].x
    y3 = line3[0].y
    x4 = line4[0].x
    y4 = line4[0].y
    x5 = line5[0].x
    y5 = line5[0].y

    line1 = rotation.main(x1, y1, x2, y2, xt, yt, d)
    line2 = rotation.main(x2, y2, x3, y3, xt, yt, d)
    line3 = rotation.main(x3, y3, x4, y4, xt, yt, d)
    line4 = rotation.main(x4, y4, x5, y5, xt, yt, d)
    line5 = rotation.main(x5, y5, x1, y1, xt, yt, d)

    x1 = line1[0].x
    y1 = line1[0].y
    x2 = line2[0].x
    y2 = line2[0].y
    x3 = line3[0].x
    y3 = line3[0].y
    x4 = line4[0].x
    y4 = line4[0].y
    x5 = line5[0].x
    y5 = line5[0].y

    line = draw_polygon.main(x1, y1, x2, y2, x3, y3, x4, y4, x5, y5)

    return line
コード例 #3
0
def main( x1, y1, x2, y2, x3, y3, x4, y4, x5, y5, xt, yt, xTrans, yTrans, xs, ys, d ):

    line1 = translation.main( x1, y1, x2, y2, xTrans, yTrans )
    line2 = translation.main( x2, y2, x3, y3, xTrans, yTrans )
    line3 = translation.main( x3, y3, x4, y4, xTrans, yTrans )
    line4 = translation.main( x4, y4, x5, y5, xTrans, yTrans )
    line5 = translation.main( x5, y5, x1, y1, xTrans, yTrans )

    x1 = line1[ 0 ].x
    y1 = line1[ 0 ].y
    x2 = line2[ 0 ].x
    y2 = line2[ 0 ].y
    x3 = line3[ 0 ].x
    y3 = line3[ 0 ].y
    x4 = line4[ 0 ].x
    y4 = line4[ 0 ].y
    x5 = line5[ 0 ].x
    y5 = line5[ 0 ].y

    line1 = scale.main( x1, y1, x2, y2, xt, yt, xs, ys )
    line2 = scale.main( x2, y2, x3, y3, xt, yt, xs, ys )
    line3 = scale.main( x3, y3, x4, y4, xt, yt, xs, ys )
    line4 = scale.main( x4, y4, x5, y5, xt, yt, xs, ys )
    line5 = scale.main( x5, y5, x1, y1, xt, yt, xs, ys )

    x1 = line1[ 0 ].x
    y1 = line1[ 0 ].y
    x2 = line2[ 0 ].x
    y2 = line2[ 0 ].y
    x3 = line3[ 0 ].x
    y3 = line3[ 0 ].y
    x4 = line4[ 0 ].x
    y4 = line4[ 0 ].y
    x5 = line5[ 0 ].x
    y5 = line5[ 0 ].y

    line1 = rotation.main( x1, y1, x2, y2, xt, yt, d )
    line2 = rotation.main( x2, y2, x3, y3, xt, yt, d )
    line3 = rotation.main( x3, y3, x4, y4, xt, yt, d )
    line4 = rotation.main( x4, y4, x5, y5, xt, yt, d )
    line5 = rotation.main( x5, y5, x1, y1, xt, yt, d )

    x1 = line1[ 0 ].x
    y1 = line1[ 0 ].y
    x2 = line2[ 0 ].x
    y2 = line2[ 0 ].y
    x3 = line3[ 0 ].x
    y3 = line3[ 0 ].y
    x4 = line4[ 0 ].x
    y4 = line4[ 0 ].y
    x5 = line5[ 0 ].x
    y5 = line5[ 0 ].y
    
    fill = fill_polygon.main( x1, y1, x2, y2, x3, y3, x4, y4, x5, y5 )

    return fill
コード例 #4
0
def Rotate( boardsize_x, boardsize_y, x1, y1, x2, y2, x3, y3, x4, y4, xf, yf, d ):
    
    print ('Starting')
    
    image = one_color.main( boardsize_x, boardsize_y, 245, 245, 245 )
    redPoints = rotation.main( x1, y1, x2, y2, xf, yf, d)
    greenPoints = rotation.main( x3, y3, x4, y4, xf, yf, d )
    redLine = draw_line.main( redPoints[ 0 ].x, redPoints[ 0 ].y, redPoints[ 1 ].x, redPoints[ 1 ].y )
    greenLine = draw_line.main( greenPoints[ 0 ].x, greenPoints[ 0 ].y, greenPoints[ 1 ].x, greenPoints[ 1 ].y )
    image = add_to_image.main( image, redLine, 255, 0, 0 )
    image = add_to_image.main( image, greenLine, 0, 255, 0 )

    write_ppm.main( image, 'test' )
    print ('Finish')
コード例 #5
0
def Rotate(boardsize_x, boardsize_y, x1, y1, x2, y2, x3, y3, x4, y4, xf, yf,
           d):

    print('Starting')

    image = one_color.main(boardsize_x, boardsize_y, 245, 245, 245)
    redPoints = rotation.main(x1, y1, x2, y2, xf, yf, d)
    greenPoints = rotation.main(x3, y3, x4, y4, xf, yf, d)
    redLine = draw_line.main(redPoints[0].x, redPoints[0].y, redPoints[1].x,
                             redPoints[1].y)
    greenLine = draw_line.main(greenPoints[0].x, greenPoints[0].y,
                               greenPoints[1].x, greenPoints[1].y)
    image = add_to_image.main(image, redLine, 255, 0, 0)
    image = add_to_image.main(image, greenLine, 0, 255, 0)

    write_ppm.main(image, 'test')
    print('Finish')
コード例 #6
0
def main( x1, y1, x2, y2, xt, yt, d, xs, ys, xTrans, yTrans ):

    line = rotation.main( x1, y1, x2, y2, xt, yt, d )
    length = len( line )
    line = scale.main( line[ 0 ].x, line[ 0 ].y, line[ length - 1 ].x, line[ length - 1 ].y, xt, yt, xs, ys )
    length = len( line )
    line = translation.main( line[ 0 ].x, line[ 0 ].y, line[ length - 1 ].x, line[ length - 1 ].y, xTrans, yTrans )

    return line
コード例 #7
0
def main( x1, y1, x2, y2, x3, y3, xt, yt, xf, yf, d, xs, ys ):

    points = []
    temp = one_color.struc()

    line1 = translation.main( x1, y1, x2, y2, xt, yt )
    line2 = translation.main( x2, y2, x3, y3, xt, yt )
    line3 = translation.main( x3, y3, x1, y1, xt, yt )

    line1 = rotation.main( line1[ 0 ].x, line1[ 0 ].y, line1[ 1 ].x, line1[ 1 ].y, xf, yf, d )
    line2 = rotation.main( line2[ 0 ].x, line2[ 0 ].y, line2[ 1 ].x, line2[ 1 ].y, xf, yf, d )
    line3 = rotation.main( line3[ 0 ].x, line3[ 0 ].y, line3[ 1 ].x, line3[ 1 ].y, xf, yf, d )

    line1 = scale.main( line1[ 0 ].x, line1[ 0 ].y, line1[ 1 ].x, line1[ 1 ].y, xf, yf, xs, ys )
    line2 = scale.main( line2[ 0 ].x, line2[ 0 ].y, line2[ 1 ].x, line2[ 1 ].y, xf, yf, xs, ys )
    line3 = scale.main( line3[ 0 ].x, line3[ 0 ].y, line3[ 1 ].x, line3[ 1 ].y, xf, yf, xs, ys )

    
    line = fill_polygon.main( line1[ 0 ].x, line1[ 0 ].y, line2[ 0 ].x, line2[ 0 ].y, line3[ 0 ].x, line3[ 0 ].y )
    
    return line
コード例 #8
0
def main(x1, y1, x2, y2, xt, yt, xf, yf, d, xs, ys):

    line = translation.main(x1, y1, x2, y2, xt, yt)

    line = rotation.main(line[0].x, line[0].y, line[1].x, line[1].y, xf, yf, d)

    line = scale.main(line[0].x, line[0].y, line[1].x, line[1].y, xf, yf, xs,
                      ys)

    line = draw_line.main(line[0].x, line[0].y, line[1].x, line[1].y)

    return line
コード例 #9
0
def main( x1, y1, x2, y2, xt, yt, xf, yf, d, xs, ys ):

    line = translation.main( x1, y1, x2, y2, xt, yt )

    line = rotation.main( line[ 0 ].x, line[ 0 ].y, line[ 1 ].x, line[ 1 ].y, xf, yf, d )

    line = scale.main( line[ 0 ].x, line[ 0 ].y, line[ 1 ].x, line[ 1 ].y, xf, yf, xs, ys )
    

    line = draw_line.main( line[ 0 ].x, line[ 0 ].y, line[ 1 ].x, line[ 1 ].y )
    

    return line