Jump to content

View more

Image of the Day

The night is still, but the invasion brings chaos. #screenshotsaturday #hanako #indiegame #gameart #ue4 #samurai https://t.co/cgILXuokoS
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

How to check that two nodes of quadtree are neighbours?

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
3 replies to this topic

#1 Turbochist   Members   

241
Like
0Likes
Like

Posted 26 October 2013 - 05:58 AM

Sommet way is working to searching neighbours in the quadtree, but what if two nodes are given allready, and only thing is last it is to check that they both are neighbours to the given direction(N,W,S,E)?

 

In my algorithm I use Sommet way: I traverse up to the common uncestor and watching nodes for reflection(symmetry). But it is not works properly. As result there are a more than one neighbours matched to the given direction, it's impossible, because one direction - one neighbour.

 

Please help, how to check two nodes are neighbours?

 

P.S.

I need this for stitching terrain nodes.



#2 TheUnnamable   Members   

1129
Like
1Likes
Like

Posted 26 October 2013 - 09:56 AM

How about simply checking the node's edges? E.g. when checking east, you could do

(node1.x+node1width) == node2.x

And the same for other directions. It would be four checks at most.



#3 Turbochist   Members   

241
Like
0Likes
Like

Posted 26 October 2013 - 02:16 PM

Sorry, i mean Samet neighbor finding techs. Not edges but neighbors. I am trying to check is two nodes are neighbors. Let's depict:

-------------------------

|      |      |      |      |

|-----|-----|-----------|

|      |  a  |  b  |      |

-------------------------

|             |

|      c     | 

|             |

-------------

isNeighbor(a, c,  SOUTH) is true

isNeighbor(a, b, EAST) is true

isNeighbor(a, b, WEST) is false

isNeighbor(c, b, NORTH) is false

etc


#4 Turbochist   Members   

241
Like
0Likes
Like

Posted 29 October 2013 - 09:48 AM

TheUnnamable! You are right!

Resolved.






Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.