Skip to content

Commit b6c6ae7

Browse files
committed
still unpublished but updates posts II
1 parent 28493eb commit b6c6ae7

File tree

7 files changed

+75
-23
lines changed

7 files changed

+75
-23
lines changed

_posts/UNPUBLISHED_2025-01-22-geometric-fitting_intuition.md renamed to _posts/UNPUBLISHED_2025-01-22-geometric-fitting-intuition.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,35 @@
11
---
22
title: Geometric fitting intuition
33
tags: [math, geometry]
4-
style: filled
4+
style: fill
55
color: warning
66
description: A resourceful least-squares Taylor-based torus fitting algorithm.
77
---
88

9-
<img src="../assets/blog_images/2025-01-22-geometric-fitting_intuition/circle.png" alt="circle">
9+
<img src="../assets/blog_images/2025-01-22-geometric-fitting-intuition/circle.png" alt="circle">
1010

1111
## Introduction
1212

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] (HREF A REF. [1]).
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].
1414

1515
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">
1617
$$
17-
ax + by + c = 0
18+
ax + by + c = 0,
1819
$$
19-
20+
</div>
2021
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...
2122

2223
Thus, the least-squares fitting problem for a line is:
24+
<div align="center">
2325
$$
2426
E(a, b, c) = \sum_{i=1}^{m} (ax_i + by_i + c)^2
2527
$$
28+
</div>
2629

2730
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.
2831

29-
By differentiating $$E(\cdot)$$ with respect to the unknowns and setting it equal to 0, we get (thanks to the equation) three linear equations in the unknowns.
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.
3033

3134
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.
3235

@@ -42,11 +45,11 @@ To the benefict of better visualization, you can access the post main content in
4245
<div id="viewerContainer align-items-center">
4346
<div id="pdf-viewer" class="mt-6"></div>
4447
</div>
45-
<h4 class="font-weight-bold"><a target="_blank" href="{{ '/assets/blog_pdfs/2025-01-22-geometric-fitting_intuition/geometric_fitting_intuition.pdf' }}">Open as PDF</a></h4>
48+
<h4 class="font-weight-bold" style="text-align: right; margin-top: 5px"><a target="_blank" href="{{ '/assets/blog_pdfs/2025-01-22-geometric-fitting-intuition/geometric-fitting-intuition.pdf' }}">Open as PDF</a></h4>
4649
</div>
4750

4851
<script>
49-
var url = '../assets/blog_pdfs/2025-01-22-geometric-fitting_intuition/geometric_fitting_intuition.pdf';
52+
var url = '../assets/blog_pdfs/2025-01-22-geometric-fitting-intuition/geometric-fitting-intuition.pdf';
5053

5154
pdfjsLib.getDocument(url).promise.then(function (pdf) {
5255
var viewer = document.getElementById('pdf-viewer');
@@ -90,9 +93,7 @@ To the benefict of better visualization, you can access the post main content in
9093

9194
We now have a slightly more formed intuition about this topic, although so far we have only glimpsed the world of geometric fitting.
9295

93-
![torus2](../assets/blog_images/2025-01-22-geometric-fitting_intuition/torus2.jpg)
94-
95-
__A work in progress__
96+
__A work in progress...__
9697

9798
## References
9899

Lines changed: 62 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,84 @@
11
---
22
title: Torus fitting
33
tags: [math, geometry]
4-
style: filled
4+
style: fill
55
color: info
66
description: A resourceful least-squares Taylor-based torus fitting algorithm.
77
---
88

9-
<!--<img src="../assets/blog_images/2025-01-22-torus-fit/torus.png" alt="torus" width="64" height="64">-->
109
<img src="../assets/blog_images/2025-01-22-torus-fit/torus.png" alt="torus">
1110

1211
## Introduction
1312

14-
In our previous [post](URL AL POST DE GEOMETRIC FITTING INTUITION) we grasped the topic of geometric fitting of various entity to a set of observed data points.
13+
In our previous [post](./geometric-fitting-intuition), we explored the topic of geometric fitting of various entities to a set of observed data points.
1514

16-
When we want to deal with the fitting of an uncentered (or even unaligned with the horizontal XY plane) torus, which si useful in come metrology applications of cilindyral pàrts, one encounter with a non-linear eqution that must be optimized through methods like Newton-raphson, gradient descrnt, gauss-newton or Levenbeg-marquardt (see [6]).
15+
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]).
1716

18-
NEvertheles, it may be benefitial to develop an alternative approach using the tools formulated some centuries ago by Brook Taylor, in order to encontrar enfoques lineales muy eficientes que muchas siempre nos hacen la vida más fácil.
17+
Nevertheless, it may be beneficial to develop an alternative approach using the tools formulated centuries ago by Brook Taylor, in order to find very efficient linear approaches that often make our lives easier.
1918

2019
## Paper
2120

