《计算几何》学习笔记

本课程资料来自学堂在线邓公的《计算几何》,有一定难度。感觉前两章比较基础,后面的我先留个印象吧。

00 基础概念

A is reductive to B  归约思想

imageimage

规约思想,对欲求问题B下界,找一个已知下界问题A,使得A规约到B,则B的下界不突破A的下界。

output sensitive problems:输出敏感问题

star-shaped polygon 星形多边形:多边形当中,存在一个顶点可以与其他顶点相连却不与其他边相交

Simple polygon 简单多边形:不存在点重合,点与边相交,边与边相交。

monotone polygon 单调多边形:沿一个方向分成两个单调链

Extreme Point , Extreme Edge

欧拉公式 v-e+f-c=1,顶点减边加面减连通域等于1,(“中”书写记忆,正负相交)

 

01 Convex Hull 凸包算法:

Incremental Method 算法

Jarvis March 算法

Graham Scan 算法

Andrew’s Monotone Chain 算法(基础啊!!!)

Divide and Conquer 算法

http://www.csie.ntnu.edu.tw/~u91029/ConvexHull.html#3

 1 #include<cstdio>
 2 #include<algorithm>
 3 using namespace std;
 4 
 5 // I refer to the next website, it's very useful.
 6 // http://www.csie.ntnu.edu.tw/~u91029/ConvexHull.html#4
 7 
 8 struct Point{int x, y, index;} p[100001], ch[100001];
 9 int n; // number of total points
10 int m; // number of convex hull points
11 
12 // >0 means from OA to OB is anticlockwise
13 int cross(Point o, Point a, Point b){
14     return (a.x - o.x)*(b.y - o.y) - (a.y - o.y)*(b.x - o.x);
15 }
16 
17 // __less__()
18 bool compare(Point a, Point b){
19     return (a.x < b.x) || (a.x == b.x && a.y < b.y);
20 }
21 
22 void Andrew_monotone_chain(){
23     sort(p, p+n, compare);
24     m = 0;
25     // lower boundary
26     for (int i = 0; i < n; ++i){
27         while (m >=2 && cross(ch[m-2], ch[m-1], p[i]) < 0) 
28             // if p[i] is in extreme edge, it is included also. so "<"
29             m--;
30         ch[m++] = p[i];
31     }
32     // upper boundary
33     for (int i = n-2, t = m+1; i >= 0; --i){ 
34         // the last point is included, so iter from p[n-2].
35         // the first point p[0] must be included to check the hull
36         while (m >=t && cross(ch[m-2], ch[m-1], p[i]) < 0)
37             m--;
38         ch[m++] = p[i];
39     }
40     m--; // the last one is the first point, 
41 }
Andrew_monotone_chain()

 

02 Geometric Intersection 多边形相交

EU问题 Element Unique,用xor,N时间复杂度,若基于比较,需要NlogN;min-gap问题,需要排序再遍历,NlogN;max-gap问题,可以用散列表,分成N个桶,每个桶间隔(max-min)/(n-1),每个桶左闭右开,求桶间距离,O(N)

线相交检测(四次to-left)

BO算法线段相交问题 (N+I)logN,交点数量I可能到N平方量级):事件时间序列 Event Queue(优先级队列:标记左右的线段,以及交点,提供 delMin, insert 接口)+ 扫描线结构 Status Strcuture(BBST:记录活跃的线段,提供 insert, remove, succ, pred 接口)

多边形相交检测 Convex Polygons Intersect Detection : log(n+m),n和m为两个多边形的边数。先 monotone partitioning 分成四个部分,然后对(A左,B右)和(A右,B左)的两对判断是否相交,可以用二分查找,每次去掉其中一个线段序列的1/4。

image

边追赶算法 Edge Chasing(Convex Polygons Intersect Construction 凸多边形相交构造问题 复杂度m+n):基于有序的多边形边,通过检测相交边,追赶求出交点序列。(比较繁琐?)

平面扫描 Plane Sweeping (CPIC 凸多边形相交构造问题 m+n):采用BO算法,其中扫描线结构最多为4个活跃线段,事件序列从最左边两个端点开始,有序开展,且交点个数I不会高出数量级。

半平面相交问题 Halfplane Intersection:??? NlogN,借用CPID的分治算法

 

03 Triangulation (多边形的)三角剖分

internal diagonal 内对角线

三角剖分 Art Gallery Problem 的示意证明:三染色(3-colorable)+ 对偶图(dual graph),without a hole。n/3总是足够的

orthogonal polygon 正交多边形  n/4总是足够的

单调多边形三角剖分:线性时间,same/reflex, opposite情况,入栈和出站操作

image

多边形单调剖分 Monotone Decomposition:helper,stalactite(钟乳石), stalagmite(笋状),NlogN排序+N扫描

imageimage

多面体分解 polyhedron decomposition :顶点划分不一定可行 (举例 Seidel‘s polyhedron can’t dominated by vertex guards)

 

04 Voronoi Diagram 空间剖分

平面图 planar graph :通过弯曲 (bending) 边不相交的图。

DCEL结构:half-edge,vertex, face

imageimageimageimage

仿射变换:保持平行性能,距离的变换

VD sorted , 提升变换

naive construction, incremental construction, divide-and-conquer(合并的交线), plane-sweep(扫描线 + 海滩线BL/抛物线,site event + circle event 三点共圆预埋的抛物线合并事件

imageimage

 

05 Delaunay Triangulation 点集的三角剖分

点集 points |P|=N 表示数量, diagonal |ab| 表示对角线, |conv(P)| = h, 表示极点数目,=凸包的顶点数或边数。

点集P,三角剖分的对角线有3(N-1)-h条,由2(N-1)-h个三角形组成。

凸包合并的过程就是形成三角剖分的过程

对偶图,对于对偶的Voronoi图和Delaunay三角剖分来说,面与点互相对偶,边与边互相对偶

Gabriel Graph:欧式距离最短的边构成(边为直径的圆内无其他点),是DT的子图。

Relative Neighborhood Graph:曼哈顿距离最短的边构成的(边为半径的圆内无其他点),是GG的子图。

image

EMST:欧式距离下的最小生成树。衍生出ETSP问题,通过生成EMST,遍历得到的路径(效率为N)保证代价不到TSP问题的2倍。

MWT:Minimum Weighted Triangulation, 基于权重的三角划分,不属于DT,且是一个NP-Hard问题。

RIC  Randomized Incremental Construction:DT问题解法,每次增加一个点,检测边翻转(平均期望复杂度O-1,即 星形凸包边数)。

判断一个点p是否在三角形abc内:

image

 

06. Point Location

在线算法 online algorithms :问题的所有输入不是全部都就绪的,如搜索引擎的算法。相对的是offline算法。

image

trapezoidal map (TM) 结构示意,及构造示意:

image

imageimage

07. Geometric Range Search
几何范围查询,略
08. Windowing Query

截窗查询,略

posted @ 2019-03-10 17:57  StupiDeMon  阅读(1198)  评论(0编辑  收藏  举报