CircleFit API
Functions
CircleFit.Circle
— TypeCircle
Represents a fitted circle characterized by position
(center position of the fitted circle) and radius
of the fitted circle. The field points
refers to the data the model is fit to. Points are stored as a matrix (number of points, number of dimensions).
To get the coefficients one can use StatsBase.coef
and coefficient names are provided by StatsBase.coefnames
Currently only in 2D.
CircleFit.BCD_to_abr
— Methodconvert the parametric form of z+Bx+Cy+D -> (x-a)²+(y-b)²-r²
CircleFit.GRAF
— MethodGradient weighted algebraic fit
- x: vector of x coordinates
- y: vector of y coordiantes
- p0: starting values for the fit parameters(position x, position y , radius)
- kwargs are passed to
LsqFit.levenberg_marquardt
return (position x, position y , radius)
CircleFit.abr_to_BCD
— Methodconvert the parametric form of z+Bx+Cy+D <- (x-a)²+(y-b)²-r²
CircleFit.algorithm
— Methodalgorithm(model::Circle)
Gets the algorithm used for the model fitting.
CircleFit.circlefitCGA3D
— MethodTakes in points in 3D space and outputs a fitted circle in 3D based on a method in Conformal Geometric Algebra (CGA).
Input is points in 3D euclidean space with each row being a point, and each column is the xyz coordinate.
The ouput is: centrum, radius, normal_vector
where circle_cga is the CGA representation of the fitted circle, in the IPNS representation!
This method is solved by calculating the stacked matrix: M_stacked, which is solved with SVD.
Example usage:
>>> centrum, radius, normal_vector, circle_cga = circlefitCGA3D(points)
CircleFit.kasa
— MethodFit a circle to the points provided as arrays of x and y coordinates
This method uses Kåsa's method The result is a GeometryBasics::Circle
CircleFit.parametric_form
— Methodparameterize(a::Float64, b::Float64, r::Float64)
parameterize(c::Circle)
Parameterizes a circle with center a
, b
and radius r
into x, y values (mainly for plotting purposes).
CircleFit.pratt_newton
— MethodFit a circle by using the method of Pratt
https://doi.org/10.1201/EBK1439835906
https://people.cas.uab.edu/~mosya/cl/CircleFitByPratt.cpp
https://link.springer.com/article/10.1007/s10851-005-0482-8
CircleFit.taubin
— MethodFit a circle by using Taubin's method https://doi.org/10.1007/s10851-005-0482-8 Warning: not optimized
StatsAPI.fit
— Methodfit(::Type{Circle}, x::AbstractArray, y::AbstractArray; alg=:kasa)
Fit a circle to points provided as arrays of x and y coordinates using the algorithm specified by alg
(default is :kasa
). Possible algorithms include
:kasa
for Kåsa's method [1]:taubin
for using Taubin's method [2]:pratt
for using Pratt's method [3].:pratt_newton
for using a more numerically stable Pratt's method [4].
Returns a Circle
object