LeastSquareCircleFit

package module
v0.0.0-...-c375230 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 24, 2015 License: MIT Imports: 1 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

LeastSquareCircleFit

Golang library to compute a least square circle fit

GoDoc Go Report Card

This package implements a Circle Least Square Fit for a list of 2D-coordinates

→        ⎡ x1, x2, x3, x4, x5 ...⎤
x  =     ⎣ y1, y2, y3, y4, y5 ...⎦	

so that the resulting circle is a "best fit" to the points given.

The only exported function is

xCoordCenter, yCoordCenter, radius := CalcLeastSquareCircleFit(xArray, yArray)

which takes two arrays as arguments: the x-coords in the first and the y-coords in the second; it returns three float64: the x-coord of the circle center, the y-coord of the circle center, the radius.

Author: Stefan Schroeder Date : 2013-07-01

Implemented following the paper:

Least-Squares Circle Fit by R. Bullock, October 24, 2006 10:22 am MDT

You can find it with some googling.

Caveats

There are some divisions involved which may provoke a division by zero error. But I didn't check out how this can be done. Perhaps if you supply not enough points or all the points are identical; it's definitely a pathological case.

In this graph you can see the data points from the example (in the demo folder) in blue and the computed circle in purple.

Graph

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalcLeastSquareCircleFit

func CalcLeastSquareCircleFit(x []float64, y []float64) (float64, float64, float64)

CalcLeastSquareCircleFit computes a least square fit circle for a list of 2d-coordinates. It takes the x and y coordinates as arguments. Obviously the two argument arrays must have the same length. The function returns three values: The x,y location of the circle center and the radius of the circle.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL