finds a geometric region "model" that best fits the points p1,p2,.


specifies what fit property "prop" should be returned.


  • RegionFit is also known as sample consensus model.
  • RegionFit is typically used for fitting and reconstructing regions from a set of points.
  • RegionFit[{p1,p2,},"model"] finds a region that contains the most points pi by iteratively estimating parameters of the specified "model" from a set of points.
  • Possible 2D "model" specifications include:
  • "Line"infinite line
  • Possible 3D "model" specifications include:
  • "Line"infinite line
  • RegionFit[Point[{p1,p2,}]] is effectively equivalent to RegionFit[{p1,p2,}].
  • Vertex normals ni for points pi can be specified by Point[{p1,p2,},VertexNormals{n1,n2,}].
  • RegionFit[{p1,p2,},"model","prop"] returns the value of the fit property "prop".
  • Possible fit properties "prop" include:
  • "BestFit"the best candidate model
    "Points"set of points
    "Inliers"points fitting the candidate model
    "Outliers"points not fitting the candidate model
    "DistanceVariance"variance of distances to the candidate model
    "Distances"distances to the best candidate model
    {prop1,prop2,}several fit properties
  • The following options can be given:
  • ConfidenceLevelAutomaticdesired probability of outlier-free sample
    MethodAutomaticmethod to use
    PerformanceGoal$PerformanceGoalaspects of performance to try to optimize
    ToleranceAutomaticnumerical tolerance to use
    VertexNormalsNonevertex normals for points
    WorkingPrecisionAutomaticprecision to use in computations
  • Possible settings for Method include:
  • "RANSAC"random sample consensus
    "LMEDS"least median of squares
    "MSAC"M-estimator sample consensus
    "RRANSAC"randomized RANSAC
    "RMSAC"randomized MSAC
    "MLESAC"maximum likelihook estimation sample consensus
    "PROSAC"progressive sample consensus


open allclose all

Basic Examples  (2)

Find a circle that fits a set of points:

Show the fit:

A set of points with many outliers fitted by a cylinder:

Visualize the fitted region with the data:

Distribution of the distances of the data to the bestfit cylinder:

Scope  (15)

Data  (4)

RegionFit works on coordinates:

List of points:

Collections of points:

Oriented collections of points:

Models  (7)

Obtain an InfiniteLine that best fits a set of points:


InfiniteLine in 3D:





Properties  (4)

RegionFit gives the best fit region:

Distances of each point from the best fit region:

Variance of the distances:

Inliers and outliers:

Options  (4)

Tolerance  (1)

Use Tolerance to control the maximum distance of inliers:

WorkingPrecision  (3)

Compute the best-fit model using machine arithmetic:

Find the fit using exact numbers:

Find the fit using 30 digits of precision:

Applications  (3)

Find a best-fit parametrized region for a set of points on a circle:

Show the exact fit:

A set of points with noise:

Find a best-fit parametrized region:

Visualize the fitted region with the data:

Find the equation of a line passing through a set of points:

Properties & Relations  (1)

For near-perfect linear data, ReigonFit and Fit produce equivalent fits using LeastSquares:

Use Fit to find the equation of the line:

Use RegionFit to find the line region:

Compare the results:

Fit minimizes the least squares error across all points, while RegionFit ignores outliers:

Fit the data with an outlier:

Show the new fits:

Wolfram Research (13), RegionFit, Wolfram Language function,


Wolfram Research (13), RegionFit, Wolfram Language function,


Wolfram Language. 13. "RegionFit." Wolfram Language & System Documentation Center. Wolfram Research.


Wolfram Language. (13). RegionFit. Wolfram Language & System Documentation Center. Retrieved from


@misc{reference.wolfram_2021_regionfit, author="Wolfram Research", title="{RegionFit}", year="13", howpublished="\url{}", note=[Accessed: 24-January-2022 ]}


@online{reference.wolfram_2021_regionfit, organization={Wolfram Research}, title={RegionFit}, year={13}, url={}, note=[Accessed: 24-January-2022 ]}