leonardodlana / quadtree-geolocation

Small project showing the power of the quadtree structure to improve geolocation
Apache License 2.0
33 stars 7 forks source link

Question in locateAndCreateNodeForPoint method #1

Open HarshPurohit1260 opened 1 year ago

HarshPurohit1260 commented 1 year ago

Hello, first thanks a lot for your code it helped me in understanding quad tree and resolving similar issue.

now i want to understand one thing in locateAndCreateNodeForPoint as follow:

if (longitude < mBounds.x + halfWidth) {

        if (latitude < mBounds.y + halfHeight)

            // CREATE OR RETURN mTopLeftNode 

        // CREATE OR RETURN mBottomLeftNode
    }
    if (latitude < mBounds.y + halfHeight)

        // CREATE OR RETURN mTopRightNode 

    // CREATE OR RETURN mBottomRightNode 

in above part of code the latitude condition is determining that node is bottom node or not instead of top node so should it be like follow?

if (longitude < mBounds.x + halfWidth) {

        if (latitude < mBounds.y + halfHeight)

            // CREATE OR RETURN mBottomLeftNode 

        // CREATE OR RETURN mTopLeftNode 
    }
    if (latitude < mBounds.y + halfHeight)

        // CREATE OR RETURN mBottomRightNode 

    // CREATE OR RETURN mTopRightNode 

just want to understand this part.