On cylindrical regression in three-dimensional Euclidean space
O. V. Ageev, R. A. Sharipov

TL;DR
This paper addresses the problem of fitting a cylinder to 3D data points, proposing an almost analytic solution using biquadratic averaging that simplifies the traditionally complex problem.
Contribution
It introduces a coordinate-free, near-analytic solution to the 3D cylindrical regression problem using biquadratic averaging.
Findings
Provides an almost analytic solution to cylindrical regression
Reproduces the solution in a coordinate-free form
Simplifies the fitting process compared to traditional methods
Abstract
The three-dimensional cylindrical regression problem is a problem of finding a cylinder best fitting a group of points in three-dimensional Euclidean space. The words best fitting are usually understood in the sense of the minimum root mean square deflection of the given points from a cylinder to be found. In this form the problem has no analytic solution. If one replaces the root mean square averaging by a certain biquadratic averaging, the resulting problem has an almost analytic solution. This solution is reproduced in the present paper in a coordinate-free form.
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsImage and Object Detection Techniques · Advanced Measurement and Metrology Techniques · Statistical and numerical algorithms
1. Introduction.
Linear, circular, elliptic, and ellipsoidal regression problems are presented in many sources (see [1--\kern1.0pt6]). Cylinder is one more geometric shape commonly used in machine design and in technical drawing. The cylindrical regression problem is also presented in many sources (see [7--\kern1.0pt11]). However, its solution is usually given in the form of a computational algorithm using iterative approximations. The exception is [12]. In section 7 of [12] the almost analytic solution of the problem is found. Unfortunately this solution is expressed in a semi-coordinate form associating an orthonormal triple of vectors , , with the cylinder being considered. Moreover it uses the concept of the center point , which is ambiguous for a cylinder. Our goal in this paper is to reproduce the almost analytic solution of the cylindrical regression problem from [12] in a coordinate-free form thus making it more clear and reader-friendly.
2. A cylinder and its axis.
Any cylinder is given by its radius and its axis (see Fig. 2.1). The axis of a cylinder is a straight line. Usually a straight line is given by the equation
[TABLE]
where is the radius-vector of some fixed point of the line, is some non-zero vector on the line, and is a scalar parameter. In [12] the point is denoted through and is called the center of a cylinder. As it was noted in [6] the choice of such a point is not unique. In order to avoid the ambiguity in the choice of the initial point on the line (see Fig. 2.1) the parametric equation 2.1 was replaced by the following vectorial non-parametric equation:
[TABLE]
(see [6] and [13]). The square brackets in 2.2 stand for the vector product111 It is also called the cross product, i. e. . operation. The vector is produced from by means of the formula
[TABLE]
however it has no ambiguity since the right hand side of 2.3 is invariant with respect to the transformation .
3. The statement of the problem.
Let be a group of points in the space given by their radius-vectors . The cylindrical regression problem in our case consists in finding three parameters — two vectors and and one scalar that determine the radius and the axis of a cylinder best fitting the group of points in the sense of the following biquadratically averaged deflection
[TABLE]
Here are the distances from the points to the surface of a cylinder to be found. The sign plus in 3.1 is taken for exterior points and minus for interior points. In [12] the quantity 3.1 is called the least-squares error function222 Up to the constant factor .. It differs from the standard least-squares sum
\adjustfootnotemark-2
[TABLE]
but coincides with the sum 3.3 used in [3] in the case of a circle. The sum 3.1 is equivalent to the sum 3.2 in the sense that both and tend to zero as . In this case .
4. Initial steps for solving the problem.
The distance from the point to the line 2.1, which is the axis of the cylinder (see Fig. 2.1), is given by the following formula
[TABLE]
Without loss of generality we can assume that
[TABLE]
Then, taking into account 2.3 and 4.2, from 4.1 we derive
[TABLE]
The distance from the point to the surface of the cylinder (see Fig. 2.1) is obviously given by the following formula:
[TABLE]
Let’s apply 4.4 to 3.1, As a result we obtain
[TABLE]
Definition Definition 4.1
A cylinder with the radius and the axis given by the equation 2.3, where , is called an optimal cylinder best fitting the points if the quantity 4.5 takes its minimal value.
Expanding 4.5, we derive the following expression for :
[TABLE]
The expression in the right hand side of 4.6 is biquadratic with respect to the variable . It takes its minimal value if is given by the formula
[TABLE]
The formula 4.7 coincides with the formula 117 in [12]. Substituting 4.7 back into 4.6, we derive the following formula:
[TABLE]
The formula 4.8 is similar to the formula 3.6 in [3]. The formula 4.3 yields the following expression for in 4.8:
[TABLE]
The round brackets in 4.9 denote the scalar product333 It is also called the dot product, i. e. . operation.
\adjustfootnotemark
-1 Now let’s substitute 4.9 back into 4.8. This yields
[TABLE]
Upon expanding 4.10 we find that the fourth order terms and the third order terms with respect to do cancel each other. As a result we get
[TABLE]
In 4.11 we see the following combination of the vectorial and scalar products: . Such a combination is known as the mixed product (see [13]):
[TABLE]
The mixed product is completely skew-symmetric, i. e. it is skew-symmetric with respect to any pair of its multiplicands. Therefore
[TABLE]
Combining 4.12 and 4.13, we derive
[TABLE]
Relying on 4.14, we introduce the following vector :
[TABLE]
Since (see 2.2), there is an inverse formula expressing through :
[TABLE]
Let’s apply 4.15 to 4.14 and then substitute 4.14 back into 4.11. As a result we derive the following formula for :
[TABLE]
The first two terms in 4.17 are quadratic with respect to the vector . They can be written as , where is a quadratic form:
[TABLE]
The next two terms in 4.17 are linear with respect to the vector . They can be written as , where is the following vector:
[TABLE]
The last two terms in 4.17 do not depend on . They can be written as
[TABLE]
Combining 4.18, 4.19, and 4.20, we can write 4.17 as
[TABLE]
The last term in 4.21 is a constant with respect to the variable , though it depends on the variable . Similarly is a constant vector with respect to the variable , though it depends on the variable . The quadratic form does not depend on .
Note that the formula 4.21 is similar to the formula 3.7 in [3]. The quadratic form in it coincides with the quadratic form given by the formula 2.19 in [3]. It does actually coincides with the form given by the formula 4.7 in [6], though the formula 4.7 in [6] looks somewhat different from 4.18. The form is called the non-flatness form for a group of points in [3]. It is called the non-linearity form in [6]. Both terms are consistent regarding the applications of the form in [3] and [6].
\special{html:<a
name="lem4.1">}Lemma 4.1\special{html:</a>}
The expression for in 4.18 is invariant with respect to the transformation , where is an arbitrary constant vector.
The proof is pure calculations upon substituting for into 4.18.
Now, if we define the center of mass for the group of points by means of the formula for its radius-vector
[TABLE]
then we can choose and apply Lemma 4.1. As a result we obtain the following formula for the quadratic form :
[TABLE]
The formula 4.23 means that the form is positive, i. e. . In most practical cases this form is strongly positive, i. e. for all .
It is well known (see [14]) that any quadratic form in a linear Euclidean space is associated with some symmetric operator such that
[TABLE]
In our case . Therefore the operator in 4.24 has three eigenvalues , , associated with three mutually perpendicular eigenvectors , , of the unit length: and for . Due to 4.23 the eigenvalues , , are non-negative. Without loss of generality we enumerate these eigenvalues in the non-decreasing order:
[TABLE]
Using the eigenvalues 4.25, we define the following four cases:
Our next goal is to find the minimum of the expression in the right hand side of 4.21 with respect to the variable . It is well-known that minima (as well as other extrema) of multivariate functions are defined by means of the gradient equation:
[TABLE]
Applying 4.26 to 4.21, we derive the operator equation
[TABLE]
In the non-degenerate case the operator equation 4.27 is easily solvable:
[TABLE]
The solution 4.28 of the equation 4.27 is unique. It corresponds to the minimum of the expression in the right hand side of 4.21. Substituting 4.28 back into 4.21, we derive the following formula for the minimal value of :
[TABLE]
In the degenerate cases the formula 4.29 is not applicable. The degenerate cases are served by the following lemmas.
\special{html:<a
name="lem4.2">}Lemma 4.2\special{html:</a>}
The eigenvalue of the operator in 4.24 vanishes if and only if all of the points belong to the plane given by the equation
[TABLE]
where the radius-vector of the center of mass is given by the formula 4.22.
\special{html:<a
name="lem4.3">}Lemma 4.3\special{html:</a>}
If the eigenvalue of the operator in 4.24 is equal to zero, then the vector given by the formula 4.19 is perpendicular to the corresponding eigenvector , i. e. .
Demonstration Proof of Lemma 4.2
Due to 4.24 the equality implies . Therefore, applying the formula 4.23, we derive
[TABLE]
The sum of the squares of real numbers is equal to zero if and only if each number is equal to zero. Hence 4.31 implies for all , i. e. the the radius vector of each point in the group obeys the equation 4.30. Lemma 4.2 is proved.∎
Demonstration Proof of Lemma 4.3
Let’s calculate the scalar product using 4.19:
[TABLE]
Applying 4.22 to the formula 4.32, we bring it to
[TABLE]
Since , Lemma 4.2, which is already proved, yields . Hence the last sum in 4.33 is equal to zero, which implies . This means that Lemma 4.3 is proved. ∎
Note that in the double degenerate case Lemma 4.2 says that the points belong to the intersection of two planes given by the equations
[TABLE]
The intersection of the planes 4.34 is the straight line passing through the center of mass point and directed along the vector . It is clear that the solution of the best fitting cylinder problem in this case cannot be unique. Indeed, any cylinder whose axis is parallel to the line and whose surface comprises the line is a best fitting cylinder for the group of points belonging to the line .
In the triple degenerate case Lemma 4.2 says that the points belong to the intersection of three planes given by the equations
[TABLE]
The intersection of the planes 4.35 is a set consisting of exactly one point which is the center of mass of the points . Therefore in this case the points do coincide with each other and with their center of mass. Any cylinder whose surface comprises the center of mass point is a best fitting cylinder for them.
In the simple degenerate case the solution of the best fitting cylinder problem can also be not unique. In this case Lemma 4.2 says that the points belong to the plane given by the equation
[TABLE]
Let’s imagine two parallel straight lines and on the plane 4.36 and imagine a group of points belonging to these two lines. There are infinitely many cylinders whose surfaces comprise two parallel straight lines and . All of them are best fitting cylinders for the points in this case.
Due to the non-uniqueness observed in the above examples we shall not consider the degenerate cases at all. Below in Section 5 we complete the solution of the problem for the non-degenerate case only which is the most practical one.
5. The solution of the problem for the non-degenerate case.
The expression 4.29 for comprises the scalar parameter and the vectorial parameter . They are given by the formulas 4.20 and 4.19 respectively. The parameter is quartic with respect to , while is quadratic with respect to . Upon substituting 4.20 and 4.19 into 4.29 we get an expression for which is quartic with respect to . The vector can be presented through its expansion in the orthonormal basis of the eigenvectors , , of the operator :
[TABLE]
We use upper indices , , for the components of the vector in 5.1 according to Einstein’s tensorial notation (see [13]). In terms of these components the quartic expression for can be written as follows:
[TABLE]
Through in 5.2 we denote the components of a symmetric tensor . Due to the symmetry not all of them are independent. Here is the list of independent components: , , , , , , , , , , , , , , . Using them, we can write 5.2 as
[TABLE]
The components , , of the vector in 5.1 are not independent. From 4.2 we derive the following relationship for them:
[TABLE]
The problem now is reduced to finding the minimum of the expression 5.3 under the restriction 5.4. Taking and for independent variables and using 5.4, one can express as a function . Then
[TABLE]
The minimum of 5.3 is determined by the following two equations:
[TABLE]
When calculating the derivatives 5.6 we take into account 5.5. As a result we derive two homogeneous polynomial equations of the fourth degree:
[TABLE]
Taking and for independent variables and acting in a similar way as above, we derive the other two homogeneous polynomial equations of the fourth degree
[TABLE]
Then we take and for independent variables and repeat the procedure. As a result we obtain two more homogeneous polynomial equations of the fourth degree:
[TABLE]
Not all of the equations 5.7, 5.8, and 5.9 are independent, e. g. we have the following relationships for the polynomials in them:
[TABLE]
The explicit expressions for these polynomials are given in a machine-readable form in the ancillary file polynomials.txt.
The equations 5.7, 5.8, 5.9 along with the equation 5.4 are sufficient for finding a unit vector corresponding to the minimum of in 5.3. This minimum does exist due to the Weierstrass’s extreme value theorem (see [15]) since in 5.3 is a continuous function on the unit sphere 5.4, which is a compact set. We say that the solution given by the equations 5.7, 5.8, 5.9, and 5.4 is almost analytic since it is not given by explicit formulas.
6. Summary and conclusions.
Once the vector solving the equations 5.7, 5.8, 5.9, and 5.4 and providing the minimal value for in 5.3 is found (either numerically or by means of symbolic computations), we apply it in order to calculate in 4.28. Then we substitute into 4.16 and calculate . Using and , we calculate in 4.3. And finally, we substitute into 4.7 and calculate the radius of the cylinder best fitting the points which were initially given.
The above solution of the cylindrical regression problem is a little bit more close a completely analytic solution than the original one in [12]. We expect that some day, using prospective computers and packages for symbolic computations, one would be able to resolve the equations 5.7, 5.8, 5.9, and 5.4 analytically in their general form, i. e. keeping symbolic coefficients , , , , , , , , , , , , , , in 5.3. But even in this case it’s quite likely that the solution obtained would be very huge and not human-observable.
The reference list from the paper itself. Each links out to its DOI / PubMed record.
- 11 Gander W., Golub G. H., Strebel R. , Least-squares fitting of circles and ellipses , BIT Numerical Mathematics 34 ( 1994 ), no. 4 , 558–578 .
- 22 Jacquelin J. , Regressions et trajectoires en 3D , online resource doc/31477970 at scribd.com , ( 2002, 2011. ).
- 33 Sharipov R. A. , Algorithms for laying points optimally on a plane and a circle , e-print ar Xiv:0705.0350 .
- 44 Reza A., Sengupta A. S. , Least square ellipsoid fitting using iterative orthogonal transformations , e-print ar Xiv:1704.04877 .
- 55 Anwar R., Hamilton M., Nadolsky P. M. , Fast ellipsoidal fitting of discrete multidimensional data , e-print ar Xiv:1901.05511 .
- 66 Ageev O. V., Sharipov R. A. , On linear regression in three-dimensional Euclidean space , e-print ar Xiv:1907.06009 .
- 77 Sherrod Ph. , Cylindrical regression – fit a cylinder to data points , online resource cylinder.htm at nlreg.com .
- 88 Abeles P. , Fit cylinder to points , java class Fit Cylinder To Points_ F 64 at georegression.org , ( 2011, 2019. ).
