def testImportMean():
tmp_dll = cdll.LoadLibrary("/home/nick/python/dllTests/libmean.so")
summ = 0
for i in range(0, 1000):
for j in range(0, 1000):
summ += tmp_dll.mean(c_int(i), c_int(j))
return summ
input_string = 'Some short random string , Round CA 1 day - Trip'
some_random_string = input_string.split(',')[0]
input_string = input_string.split(',')[1]
trip_string = input_string.spit('-')[1]
input_string = input_string.spit('-')[0]
day_string = input_string.split(' ')[2] + ' ' + input_string.split(' ')[3]
round_string = input_string.split(' ')[0] + ' ' + input_string.split(' ')[1]
from PIL import Image
import glob
foreground_name = 'BFB_Logo.png'
foreground = Image.open(foreground_name)
foreground = foreground.convert('RGBA')
for file_name in glob.glob('*.jpg'):
print (file_name)
background_name = file_name
background = Image.open(background_name)
x = int((background.size[0] / 2) - (foreground.size[0] / 2))
y = int((background.size[1] / 2) - (foreground.size[1] / 2))
background = background.convert('RGBA')
background.paste(foreground, (x, y), mask = foreground)
background.save('__' + background_name.split('.')[0] + '.jpg','JPEG')
print('Gotovo bla-a')
#инитиализация нулевой матрицы нужной размерности
matrix = [...][...]
#инитиализация массива значений диагонали
input_massive = [...]
#заполняем диагональ
for i in range(0, len(input_massive)):
matrix[i][i] = input_massive[i]
def find2Points(circle_1, circle_2):
x_1 = circle_2[0] - circle_1[0]
y_1 = circle_2[1] - circle_1[1]
r_0 = circle_1[2]
r_1 = circle_2[2]
a = -2 * x_1
b = -2 * y_1
c = x_1 ** 2 + y_1 ** 2 + r_0 ** 2 - r_1 ** 2
x_2 = -(a * c) / (a ** 2 + b ** 2)
y_2 = -(b * c) / (a ** 2 + b ** 2)
distance = (x_2 ** 2 + y_2 ** 2) ** (0.5)
if distance > circle_1[2]:
coords = ['error']
elif distance == circle_1[2]:
coords = [x_2 + circle_1[0], y_2 + circle_1[1]]
else:
d = (r_0 ** 2 -(c ** 2) / (a ** 2 + b ** 2)) ** (0.5)
tmp = ((d ** 2) / (a ** 2 + b ** 2)) ** (0.5)
x_p1 = x_2 + b * tmp
y_p1 = y_2 - a * tmp
x_p2 = x_2 - b * tmp
y_p2 = y_2 + a * tmp
coords = [[x_p1 + circle_1[0], y_p1 + circle_1[1]], [x_p2 + circle_1[0], y_p2 + circle_1[1]]]
return coords
def sortRectangle(a, b, c, d):
tmp = []
delta = 0.000000001
coords = find2Points(a, b)
tmp += coords
if len(tmp) > 1:
coords = find2Points(a, c)
for coord in coords:
for coord_tmp in tmp:
if (coord[0] - coord_tmp[0]) ** 2 + (coord[1] - coord_tmp[1]) ** 2 < delta:
return coord
else:
return tmp
a = [-3, 2, 5]
b = [3, 2, 5]
c = [3, -2, 3]
d = [-3, -2, 3]
print(sortRectangle(a, b, c, d))