Line by Line, But HOW Do I Construct A BSP Tree?
dev.to·10h·
Discuss: DEV
Flag this post

If you’ve done data structures for any period of time, you would probably know about the binary tree. We use binary trees because of their efficiency: if I’m searching for a certain value, I can half the search space on each search iteration. This, is extremely useful, but not just in searching within an array. The binary tree can patch many problems that require an efficient search, so why not 2D space? This is where the BSP tree comes in.

What is BSP?

Binary Space Partitioning is, luckily, just as it sounds. It splits space into 2 parts recursively. In this post we’re only going to be looking at 2D space, however, the action of BSP can be used largely on any number of dimensions. Imagine we have an infinite plane, and a bunch of walls. Each of these walls are simply lines wi…

Similar Posts

Loading similar posts...