BSP:试图将所有的板(在BSP中叫做平面)组织成一棵树,每个平面均将它所在的空间分割为前后两个部分,这两个部分又分别被另外的平面分割成更小的空间……直到最后,达到分割的要求。
http://school.ogdev.net/ArticleShow.asp?id=5935&categoryid=5
The process of constructing a BSP tree is fairly straitforward:
- First, select a partition hyperplane. For this dicussion, we will use a 2 dimensional world and our root node will be a line.
- Partition all polygons in the world with the initial partition hyperplane, storing them in either the front or back polygon list.
- recurse or iterate through the front and back polygon list, creating a new tree node and attaching it the the left or right leaf of the parent node.
http://web.cs.wpi.edu/~matt/courses/cs563/talks/bsp/document.html
四叉树:关注其中的Code
http://www.cnblogs.com/xinxianshi/archive/2011/08/21/2157249.html
/* 一个矩形区域的象限划分::
UL(1) | UR(0)
----------|-----------
LL(2) | LR(3)
以下对该象限类型的枚举
*/ typedef enum { UR = 0, UL = 1, LL = 2, LR = 3 }QuadrantEnum; /* 矩形结构 */ typedef struct quadrect_t { double left, top, right, bottom; }quadrect_t; /* 四叉树节点类型结构 */ typedef struct quadnode_t { quadrect_t rect; //节点所代表的矩形区域 list_t *lst_object; //节点数据, 节点类型一般为链表,可存储多个对象 struct quadnode_t *sub[4]; //指向节点的四个孩子 }quadnode_t; /* 四叉树类型结构 */ typedef struct quadtree_t { quadnode_t *root; int depth; // 四叉树的深度 }quadtree_t;
八叉树 Octree:类比四叉树,看一下它中间的Code
http://blog.csdn.net/timzc/article/details/6060591
template<class T> struct OctreeNode { T data; //节点数据 T xmin,xmax; //节点坐标,即六面体个顶点的坐标 T ymin,ymax; T zmin,zmax; OctreeNode <T> *top_left_front,*top_left_back; //该节点的个子结点 OctreeNode <T> *top_right_front,*top_right_back; OctreeNode <T> *bottom_left_front,*bottom_left_back; OctreeNode <T> *bottom_right_front,*bottom_right_back; //节点类构造函数 OctreeNode(T nodeValue = T(), T xminValue = T(),T xmaxValue = T(), T yminValue = T(),T ymaxValue = T(), T zminValue = T(),T zmaxValue = T(), OctreeNode<T>* top_left_front_Node = NULL, OctreeNode<T>* top_left_back_Node = NULL, OctreeNode<T>* top_right_front_Node = NULL, OctreeNode<T>* top_right_back_Node = NULL, OctreeNode<T>* bottom_left_front_Node = NULL, OctreeNode<T>* bottom_left_back_Node = NULL, OctreeNode<T>* bottom_right_front_Node = NULL, OctreeNode<T>* bottom_right_back_Node = NULL ) :data(nodeValue), xmin(xminValue),xmax(xmaxValue), ymin(yminValue),ymax(ymaxValue), zmin(zminValue),zmax(zmaxValue), top_left_front(top_left_front_Node), top_left_back(top_left_back_Node), top_right_front(top_right_front_Node), top_right_back(top_right_back_Node), bottom_left_front(bottom_left_front_Node), bottom_left_back(bottom_left_back_Node), bottom_right_front(bottom_right_front_Node), bottom_right_back(bottom_right_back_Node) {}; };
二叉搜索树:Code很清楚
http://www.cppblog.com/converse/archive/2006/07/29/10665.html
template<typename T>
struct BTreeNode
{
T Data;
BTreeNode* pLeft;
BTreeNode* pRight;
BTreeNode* pParent;
BTreeNode(T data = T(), BTreeNode<T>* Parent = NULL,
BTreeNode<T>* Left = NULL, BTreeNode<T>* Right = NULL)
: Data(data), pLeft(Left), pRight(Right), pParent(Parent)
{
}
};
kd-tree:关注kd-tree的用途和构建算法
http://www.cnblogs.com/slysky/archive/2011/11/08/2241247.html
这篇博客中的例子很清楚的解释了如何构造kd-tree。推荐看:An intoductory tutorial on kd-trees
最小生成树:给定一个带权的无向连通图G,如果存在子图G'包含G中所有顶点和一部分边,且不形成回路,则称G'为图G的生成树,使树上所有边上权的总和最小的称为最小生成树。
http://www.cnblogs.com/chinazhangjie/archive/2010/12/02/1894314.html(大家可以看看是如何做“查环”的)
http://www.wutianqi.com/?p=1284
如果大家知道计算几何的话,可以将最小生成树和voronoi图/delaunay三角剖分结合
图割:
http://hi.baidu.com/%D2%B9%CB%AE%BE%A7%CD%F5%BD%A8%C7%E0/blog/item/48a637014e584c05738da590.html(简单的介绍)
http://hi.baidu.com/%D2%B9%CB%AE%BE%A7%CD%F5%BD%A8%C7%E0/blog/item/b02a82f3e590b2cd0a46e0e2.html(简单算法的介绍)
http://hi.baidu.com/cs%D6%AE%D0%A1%D0%A1%CA%E9%CD%AF/blog/item/cb5c232e39f213201e30895c.html(简单的代码)