[vtkusers] Best fitting plane....

Malcolm Drummond malcolm at geovision.co.za
Tue Mar 30 05:45:47 EST 2004


OK, I think I see the problem. You aren't subtracting the centroid (ie. mean
values of x, y, z) from the points, so your covariance matrix is around the
world origin (0,0,0) and not the centre of your points.

HTH
Malcolm

----- Original Message -----
From: "Andres Barrera" <andresba at hotmail.com>
To: <malcolm at geovision.co.za>
Sent: Monday, March 29, 2004 11:28 PM
Subject: Re: [vtkusers] Best fitting plane....


> Hello Malcom,
>
>     You told me to let you know if I had any problem..... well.. here I
am!
> ;)
>
>    I tryed to imlpement what you said, but I might be doing something
> wrong... I attached the code ("Tests.cpp"), and a picture showing what I
got
> ("ViewSample.jpg"). May be it you can help me finding out the problem, and
> send me the demo code you offered me before for checking myself.
>
>     Once again, thant you very much for your time and your help.
>
>
>          Andres
>
>
>
>
> >
> >Hi Andres
> >
> >Leo van Ruijven posted a response to a similar question some time back
> >describing an eigenvector method.
> >
> >For every x,y,z calculate products xx,xy,xz,yy,yz,zz. Put sums of
products
> >in 3*3 matrix (ie. sxx,sxy,sxz;sxy,syy,syz;sxz,syz,szz) which now
> >represents
> >an ellipsoid bounding your point-set. Use vtkMath to calculate the
> >eigenvectors and eigenvalues. The two largest values are in the plane,
the
> >smallest is normal to the plane.
> >
> >Let me know if you have any problems, I used this method recently and
could
> >dig up some demo code if you need it.
> >
> >HTH
> >Malcolm
> >
> >----- Original Message -----
> >From: "Andres Barrera" <andresba at hotmail.com>
> >To: <vtkusers at vtk.org>
> >Sent: Wednesday, March 24, 2004 7:06 PM
> >Subject: [vtkusers] Best fitting plane....
> >
> >
> > > Dear list,
> > >
> > > On Fri, 22 Mar 2002 16:39:55 +0100, Anner Adrian wrote:
> > >
> > > >>Hello,
> > > >>
> > > >>is in vtk a function to find the best fit for a plane with n-points?
> > > >>I have n-points and now I want place a vtkPlaneSource so that the
> > > >>distance from the plane to the points is minimal.
> > >
> > > I need to solve a similar problem now, but I could find any answer to
> >that
> > > in the User's List archives.
> > >
> > > Is there any defined way of calculating the best fitting plane through
a
> > > series of points in vtk?
> > >
> > >    Thank you in advance
> > >
> > >          Andres
>
> _________________________________________________________________
> MSN Toolbar provides one-click access to Hotmail from any Web page - FREE
> download! http://toolbar.msn.com/go/onm00200413ave/direct/01/
>




More information about the vtkusers mailing list