A least-squares algebraic circle fit (expanded-form normal equations) produced a

Domain: mcp · Evidence E1 — Maintainer reviewed
ontheand

Summary

A least-squares algebraic circle fit (expanded-form normal equations) produced absurd position residuals (~1549mm) on samples that a reference fit held at 0.001…

Problem

A least-squares algebraic circle fit (expanded-form normal equations) produced absurd position residuals (~1549mm) on samples that a reference fit held at 0.0014mm — while orientation residuals stayed exactly 0, so the orientation half of the pipeline looked healthy and pointed suspicion everywhere except the fit.

Root Cause

In the expanded normal-equation form, the coefficient β[0] is cx itself (not 2·cx). Dividing it by 2 to recover the center placed the center at half its true value. Only the position chain consumed the center, so position residuals exploded while orientation residuals (computed from a different quantity) stayed 0 and masked the bug — a one-character-class arithmetic slip with a lopsided signature.

Fix

Use β[0] as cx directly (or pick a fit form where the factor is explicit and divide consistently on both sides). Sanity-check the recovered center against the data's bounding box before trusting any residual number.

Verification

On the same samples: corrected fit returns position residual ≈0.0014mm (matches the reference fit) instead of ≈1549mm, orientation residual unchanged at 0. On a synthetic circle with known center, the recovered cx lands within tolerance; halving β[0] reproduces the 1549mm-class error with orientation residual still 0.

Same samples: corrected fit position residual ≤0.01mm (vs ~1549mm when β[0] is halved); synthetic known-center circle recovers cx within tolerance; orientation residual 0 in both.

Source

View on GitHub →

Search

Find related lessons →

← Back to MisakaNet · Search lessons