[Op...] Posted July 24 Share Posted July 24 I want to know the exact algorithm used. I can guess what a LSQ fit to a plane would be, but I don't think there's a direct solution for cylinders so perhaps it's some optimizer? Also the manual mentions gaussian averages, I'm not really sure what that means in this context. Link to comment Share on other sites More sharing options...
[Ri...] Posted July 24 Share Posted July 24 "The Gaussian average, often referred to as the mean of a Gaussian distribution, is a key concept in statistics that represents the central tendency of a normally distributed dataset." All scan/point data are datasets. Link to comment Share on other sites More sharing options...
[Cl...] Posted July 24 Share Posted July 24 The Gaussian distribution, also known as the normal distribution, is a continuous probability distribution that is symmetric around its mean. This distribution is characterized by its bell-shaped curve, which is why it is often referred to as the bell curve. The Gaussian distribution is widely used in statistics and probability theory due to its unique properties and its ability to model many natural phenomena. Key Features Symmetry: The Gaussian distribution is symmetric around its mean, meaning the left side of the distribution mirrors the right side. Mean, Median, and Mode: In a Gaussian distribution, the mean, median, and mode are all equal and located at the center of the distribution. Bell-shaped Curve: The curve is bell-shaped, indicating that most of the observations cluster around the central peak, and the probabilities for values further away from the mean taper off equally in both directions. Standard Deviation: The spread of the distribution is determined by the standard deviation. About 68% of the data falls within one standard deviation of the mean, 95% within two standard deviations, and 99.7% within three standard deviations. Link to comment Share on other sites More sharing options...
[Op...] Posted July 24 Author Share Posted July 24 So what does it mean in this context? The way the average person would fit a plane does not require a gaussian function as far as I know. Link to comment Share on other sites More sharing options...
[Cl...] Posted July 24 Share Posted July 24 A gauss plane at least in my understanding takes the average from the highest and lowest points to create the plane. Essentially the average/mean. Link to comment Share on other sites More sharing options...
[Ma...] Posted July 24 Share Posted July 24 Gauss is not just simple calculation of middle. Lets say you have a curve. Gauss will calculate bestfit to have the most points closest to nominal. So for features it also calculate value which have the most of measured points closest to calculated value. It's something about calculations of squares - more can be found on wikipedia and so on. Link to comment Share on other sites More sharing options...
[No...] Posted July 25 Share Posted July 25 That "somnething about squares" is the minimzed sum of the error squares. If you calculate the distance of every point from the calculated fitting element, then square each distance, then sum up all squares, that sum is as small as possible. Since you don't know what the fitting element will be, this is an iterative process where the result is optimized with every iteration until the deviation to the preceding result is below a certain threshold. The exact algorithm is too complicated for my brain. The article below looks interesting to me, but I don't claim I understand a tenth of it. 🤯Maybe it's helpful for math geeks, maybe it's useless. You decide. https://fabiandablander.com/r/Curve-Fitting-Gaussian.html 2 Link to comment Share on other sites More sharing options...
[Op...] Posted July 25 Author Share Posted July 25 I skimmed the article, it appears that "gaussian averages" is just that the solution to the least squares problem happens to normally distribute the errors. So it's just a distraction for those of us who don't remember the history lesson from math class perhaps? Coming from a non CMM background I never see anything about Gaussian functions when talking about anything to do with least squares. In any case that is really secondary to my main question, how do they fit non direct shapes, like a cylinder. For a plane, I am aware of a method to directly calculate the least squares solution, with no optimization required. For a cylinder, I do not believe there is a direct method. Least squares makes sense as a error/cost/loss function, but there's still the question of what optimization method that calypso uses. Do they use a starting guess? How do they get a starting guess? Do they use a global optimization algorithm? Do they explain any of this information anywhere? Link to comment Share on other sites More sharing options...
[Ri...] Posted July 25 Share Posted July 25 Here is what the robot says: To calculate the least squares fitting of a cylinder to a set of 3D points, you're essentially trying to find the axis direction, axis position, and radius that best fit the point cloud data of a cylindrical surface. The fitting minimizes the squared distances of the points from the ideal cylindrical surface. 🧮 Problem Statement Given a set of 3D points: Pi=(xi,yi,zi),i=1,2,...,NP_i = (x_i, y_i, z_i), \quad i = 1, 2, ..., N Find the cylinder axis (unit vector) v⃗\vec{v}, a point on the axis c⃗\vec{c}, and the radius rr that minimize the sum of squared distances of each point to the cylindrical surface. ⚙️ General Steps to Fit a Cylinder Using Least Squares 1. Initial Guess (Optional but Helpful) You can start with an initial guess of the axis (e.g., from PCA or RANSAC). 2. Project Points onto Plane Perpendicular to Axis Suppose the cylinder axis is along vector v⃗\vec{v}, and the closest point on the axis to each data point PiP_i is Qi=c⃗+tiv⃗Q_i = \vec{c} + t_i \vec{v}, where: ti=v⃗⋅(Pi−c⃗)t_i = \vec{v} \cdot (P_i - \vec{c}) Then the vector from the axis to the point is: r⃗i=Pi−Qi\vec{r}_i = P_i - Q_i We aim for ∣r⃗i∣≈r|\vec{r}_i| \approx r. 3. Define the Objective Function The function to minimize is: E(v⃗,c⃗,r)=∑i=1N(∣Pi−(c⃗+(v⃗⋅(Pi−c⃗))v⃗)∣−r)2E(\vec{v}, \vec{c}, r) = \sum_{i=1}^{N} \left( \left| P_i - (\vec{c} + (\vec{v} \cdot (P_i - \vec{c})) \vec{v}) \right| - r \right)^2 Which minimizes the squared difference between the point's distance from the axis and the radius. 4. Solve Using Optimization This is a non-linear least squares problem because of the radius and dot products. It’s best solved using optimization libraries like: SciPy’s least_squares or minimize in Python MATLAB’s lsqnonlin Ceres Solver (C++) You minimize the residuals: fi(v⃗,c⃗,r)=∣r⃗i∣−rf_i(\vec{v}, \vec{c}, r) = \left| \vec{r}_i \right| - r ✅ Output After optimization, you get: v⃗\vec{v}: axis direction (unit vector) c⃗\vec{c}: a point on the axis rr: radius of the cylinder 🔁 Simplified Alternative: Axis via PCA If the cylinder is well-aligned, you can: Use PCA on the point cloud to get the axis direction (first principal component). Project points onto a plane orthogonal to that axis. Fit a 2D circle to the projected points using standard least squares (e.g., Pratt or Taubin method). The circle’s center + axis defines the cylinder axis. Would you like a Python implementation of this approach (with or without PCA simplification)? Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in