八叉樹:
The Quadtree
derives from the idea of dividing a square area into smaller squares.
start with a unity square as the root of the tree, now divide the square into four smaller aquares.
each of the new smaller squares is a child node of the root. the next step is to repeat the process on the small suares
generating four more sub-squares and hence four children at the next level of the tree for each of them
The Octree
in three dimensions the square is replaced by a cube and the division into four is replaced by a division into eight sub-cubes hence oct-tree,
Thus the octree is just a generalisation of the quadtree to 3D. Each node corresponds to a single cube and has exactly eight sub-nodes
BSP樹
bsp_tree(poly* current_poly){
while(still_polygons){
partition_polygons(current_poly);
}
bsp_tree(current_poly->left);
bsp_tree(current_poly->right);
}
應用
1. 查找
2.可視判斷
3. 區域
http://dip.sun.ac.za/~henri/bsp_tutorial.pdf
http://web.cs.wpi.edu/~matt/courses/cs563/talks/bsp/bsp.html
http://jp.51studyit.com/article/details/62900.htm
http://www.i-programmer.info/programming/theory/1679-quadtrees-and-octrees.html