LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

fitting 2D- and 3D-geometries

I have a set of 3D-coordinates representing points in 3D-space. This set of points represents a relatively simple 2D or 3D geometrical element like a circle, a rectangle, a sphere, a cylinder, a plane, a cone, ... and I know the type of geometry that I'm looking for. I know that LabView includes functionality to fit circles and spheres, and that fitting planes is done quite easily, but are there any possibilities withing LabView (or maybe Diadem?) to fit the other mentioned posibilities?
Any help would be appreciated.

0 Kudos
Message 1 of 9
(5,408 Views)

Fitting data to a function requires two things:

  1. A mathematical description of the model.
  2. A mathematical expression of the fit quality, a value that should be minimized by adjusting the model parameters.

Once you have that, you can just use Levenberg Marquardt. Chisquare might not be the best for (2) in 3D, you could e.g. use the sum of the square of the distance vectors between data and model. Sometimes it might help to transform the problem into a different coordiate system (spherical, cylidrical, etc.)

Also be sure to use good starting values for your parameters..

Under very specific conditions the problem can be dramatically simplified. Here's a recent discussion of the sphere fitting algorithm: http://forums.ni.com/ni/board/message?board.id=170&message.id=149402#M149402

Do you know what shape you want to fit or do you also want the program to automatically determine the shape of the object (i.e. determine if it is a cylinder or cone, then fit it accordingly)?


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
Message 2 of 9
(5,402 Views)
Thank you for your quick response. I do know which shape to fit prior to the fitting process, so that's not a problem. I do understand the example for fitting a sphere in 3D-space or a circle in 2D-space, but a cylinder or a cone or, say, a circle in 3D-space seem harder as (I think) there are no implicit mathematical descriptions for those shapes but only parametrical ones. This fact seems to prevent the usage of the method used for sphere fitting. I have difficulties setting up a parameterless term for the length of the distance vector between a given point (x,y,z) and the geometrical shape.

Another thing I haven't mentioned so far is that in fact I plan on fitting scenes of multiple geometries (e.g. a plane with a cone-shaped hole in it that has another plane as a floor) to a cloud of points. I guess I might be able handle that if I find a way to fit single geometric elements though.
0 Kudos
Message 3 of 9
(5,389 Views)

I have a related but considerably more simple problem, thought I would try this old post.  I need to fit a set of 3D cartesian points to a plane. 

 

This is part of a 3-D tracking system.  My VI captures a set of XYZ coordinates for the movement of a tip of a medical device.  However I need to calibrate the system - and I want to do that by moving the sensor through a known path (a circle)  which constrains it to a plane.  I then have a point cloud of XYZ data that I want to check for diameter (easy, using Fitting on a Sphere VI) and how well it fits a plane.  I'll also check that each of three circles (planes) is orthogonal, but that's the easy part. 

 

Is there a simple way to do this using the existing fitting VIs in LV?  I have experimented with General LS Linear Fit and others but no solution yet.  My grasp of LV is decent, but linear algebra was a long loooong time ago.  Robot Mad 

 

Thanks in advance, Brian

0 Kudos
Message 4 of 9
(4,840 Views)

Do you have a set of typical data?

 

Is it a true circle or could the scaling in x, y, and z be different?

 

Getting the plane using general linear fit is easy unless the plane is exactly vertical. I tmight be better to work in some transformed coordinates.

 


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 5 of 9
(4,833 Views)

Good point about applying a transformation - now I know I am thinking through the problem correctly.  If the calibration target happened to be perfectly aligned with the machine's - this would give infinite slopes in two planes.  A transformation takes care of that - in my case I don't care what the machine's CS is, I only need to know if it's reading my calibration target as three orthogonal planes. 

 

After some more looking on the forums, I ran across your post on 2D general polynomial fit (769834) which fit the bill perfectly after some mods to match my dataz.  Thanks for the code, left kudos there. 

 

0 Kudos
Message 6 of 9
(4,783 Views)

Hi I am trying to fit a curve with two input variables and one output, z=f(x,y), where x and y are the inputs and z the output.

 

I have already solved this problem on matlab by using sftool function, however I must consistenly migrate data from Labview to Matlab and this is annoying.

 

the general form of the model is

 

               atanh(y/c)

z=(a*x+b) --------------

                  (y*d)

 

a,b,c and d are coefficients to be determined by the fit. atanh is the inverse hyperbolic funcion (tanh-1). I red the post about "Fitting on a sphere" but it does not seem to help me

 

http://forums.ni.com/t5/LabVIEW/Fitting-on-a-Sphere/td-p/283169

 

any help would be thanked.

0 Kudos
Message 7 of 9
(4,570 Views)

 

I want to fit a 3dimentional circle as well as cone with the help of set of co-ordinate points. Is it possible with the lab view software.

 

 

0 Kudos
Message 8 of 9
(3,659 Views)

Everything is possible! First you need to explain what a "3D circle" is.

 

Do you have a typical dataset so we get a better idea what you are trying to do? How does the cone relate to the 3D circle?


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 9 of 9
(3,655 Views)