def segmentGround(polyData, groundThickness=0.02, sceneHeightFromGround=0.05):
    ''' A More complex ground removal algorithm. Works when plane isn't
    preceisely flat. First clusters on z to find approx ground height, then fits a plane there
    '''

    searchRegionThickness = 0.5

    zvalues = vtkNumpy.getNumpyFromVtk(polyData, 'Points')[:,2]
    groundHeight = np.percentile(zvalues, 5)

    vtkNumpy.addNumpyToVtk(polyData, zvalues.copy(), 'z')
    searchRegion = thresholdPoints(polyData, 'z', [groundHeight - searchRegionThickness/2.0, groundHeight + 2.0/searchRegionThickness])

    updatePolyData(searchRegion, 'ground search region', parent=getDebugFolder(), colorByName='z', visible=False)

    _, origin, normal = applyPlaneFit(searchRegion, distanceThreshold=0.02, expectedNormal=[0,0,1], perpendicularAxis=[0,0,1], returnOrigin=True)

    points = vtkNumpy.getNumpyFromVtk(polyData, 'Points')
    dist = np.dot(points - origin, normal)
    vtkNumpy.addNumpyToVtk(polyData, dist, 'dist_to_plane')

    groundPoints = thresholdPoints(polyData, 'dist_to_plane', [-groundThickness/2.0, groundThickness/2.0])
    scenePoints = thresholdPoints(polyData, 'dist_to_plane', [sceneHeightFromGround, 100])

    return origin, normal, groundPoints, scenePoints
dataset/ETHPy150Open RobotLocomotion/director/src/python/director/segmentation.py/segmentGround/swapped operands of `/`