22-
TO the benefict of better visualization, you can access the post main content in the LaTex PDF attached below:
21+
To the benefict of better visualization, you can access the post main content in the LaTex PDF attached below:
2322

24-
**AQUÍ INSERTAR EL PDF DEL LATEX MEDIANTE SCRIPT.JS COMO EL CV DE ALESORDO**
23+
<script src="/assets/js/pdf.js"></script>
24+
25+
<div class="container text-center" id="pdf-container" style="min-height: 100%;">
26+
<div id="viewerContainer align-items-center">
27+
<div id="pdf-viewer" class="mt-6"></div>
28+
</div>
29+
<h4 class="font-weight-bold" style="text-align: right; margin-top: 5px"><a target="_blank" href="{{ '/assets/blog_pdfs/2025-01-22-torus-fit/torus-fit.pdf' }}">Open as PDF</a></h4>
30+
</div>
31+
32+
<script>
33+
var url = '../assets/blog_pdfs/2025-01-22-torus-fit/torus-fit.pdf';
34+
35+
pdfjsLib.getDocument(url).promise.then(function (pdf) {
36+
var viewer = document.getElementById('pdf-viewer');
37+
38+
for (var pageNumber = 1; pageNumber <= pdf.numPages; pageNumber++) {
39+
var pageContainer = document.createElement('div');
40+
pageContainer.className = 'pdf-page';
41+
42+
var canvas = document.createElement('canvas');
43+
canvas.className = 'pdf-page-canvas';
44+
pageContainer.appendChild(canvas);
45+
46+
viewer.appendChild(pageContainer);
47+
48+
renderPage(pageNumber, canvas, pdf);
49+
}
50+
});
51+
52+
function renderPage(pageNumber, canvas, pdf) {
53+
pdf.getPage(pageNumber).then(function (page) {
54+
var viewport = page.getViewport({ scale: 0.2 });
55+
var scale = canvas.clientWidth / viewport.width;
56+
57+
var scaledViewport = page.getViewport({ scale: scale });
58+
59+
var context = canvas.getContext('2d');
60+
canvas.height = scaledViewport.height;
61+
canvas.width = scaledViewport.width;
62+
63+
var renderContext = {
64+
canvasContext: context,
65+
viewport: scaledViewport,
66+
};
67+
68+
page.render(renderContext);
69+
});
70+
}
71+
</script>
2572

2673
## Experiments:
2774

28-
The code was implemented in C++ using STD and Eigen. In this section we present some self-expplained results and perform a subjective quality assessment of the proposed method.
75+
The code was implemented in C++ using STL and Eigen. In this section, we present some self-explanatory results and perform a subjective quality assessment of the proposed method.
2976

30-
## COnclusiones and future work.
31-
The workaraound _does the trick_; NOS PERMITE ajustar a una nube de puntos en el espacio 3D de manera eficiente y robusta un toroide descentrado. EL ajuste de un toroide cuyo plano frontal de simetría tenga una orientación arbitraria complica enormemente el problema; la ecuación es aún más complicada de expresar, incluso aproximadamente, de manera cerrada. Si bien es cierto que la orientación puede integrarse como un paso desligado mediante un previo ajuste de plano como el plano frontal de simetría del toroide, así como su centraje mediante la aproximación con el cálculo del centroide de los puntos, encapsular enteramente la optimización en una formulación rigurosa esta abierta a una discusión como esta. Para una cercamiento a este tema ver (CITAR A TRABAJO PAPER DE ESE AJUSTE TOROIDE MÉTODO NOVEDOSO).
77+
## Conclusions and Future Work:
78+
79+
The workaround _does the trick_; it allows us to fit a set of points in 3D space to an off-centered torus efficiently and robustly. Fitting a torus whose front symmetry plane has an arbitrary orientation complicates the problem significantly; the equation becomes even more complicated to express, even approximately, in a closed form. While the orientation can be integrated as a separate step by first fitting a plane as the torus's front symmetry plane, along with centering it using centroid approximation of the points, encapsulating the optimization entirely in a rigorous formulation is open for further discussion, such as the one presented here. For further exploration of this topic, refer to [7].
80+
81+
__A work in progress...__
3282

3383
## References
3484

@@ -43,5 +93,5 @@ The workaraound _does the trick_; NOS PERMITE ajustar a una nube de puntos en el
4393
[5] https://mathworld.wolfram.com/Torus.html
4494

4595
[6] https://www.geometrictools.com/Documentation/TorusFitting.pdf
46-
47-
...
96+
97+
[7] ...

assets/TODO.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@
88
- Algo relacionado con los segundos que quedan de año, con la hora actual de cada region, visitas totales, etc. En la página principal.
99
- Zoom aislado en el visor de PDF
1010
- Refractorizar para no meter en el markdown tanto javascript/html.
11+
- Habilitar mediante tag en el .md la posibilidad de añadir una foto miniatura en la previsualización del post del blog

0 commit comments

Comments
 (0)