0

in this book The design and analysis of spatial data structures P.56 it is mentioned that

Once the set of candidate nodes is found, an attemp is made to find the "best" candidate, which becomes the replacement node. There are two criteria for choosing the best candidate. Criterion 1 stipulates the choice of the candidate that is closer to each of its bordering axes than any other candidate on the same side of theses axes, if such a candidate exists

I was trying to implement this, but cant really figure out how this algorithmn should work. I started very simple and created two sorted lists, one sorted by the difference in x and the other sorted by the difference in y, and if both objects are the same then this object/point will be my result. If not then i either have no candidate or maybe 2 and this is the point where i am stuck!

Another approch was some kind of strange but i will still show the pseudocode, maybe someone has an idea

function chooseCandidate(candidate)
    clockwiseCandidate = candidate.cQuad(candidate.index) // Index is from 0-3 and cQuad returns (index-1)%4
    counterClockwiseCandidate = candidate.ccQuad(candidate.index)
    if candidate.x < ccCandidate.x:
        possibleWinner = candidate
    else if candidate.y < cCandidate.y:
        possibleWinner = candidate

And so on, this is not really a solution just a mindgame from me... So my question would be, can someone explain what this problem is ? or how i could solve this problem? (Please note that a full description is given in the link above)

Paul R
  • 208,748
  • 37
  • 389
  • 560
greedsin
  • 1,252
  • 1
  • 24
  • 49

1 Answers1

0

My understanding:

Scan the candidates, and as you go remember

  • for all four quadrants, the candidate which are "closer to each of its bordering axes than any other candidate on the same side of theses axes" so far.

  • the candidate with the minimum L1 metric so far.

Then if you didn't find exactly one candidtate of the first kind, use the last one.

  • Yes this is also my understanding but it turns out that "for all four quadrants, the candidate which are "closer to each of its bordering axes than any other candidate on the same side of theses axes" so far." is more difficult than it looks like for me and i can't get it working ! – greedsin Jun 14 '17 at 09:18
  • Well, I will try a very simple approach and update my answer/comment. – greedsin Jun 14 '17 at 09:20
  • Ok this won't really work, since you need to compare not the point but the coordinate at the respective axis, which switches depending on which quadrant you are. If you have a solution, please feel free to share :) – greedsin Jun 14 '17 at 11:22