def cropToLineSegment(polyData, point1, point2):

    line = np.array(point2) - np.array(point1)
    length = np.linalg.norm(line)
    axis = line / length

    polyData = labelPointDistanceAlongAxis(polyData, axis, origin=point1, resultArrayName='dist_along_line')
    return thresholdPoints(polyData, 'dist_along_line', [0.0, length])
dataset/ETHPy150Open RobotLocomotion/director/src/python/director/segmentation.py/cropToLineSegment/original