>  Docs Center  >  Libraries  >  JBIU  >  MATCHALL_ND






    Determines which of a set of coordinates of arbitratry dimension are a
    given distance from each of a vector of points. Based on JD's MATCH_2D
    and my MATCHALL_SPH.



Calling Sequence

    Result = MATCHALL_ND(P1, P2, MaxDistance, Nwithin)


    P1: N1xD array of D-dimensional coordinates.
    P2: N2xD array of D-dimensional coordinates.
    MaxDistance: Maximum D-dimensional distance.


    The function returns the list of indices of P2 that lie within
    Distance of each point in P1. The format of the returned array is
    similar to the REVERSE_INDICES array from HISTOGRAM: the indices
    into P2 that are close enough to element i of P1 are
    contained in Result[Result[i]:Result[i+1]-1] (note, however, that
    these indices are not guaranteed to be sorted). If there are no matches,
    then Result[i] eq Result[i+1].

Optional Outputs

    Nwithin: A vector containing the number of matches for each entry in P1.

Keyword Parameters

    DISTANCE: Optional output containing the distances between each pair.
              The distances are stored in the same order as the Result
              array but starting at 0, i.e. if j is match number k to
              element i then
                  j = Result[Result[i]+k]
              and the distance between points i and j is


    Generates Gaussian 3D clouds around each of several locations and colours
    the points in the cloud that lie within the Gaussian dispersion of any
    na = 10
    nbpera = 1000
    a = randomn(seed, na, 3)
    b = 0.1*randomn(seed, na*nbpera, 3)
    b += rebin(a, na*nbpera, 3, /sample)
    result = matchall_nd(a, b, 0.1)
    matches = result[na+1:*]
    iplot, /scatter, /iso, b[*,0], b[*,1], b[*,2]
    iplot, /overplot, /scatter, sym_color=[255,0,0], b[matches,0], $
      b[matches,1], b[matches,2]
    iplot, /overplot, sym_index=1, sym_color=[0,0,255], linestyle=6, a[*,0], $
      a[*,1], a[*,2]

Modification History

    Written by: Jeremy Bailin
    10 June 2008 Public release in JBIU as WITHINSPHRAD
    24 April 2009 Vectorized as WITHINSPHRAD_VEC
    25 April 2009 Polished to improve memory use
    9 May 2009 Radical efficiency re-write as WITHINSPHRAD_VEC3D borrowing
                  heavily from JD Smith's MATCH_2D
    13 May 2009 Removed * from LHS index in final remapping for speed
    6 May 2010 Changed to MATCHALL_2D and just using Euclidean 2D
                  coordinates (add a bunch of stuff back in from MATCH_2D and
                  take out a bunch of angle stuff)
    25 May 2010 Bug fix to allow X2 and Y2 to have any dimension.
    23 August 2010 Generalized to an arbitrary number of dimensions and
                  to use the manifold-mapping technique from WITHINSPHRAD_VEC3D
                  if the space is sparse enough as MATCHALL_ND.
    9 Feb 2010 Added DISTANCE output keyword.

© 2022 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us