def computeEdge(polyData, edgeAxis, perpAxis, binWidth=0.03):

    polyData = labelPointDistanceAlongAxis(polyData, edgeAxis, resultArrayName='dist_along_edge')
    polyData = labelPointDistanceAlongAxis(polyData, perpAxis, resultArrayName='dist_perp_to_edge')


    polyData, bins = binByScalar(polyData, 'dist_along_edge', binWidth)
    points = vtkNumpy.getNumpyFromVtk(polyData, 'Points')
    binLabels = vtkNumpy.getNumpyFromVtk(polyData, 'bin_labels')
    distToEdge = vtkNumpy.getNumpyFromVtk(polyData, 'dist_perp_to_edge')

    numberOfBins = len(bins) - 1
    edgePoints = []
    for i in xrange(numberOfBins):
        binPoints = points[binLabels == i]
        binDists = distToEdge[binLabels == i]
        if len(binDists):
            edgePoints.append(binPoints[binDists.argmax()])

    return np.array(edgePoints)
dataset/ETHPy150Open RobotLocomotion/director/src/python/director/segmentation.py/computeEdge/original