[Performance Question] Finding rectangle where point is = R-Tree ?
Hello there. Googly problem:
Lets supose i have a List<Rectangle> witch has 2k rectangles. Every rectangle ha different X,Y however i can have 1 rectangle inside another (and you cannot have 1 inside the one whos inside the 'main' rectangle, so a rectangle can have a parent but not a 'post-parent')
When i give a Point to search with my starting algorithm, and i want to know witch rectangles this point is in, i have to read all rectangles in the list to know witch rectangles this point is.
Also, when i create another rectangle, i have to check if this rectangle is bounding another rectangle , cause rectangles cannot have theyr border crossing, and there is a max. distance between rectangles.This image shows how those rectangles looks like:
I wonder if someone knows something about how this could be done performatically. Some people recommended an R-Tree but im not soure how could i use it, ive got a few examples but i couldnt manage to run the tree.
Would apreciate any effort tryng to help :P:
Thanks alot for thy attention !