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
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
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
def test_main_objects(): """Test PREDICTION_SERVER validation.""" scale.PREDICTION_SERVER = "server" scale.DEPLOYMENT = "deployment" scale.K8sClient = MagicMock() scale.Scaling = MagicMock() scale.main() assert scale.K8sClient.call_count == 1 assert scale.Scaling.call_count == 1
def Scale( boardsize_x, boardsize_y, x1, y1, x2, y2, x3, y3, x4, y4, xt, yt, xs, ys ): print ('Starting') image = one_color.main( boardsize_x, boardsize_y, 245, 245, 245 ) redPoints = scale.main( x1, y1, x2, y2, xt, yt, xs, ys ) greenPoints = scale.main( x3, y3, x4, y4, xt, yt, xs, ys ) 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')
def main(d, xl, yl, sf, args): display = [] transP = [] scaleP = [] temp = one_color.struc() #get projection points line = projection.main(d, args) length = len(line) #Find center point and max values xMax = line[0].x xMin = line[0].x yMax = line[0].y yMin = line[0].y for i in range(length): if line[i].x > xMax: xMax = line[i].x if line[i].x < xMin: xMin = line[i].x if line[i].y > yMax: yMax = line[i].y if line[i].x < xMin: yMin = line[i].y xc = (xMax + xMin) / 2 yc = (yMax + yMin) / 2 #Find translation amount based on center xt = xl - xc yt = yl - yc #Composite #translate, scale, and draw a line based on the points found for i in range(0, len(line) - 1, 2): point = translation.main(line[i].x, line[i].y, line[i + 1].x, line[i + 1].y, xt, yt) for i in range(len(point)): temp.x = point[i].x temp.y = point[i].y transP.append(copy.deepcopy(temp)) for i in range(0, len(transP) - 1, 2): point = scale.main(transP[i].x, transP[i].y, transP[i + 1].x, transP[i + 1].y, xl, yl, sf, sf) for i in range(len(point)): temp.x = point[i].x temp.y = point[i].y scaleP.append(copy.deepcopy(temp)) for i in range(0, len(scaleP) - 1, 2): point = draw_line.main(scaleP[i].x, scaleP[i].y, scaleP[i + 1].x, scaleP[i + 1].y) for i in range(len(point)): temp.x = point[i].x temp.y = point[i].y display.append(copy.deepcopy(temp)) return display
def Scale(boardsize_x, boardsize_y, x1, y1, x2, y2, x3, y3, x4, y4, xt, yt, xs, ys): print('Starting') image = one_color.main(boardsize_x, boardsize_y, 245, 245, 245) redPoints = scale.main(x1, y1, x2, y2, xt, yt, xs, ys) greenPoints = scale.main(x3, y3, x4, y4, xt, yt, xs, ys) 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')
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
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
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
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
def test_main_deployment(): """Test PREDICTION_SERVER validation.""" scale.PREDICTION_SERVER = "server" scale.DEPLOYMENT = None with pytest.raises(Exception): scale.main()
def test_main_prediction(): """Test PREDICTION_SERVER validation.""" scale.PREDICTION_SERVER = None with pytest.raises(Exception): scale.main()