Re: fast search [message #50891 is a reply to message #50778] |
Thu, 19 October 2006 03:46  |
m.goullant@gmail.com
Messages: 10 Registered: July 2006
|
Junior Member |
|
|
Hi Greg,
thank you very much, for your time!
I even dont understood the second algorithm and you already have the
3!! :-(. In this weekend i'll take a better look in your explendid
work!
I'm a newbie in IDL, so I have to understand some functions that you
use! I
If is not ask to much, can you coment all the lines of your code?
What I want is a point to points search, so I am trying to understand
in your "quadtree" technique where I can adapt to my needs. I only need
to compare (x,y) - 2D and get the Z values to compare
This is more and less What I want to do:
have this geographic data (could be 100000, 2 million, 4 million
depends):
PRO example
points = myData()
;data structure of an irregular point cloud
x = points.x ;X coord
y = points.y ;Y coord
z = points.z ; Elevation
n = 5 ; number of iterations
mask = 4.0 ; diameter. in meters. Like your dist
maskType = 0 ; 0 a circle, 1 square
FOR i=0L,n-1 DO BEGIN
newZ = erosion(x,y,z,dist,MaskType)
;(...)
dist = dist + 2
ENDFOR
END
FUNCTION erosion,x,y,z,mask,maskType ; Apply erosion to the data
newZ=z
radio = mask /2
FOR i=0L,N_ELEMENTS(z)-1 DO BEGIN
kernel = applyKernel(x,y,z,i,radio,maskType)
;center the kernel in the data(i) and get neighbours there are inside
of the mask
newZ[i]=MAX(z[kernel])
ENDFOR
RETURN,newZ
END
FUNCTION applyKernel,x,y,z,i,dist,maskType
square = WHERE(x LE x[i] + dist AND x GE x[i] - dist AND y LE y[i]
+ dist AND y GE y[i] - dist)
IF (maskType EQ 0) THEN BEGIN
sqDistance = sqrt((x[square] - x[i])^2 + (y[square] -
y[i])^2)
neighbors = WHERE(sqDistance LE dist)
circle = square[neighbors]
RETURN,circle
ENDIF
RETURN,square
END
Because this is an iterative process with a "dist" variable, it's
posible implement your code?
Thank's in advance,
Marie
|
|
|