# def transfrom(self, x, y):
#     return self.transfrom_2D(x, y)
#     #return self.transform_perspective(x, y)
#
#
# def transfrom_2D(self, x, y):
#     return x, y
#
#
# def transform_perspective(self, x, y):
#     # To Do
#     lin_y = y / self.height * self.perspective_point_y
#     if lin_y > self.perspective_point_y:
#         lin_y = self.perspective_point_y
#
#     diff_x = x - self.perspective_point_x
#     diff_y = self.perspective_point_y - lin_y
#     # proportion_y = # 1 when diff_y == self.perspective_point_y / 0 when diff_y= 0
#     proportion_factor = diff_y / self.perspective_point_y
#     proportion_factor = pow(proportion_factor, 2)
#
#     tr_x = self.perspective_point_x + diff_x * proportion_factor
#     tr_y = self.perspective_point_y - proportion_factor * self.perspective_point_y
#     return int(tr_x), int(tr_y)

def transform(self, x, y):
    # return self.transform_2D(x, y)
    return self.transform_perspective(x, y)


def transform_2D(self, x, y):
    return int(x), int(y)


def transform_perspective(self, x, y):
    lin_y = y * self.perspective_point_y / self.height
    if lin_y > self.perspective_point_y:
        lin_y = self.perspective_point_y

    diff_x = x - self.perspective_point_x
    diff_y = self.perspective_point_y - lin_y
    factor_y = diff_y / self.perspective_point_y  # 1 when diff_y == self.perspective_point_y / 0 when diff_y = 0
    factor_y = pow(factor_y, 4)

    tr_x = self.perspective_point_x + diff_x * factor_y
    tr_y = self.perspective_point_y - factor_y * self.perspective_point_y

    return int(tr_x), int(tr_y)
