[SciPy-User] 2D NN search in a 3D point cloud
Fri Sep 23 00:40:10 CDT 2011
I need the 3rd coordinate value after selecting the NN in 2D. You suggestion
could be OK, if you know of a way to conserve the links between 2D points
and their coordinate values in the 3rd dimension.
From: email@example.com [mailto:firstname.lastname@example.org] On
Behalf Of Bastian Weber
Sent: 22. september 2011 18:11
To: SciPy Users List
Subject: Re: [SciPy-User] 2D NN search in a 3D point cloud
On 09/22/2011 02:13 PM, Andrej Kobler wrote:
> in a cloud of XYZ points I'd like to search for nearest neighbors in XY
> plane using scipy.spatial.KDTree/cKDTree. The problem is that
> KDTree.query takes into account all the given dimensions, not just the
> desired subset of dimensions. Is there a simple way to have data with 3
> or more dimensions and use only 2 for NN search?
Probably I dont have enough insight but I simply would try to neglect
the last coordinate of the data.
Assuming you have points_xyz.shape == (N,3) where N is the number of
points then you could simply do:
points_xy = points_xyz[:,:2].
Applying the NN search on this data should give you the desired result.
SciPy-User mailing list
More information about the SciPy-User