# Fit data into a circle

**URL:** <https://discourse.julialang.org/t/fit-data-into-a-circle/45370>\
**Category:** Statistics\
**Tags:** data, linearalgebra, fit\
**Created:** [August 22, 2020, 2:57pm UTC](https://discourse.julialang.org/t/fit-data-into-a-circle/45370 "2020-08-22T14:57:50Z")\
**Posts on this page:** 6\
**Page:** 2

<div class="post-metadata">

**Author:** ![klaff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/klaff/32/7637_2.png) [@klaff](https://discourse.julialang.org/u/klaff)\
**Post date:** [August 23, 2020, 7:34pm UTC](https://discourse.julialang.org/t/fit-data-into-a-circle/45370/22 "2020-08-23T19:34:46Z")

</div>

That’s a fascinating problem. I wonder what a 2D FFT would give you?

---

<div class="post-metadata">

**Author:** ![DanielS](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/daniels/32/17399_2.png) [@DanielS](https://discourse.julialang.org/u/DanielS)\
**Post date:** [August 26, 2020, 8:36pm UTC](https://discourse.julialang.org/t/fit-data-into-a-circle/45370/23 "2020-08-26T20:36:57Z")

</div>

I’m not sure I know how to do a 2d fft on these (x,y) pairs, but I can do one for their 2D histogram. What do you think I should be looking for? cheers!

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [August 27, 2020, 8:43am UTC](https://discourse.julialang.org/t/fit-data-into-a-circle/45370/24 "2020-08-27T08:43:36Z")

</div>

The article by Al-Sharadqah and N. Chernov [2009] Error analysis for circle fitting algorithms, reviews methods that work well for partial datasets (ex: arc of circle). N.Chernov has published code in Matlab for different methods, including Taubin (1991) method. See function: CircleFitByTaubin()

---

<div class="post-metadata">

**Author:** ![feanor12](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/feanor12/32/8212_2.png) [@feanor12](https://discourse.julialang.org/u/feanor12)\
**Post date:** [August 27, 2020, 8:46am UTC](https://discourse.julialang.org/t/fit-data-into-a-circle/45370/25 "2020-08-27T08:46:45Z")

</div>

I have implemented [Kasa’s](https://github.com/feanor12/CircleFit.jl/blob/a5c064db2ce9eef44e49237a990e2ec7a8cacdc9/src/CircleFit.jl#L24) and [Taubin’s](https://github.com/feanor12/CircleFit.jl/blob/a5c064db2ce9eef44e49237a990e2ec7a8cacdc9/src/CircleFit.jl#L49) method in the [CircleFit.jl](https://github.com/feanor12/CircleFit.jl) package.  
Taubin’s method could be optimized though, as it is not using a newton iteration to find the smallest non negative eigenvalue.

---

<div class="post-metadata">

**Author:** ![anon92994695](https://avatars.discourse-cdn.com/v4/letter/a/ce7236/32.png) [@anon92994695](https://discourse.julialang.org/u/anon92994695)\
**Post date:** [September 20, 2020, 8:07pm UTC](https://discourse.julialang.org/t/fit-data-into-a-circle/45370/26 "2020-09-20T20:07:13Z")

</div>

Can you share the data for this? I have an idea and it could be fun to do while my computer is crunching way too many numbers on my other cores.

---

<div class="post-metadata">

**Author:** ![Orbots](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/orbots/32/3392_2.png) [@Orbots](https://discourse.julialang.org/u/Orbots)\
**Post date:** [September 24, 2020, 2:08am UTC](https://discourse.julialang.org/t/fit-data-into-a-circle/45370/27 "2020-09-24T02:08:27Z")

</div>

Little late, but geometric algebra can solve this problem using the CGA model.

> **[spheresAGACSE218.pdf](https://www.ime.unicamp.br/~agacse2018/spheresAGACSE218.pdf)**
>
> 1220.25 KB

[https://github.com/chakravala/Grassmann.jl](https://github.com/chakravala/Grassmann.jl)

[Previous page](https://discourse.julialang.org/t/fit-data-into-a-circle/45370.md?page=1)
