Skip to content

Commit 1bcd6c7

Browse files
committed
Nuevo post
1 parent a5de233 commit 1bcd6c7

File tree

6 files changed

+108
-1
lines changed

6 files changed

+108
-1
lines changed

_posts/2025-01-26-torus-fit.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ description: A resourceful least-squares Taylor-based torus fitting algorithm.
1010

1111
## Introduction
1212

13-
In our post [geometric-fitting-intuition](./geometric-fitting-intuition), we explored the topic of geometric fitting of various entities to a set of observed data points.
13+
In our post [geometric-fitting-intuition-pt2](./geometric-fitting-intuition-pt2), we explored the topic of geometric fitting of various entities to a set of observed data points.
1414

1515
When dealing with the fitting of an uncentered (or even unaligned with the horizontal XY plane) torus, which is useful in some metrology applications of cylindrical parts, one encounters a non-linear equation that must be optimized using methods like Newton-Raphson, gradient descent, Gauss-Newton, or Levenberg-Marquardt (see [6]).
1616

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
---
2+
title: Geometric fitting intuition pt. II
3+
tags: [math, geometry]
4+
style: fill
5+
color: warning
6+
description: A friendly introduction to geometric fitting algorithms.
7+
---
8+
9+
<img src="../assets/blog_images/2025-01-27-geometric-fitting-intuition-pt2/circle.png" alt="circle">
10+
11+
## Introduction
12+
13+
Fitting algorithms are a widely discussed topic in geometry processing. Circle fitting algorithms like Taubin, Chernov, and others, as well as plane fitting algorithms using least-squares, are commonly used in 2D and 3D computer vision applications to measure geometric entities or perform registration. For a comprehensive bibliographic review on this topic, see [1].
14+
15+
Let’s imagine a classic problem: we have a set of 2D points and we want to fit a straight line to them. Furthermore, the line that **best** fits them, in a certain sense of the word. The closed-form least-squares approach is one way of conceptualizing this **optimal fit**. The equation of a line is:
16+
<div align="center">
17+
$$
18+
ax + by + c = 0,
19+
$$
20+
</div>
21+
and it is an affine mapping with respect to the $$ x $$ and $$ y $$ variables, meaning that it is not a linear function. However, the mapping is linear with respect to the $ a $, $ b $, and $ c $ variables, which will be useful to us...
22+
23+
Thus, the least-squares fitting problem for a line is:
24+
<div align="center">
25+
$$
26+
E(a, b, c) = \sum_{i=1}^{m} (ax_i + by_i + c)^2
27+
$$
28+
</div>
29+
30+
This can be solved in one step because it represents a parabola, which is strictly convex, as the error function is quadratic in the unknowns.
31+
32+
By differentiating $$E(\cdot)$$ with respect to the unknowns and setting it equal to 0, we get (thanks to the nature of this particular equation) three linear equations in the unknowns.
33+
34+
However, curves are usually higher-order functions than straight lines, so the error function, in the form of the sum of perpendicular distances to a curve, is not usually quadratic. Therefore, these geometric errors cannot be minimized "in a single step," but rather by using iterative nonlinear methods. However, through different approaches, it is possible to "quite well" approximate the minimization of **geometric error** with that of an **algebraic error**, typically quadratic. This categorizes fitting methods into two main families: algebraic and geometric. In general, algebraic error is a good approximation of geometric error, even as the initial seed for iterative geometric methods. See [2] for a continued discussion of these concepts.
35+
36+
We will gain some insight into various important geometric fitting algorithms.
37+
38+
## Paper
39+
40+
To the benefict of better visualization, you can access the post main content in the LaTex PDF attached below:
41+
42+
<script src="/assets/js/pdf.js"></script>
43+
44+
<div class="container text-center" id="pdf-container" style="min-height: 100%;">
45+
<div id="viewerContainer align-items-center">
46+
<div id="pdf-viewer" class="mt-6"></div>
47+
</div>
48+
<h4 class="font-weight-bold" style="text-align: right; margin-top: 5px"><a target="_blank" href="{{ '/assets/blog_pdfs/2025-01-27-geometric-fitting-intuition-pt2/geometric-fitting-intuition-pt2.pdf' }}">Open as PDF</a></h4>
49+
</div>
50+
51+
<script>
52+
var url = '../assets/blog_pdfs/2025-01-27-geometric-fitting-intuition-pt2/geometric-fitting-intuition-pt2.pdf';
53+
54+
pdfjsLib.getDocument(url).promise.then(function (pdf) {
55+
var viewer = document.getElementById('pdf-viewer');
56+
57+
for (var pageNumber = 1; pageNumber <= pdf.numPages; pageNumber++) {
58+
var pageContainer = document.createElement('div');
59+
pageContainer.className = 'pdf-page';
60+
61+
var canvas = document.createElement('canvas');
62+
canvas.className = 'pdf-page-canvas';
63+
pageContainer.appendChild(canvas);
64+
65+
viewer.appendChild(pageContainer);
66+
67+
renderPage(pageNumber, canvas, pdf);
68+
}
69+
});
70+
71+
function renderPage(pageNumber, canvas, pdf) {
72+
pdf.getPage(pageNumber).then(function (page) {
73+
var viewport = page.getViewport({ scale: 0.2 });
74+
var scale = canvas.clientWidth / viewport.width;
75+
76+
var scaledViewport = page.getViewport({ scale: scale });
77+
78+
var context = canvas.getContext('2d');
79+
canvas.height = scaledViewport.height;
80+
canvas.width = scaledViewport.width;
81+
82+
var renderContext = {
83+
canvasContext: context,
84+
viewport: scaledViewport,
85+
};
86+
87+
page.render(renderContext);
88+
});
89+
}
90+
</script>
91+
92+
## Conclusions and Future Work
93+
94+
We now have a slightly more formed intuition about this topic, although so far we have only glimpsed the world of geometric fitting.
95+
96+
__A work in progress...__
97+
98+
## References
99+
100+
[1] Chernov, N. (2010). *Circular and Linear Regression: Fitting Circles and Lines by Least Squares*. Boca Raton: Chapman and Hall-CRC. ISBN 978-1-439-83590-6. [Journal of the Royal Statistical Society Series A: Statistics in Society, Volume 174, Issue 3, July 2011, Page 843.](https://doi.org/10.1111/j.1467-985X.2011.00709_4.x)
101+
102+
[2] Birchfield, S. (2017). *Image Processing and Analysis*. 1st Edition. Cengage Learning. ISBN 978-1285179520.
103+
104+
[3] Schneider, P., & Eberly, D. H. (2002). *Geometric Tools for Computer Graphics*. 1st Edition. Morgan Kaufmann. ISBN 978-1558605947.
105+
106+
[4] Eberly, D. (2020). *Robust and Error-Free Geometric Computing*. 1st Edition. CRC Press. ISBN 978-0367352943.
107+
13.6 KB
Loading

0 commit comments

Comments
 (0)