def applyPlaneFit(polyData, distanceThreshold=0.02, expectedNormal=None, perpendicularAxis=None, angleEpsilon=0.2, returnOrigin=False, searchOrigin=None, searchRadius=None):

    expectedNormal = expectedNormal if expectedNormal is not None else [-1,0,0]

    fitInput = polyData
    if searchOrigin is not None:
        assert searchRadius
        fitInput = cropToSphere(fitInput, searchOrigin, searchRadius)

    # perform plane segmentation
    f = planeSegmentationFilter()
    f.SetInput(fitInput)
    f.SetDistanceThreshold(distanceThreshold)
    if perpendicularAxis is not None:
        f.SetPerpendicularConstraintEnabled(True)
        f.SetPerpendicularAxis(perpendicularAxis)
        f.SetAngleEpsilon(angleEpsilon)
    f.Update()
    origin = f.GetPlaneOrigin()
    normal = np.array(f.GetPlaneNormal())

    # flip the normal if needed
    if np.dot(normal, expectedNormal) < 0:
        normal = -normal

    # for each point, compute signed distance to plane

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

    if returnOrigin:
        return polyData, origin, normal
    else:
        return polyData, normal
dataset/ETHPy150Open RobotLocomotion/director/src/python/director/segmentation.py/applyPlaneFit/swapped operands of `-`