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
here<http://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

Reply via email to