Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible wrong computation? #27

Open
jx5c opened this issue May 28, 2016 · 2 comments
Open

Possible wrong computation? #27

jx5c opened this issue May 28, 2016 · 2 comments

Comments

@jx5c
Copy link

jx5c commented May 28, 2016

in QuadTreeRect.java file,

    double dx = ewdistance * ewdistance;
    double dy = nsdistance * nsdistance;
    double distanceSqr = dx * dx + dy * dy;
    return distanceSqr;

should the distanceSqr be dx+dy?

@dfdietrick
Copy link
Contributor

No, that's what the method is supposed to return. Note the javadoc comments on the algorithm, the distance squared is used consistently throughout. Are you seeing unusual results in how the quad tree is functioning?

  • Don

@jx5c
Copy link
Author

jx5c commented May 30, 2016

I did not see unusual results. I wanted to find some open-source Geographic applications for research purposes, and came across yours. I am reading and analyzing the source code.

For this part, what I am thinking is that

   dx = ewdistance * ewdistance 
   dy = nsdistance * nsdistance;

seem already squared, why do we have dx*dx?

   distanceSqr = dx * dx + dy * dy;  

will make distanceSqr = ewdistance^4 + nsdistance^4. That seems different from the code in the old borderDistance function.

Jian

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants