How to swap nodes in a Balanced Binary Search Tree for a line segment intersection detection

51 views Asked by At

I'm implementing a lined sweep algorithm use a Balanced Binary Search Tree (currently using a AVL). The whole point of using a BBST is to keep track of the current status of the sweep line. So as we move down the space of line segments we add the start point of the line segment in order of coordinate. However when we reach a intersection we need to swap the order of the nodes. Most books and videos recommend to store the "directions" to the node in the internal nodes and the data in the leaf node.

However I'm stuck on the part where you need to swap the order of the nodes when you detect a intersection? Also how would deletion work?

enter image description here

enter image description here

0

There are 0 answers