Given three colinear points p, q, r, the function checks if point q
    lies on line segment "pr"

    :param point_p:
    :type point_p: models.Point
    :param point_q:
    :type point_q: models.Point
    :param point_r:
    :type point_r: models.Point
    :return: if point r on line segment "pr"
    :rtype: bool

def on_segment(point_p, point_q, point_r):
    """
    Given three colinear points p, q, r, the function checks if point q
    lies on line segment "pr"

    :param point_p:
    :type point_p: models.Point
    :param point_q:
    :type point_q: models.Point
    :param point_r:
    :type point_r: models.Point
    :return: if point r on line segment "pr"
    :rtype: bool
    """
    if (point_q.x <= max(point_p.x, point_r.x)
            and point_q.x >= min(point_p.x, point_r.x)
            and point_q.y <= max(point_p.y, point_r.y)
            and point_q.y >= min(point_p.y, point_r.y)):
        return True
    return False