From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
02-17-2017 11:05 AM
I'm struggling a bit on this one. I have a set of 3D points and I'm trying to best fit the center of rotation of the movement. So far I have best fitted the plane of these points but finding it for the center of rotation (or the circle) is another game. I've done some search for an algorithm but came up empty. Precision is very important so I would like to avoid doing a best fit on a best fit.
Anybody who have done something similar?
Ben64
Solved! Go to Solution.
02-17-2017 02:40 PM
Have you looked at "Fitting on a Sphere.vi"?
02-17-2017 03:04 PM
@DSPGuy wrote:
Have you looked at "Fitting on a Sphere.vi"?
Yes, and the result doesn't make any sense. It is kind od expected since the points are a circle arc. In this case it can be fitted on a lot a different spheres. I would need the specific case where the data points arc in located on the sphere great circle.
Ben64
02-18-2017 01:59 AM
Once you have the plane, reduce the data to 2D in that plane. Fitting to a sphere will fit to a circle if the data is 2D (z=0). See if that is more accurate.
What result do you expect? Is this simulated (where you know the answer) or real data (where you don't)..
@ben64 wrote:
@DSPGuy wrote:
Have you looked at "Fitting on a Sphere.vi"?
Yes, and the result doesn't make any sense. It is kind od expected since the points are a circle arc. In this case it can be fitted on a lot a different spheres. I would need the specific case where the data points arc in located on the sphere great circle.
Fittng on a shpere is a direct method (not iterative) and I thought it would find the correct answer in your case (great circle). For example, in the 2D case, (fitting a circle) there are an infinite number of spheres that fit the data, but it will pick the smallest (where the center is also in that plane).
02-18-2017 07:42 AM
altenbach a écrit :
Once you have the plane, reduce the data to 2D in that plane. Fitting to a sphere will fit to a circle if the data is 2D (z=0). See if that is more accurate.
What result do you expect? Is this simulated (where you know the answer) or real data (where you don't)..
@ben64 wrote:
@DSPGuy wrote:
Have you looked at "Fitting on a Sphere.vi"?
Yes, and the result doesn't make any sense. It is kind od expected since the points are a circle arc. In this case it can be fitted on a lot a different spheres. I would need the specific case where the data points arc in located on the sphere great circle.
Fittng on a shpere is a direct method (not iterative) and I thought it would find the correct answer in your case (great circle). For example, in the 2D case, (fitting a circle) there are an infinite number of spheres that fit the data, but it will pick the smallest (where the center is also in that plane).
These are real data from an Optitrack system, in the attached vi you can see that the center from Fit on a Circle.vi (the blue dot) doesn't came close to the expected position.
I was looking at transforming the 3D problem into a 2D one by rotating and translating the fitted plane to the x-y plane. I would then find the best fit center and perform the inverse transformation to get the result.
One question that I have is should I use the projection of the data points on the best fit plane or the actual points are close enough? (I would think I should to get more precision but maybe it would be easyer with no significant precision loss to just set the z component to 0 after the plane transformation).
Ben64
02-18-2017 10:38 AM
Wearing my Math Hat, this sounds like a straight-forward problem, but I'm not sure I completely understand the question. What is the Model you are trying to fit? It sounds (to me) like you expect that the points should (ideally) lie on a circle that lies in some plane in 3-D space. The question is, what measure are you trying to minimize? Do you want the 3-D least-squared distance of each point for the chosen circle, regardless of whether the points are in the plane of the circle or not? Do you want to fit the best plane, project the points onto this plane, then do the 2-D problem of least-squared distance to the circle? Is there another measure I haven't mentioned?
Can you provide a set of points to use as test data? [It wouldn't be so difficult to generate our own, but there's nothing like "Real Data", as opposed to "Alternative Data" ...]
Bob Schor
02-18-2017 11:37 AM - edited 02-18-2017 12:05 PM
The problem with your data is that is is nearly linear. I am sure if you had a slight banana in there, it would all fall in place.
How many bits are in the sensor data?
If I do "fitting on a sphere" and validate by measuring all distances to the center from each real point, they are well within 5 decimal digits of the fitted radius (see picture). If your digitizer is 16 bits, this is well within digital noise. I doubt you can find a better "center".
Even finding the best plane seems like an ill posed problem given the nearly linear data.
02-18-2017 12:17 PM - edited 02-18-2017 12:17 PM
02-18-2017 01:02 PM
Also looking at your linear algebra, the matrix you are inverting has a condition number of 6E7, meaning you can lose up top ~8 digits in accuracy (use this tool). Again, what is the resolution of the position sensors?
02-20-2017 01:44 PM
Just got some reply from a collegue who's taking the measurements, note that this is very preliminary stuff since we just got the Optitrack system and are still getting familiar with it. According to my collegue the accuracy on the position is around 5 mil, the position from the file I used to populate the string control are in meter (the joy of working with 2 systems!).
Attached is a more completed set of data.
Ben64