Re: [Matplotlib-users] Fit a plane to a set of xyz points

2010-07-27 Thread Friedrich Romstedt
2010/7/26 Mathew Yeates mat.yea...@gmail.com:
 Is there a simple function call for this? And finding the distance of
 a point to the plane?

Hmm, when you are interested in the z distance alone, it should be a
matrix equation:

Z = X * m_x + Y * m_y + 1 * n

Meaning you can invert it with Moore-Penrose pseudoinversion, i.e.,
numpy.lstsq()?

When you have weights on Z, normalise first.

Friedrich

--
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share 
of $1 Million in cash or HP Products. Visit us here for more details:
http://ad.doubleclick.net/clk;226879339;13503038;l?
http://clk.atdmt.com/CRS/go/247765532/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Fit a plane to a set of xyz points

2010-07-27 Thread Joe Kington
On Tue, Jul 27, 2010 at 1:37 PM, Friedrich Romstedt 
friedrichromst...@gmail.com wrote:

 2010/7/26 Mathew Yeates mat.yea...@gmail.com:
  Is there a simple function call for this? And finding the distance of
  a point to the plane?

 Hmm, when you are interested in the z distance alone, it should be a
 matrix equation:

 Z = X * m_x + Y * m_y + 1 * n

 Meaning you can invert it with Moore-Penrose pseudoinversion, i.e.,
 numpy.lstsq()?

 When you have weights on Z, normalise first.

 Friedrich


Just one quick note on this:

If you fit Z = aX + bY + c, you won't be able to resolve vertical planes.
 Likewise, if you fit x = aY + Bz + c or y = aX + bZ + c you won't be able
to resolve horizontal planes.

If you need to robustly fit a plane to a point cloud, you'll need to try all
three formulations. See here for a quick example of what Friedrich mentioned
using all three formulations and choosing the most robust result:
http://code.google.com/p/python-geoprobe/source/browse/geoprobe/common.py#198

As far as finding the distance of a given point (x0, y0, z0) to the plane
defined by 0 = ax + by + cz + d, the equation is just abs(a * x0 + b * y0
+ c * z0 + d) / sqrt(a**2 + b**2 + c**2).  See
herehttp://mathworld.wolfram.com/Point-PlaneDistance.html for
a more detailed explanation.

-Joe
--
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share 
of $1 Million in cash or HP Products. Visit us here for more details:
http://ad.doubleclick.net/clk;226879339;13503038;l?
http://clk.atdmt.com/CRS/go/247765532/direct/01/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Fit a plane to a set of xyz points

2010-07-26 Thread Mathew Yeates
Is there a simple function call for this? And finding the distance of
a point to the plane?

-Mathew

--
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share 
of $1 Million in cash or HP Products. Visit us here for more details:
http://ad.doubleclick.net/clk;226879339;13503038;l?
http://clk.atdmt.com/CRS/go/247765532/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users