예제 #1
0
def closest_point_on_line(start, end, point):
    """ projection of the point to the line

    :param [int] start:
    :param [int] end:
    :param [int] point:
    :return [int]:

    >>> closest_point_on_line([0, 0], [1, 2], [0, 2])
    array([ 0.8,  1.6])
    """
    start, end, point = [np.array(a) for a in [start, end, point]]
    line = pl_line.Line(start, (end - start))
    proj = np.array(line.project(point))
    return proj
예제 #2
0
def closest_point_on_line(start, end, point):
    """ projection of the point to the line

    :param list(int) start: line starting point
    :param list(int) end: line ending point
    :param list(int) point: point for extimation
    :return list(int): point on the line

    >>> closest_point_on_line([0, 0], [1, 2], [0, 2])
    array([ 0.8,  1.6])
    """
    start, end, point = [np.array(a) for a in [start, end, point]]
    line = pl_line.Line(start, (end - start))
    proj = np.array(line.project(point))
    return proj