计算几何 W43 Point Location
Planar Point Location using Persistency
使用持久化数据结构进行平面点定位(在线查询)
Given a planar subdivision with segments, pre-process it for point location queries.
给定一个具有 n 段的平面细分,对其进行预处理以进行点位置查询。
disjoint line segments that divide the plane into some regions
query: given a point, ask which region it lies in.
Goal:
space
query time
pre-processing
Recall the solution for line segment intersection:
sweep a vertical line over the plane
maintain the segments that intersect in the status structure.
at a query-event: query the status structure. we find the segment above the query.
Idea: remember/store the status structure for later use
naive: storage
Persistent Data Structures
Regular data structure are ephemeral 暂时的: updates destroy old version of the data structure.
A persistent data structure also allows access to previous versions of the data structure.
partial persistence:
allow queries in previous versions
full persistence:
allow queries and updates in previous versions
Theorem: Any pointer machine data structure with pointers to any node can be made fully persistent with amortized multiplicative time and space overhead per update.
任何具有 指向任何节点的指针的指针机器数据结构都可以完全持久化,每次更新的摊销乘法时间和空间开销为 。
Approach
Sweep a vertical line over the plane
maintain the segments that intersect in the status structure:
the status structure: a partially persistent red-black tree 部分持久的红黑树存储状态
At every event we update the status structure
- maintain the lines (i.e. X-coordinates) when the status line has changed in a BST.
Fact: a red-black tree can be rebalanced using rotations.
Each such update takes time, and thus creates at most changes in the status structure.
Theorem: Let be a planar subdivision with edges. Using pre-processing, we can store in a data structure of size so that we can answer point location queries in time.
Planar Point Location using a Trapezoidal Decomposition
使用梯形分解的平面点定位
given a planar subdivision with segments, pre-process it for point location queries.
Goal:
space
query time
the partition into slabs creates a refined subdivision, in which planar point location is easy.
板的分区创建了精细的细分,其中平面点定位很容易。
Question: is there a refined subdivision of size in which planar point location is easy?
问题:是否存在大小为 O(n) 的精细细分,其中平面点定位很容易?
Observation: All faces are trapezoids 梯形, they are bounded by 2 vertical line segments and 2 input segments. 它们由两个垂直线段和两个输入线段界定
The subdivision is a trapezoidal decomposition 平面细分就是梯形分解
Add 2 vertical extension segments incident to every vertex, stop when they hit another segment.
添加与每个顶点相关的两个垂直延伸线段,当它们碰到另一个线段时停止。
Observation: the resulting subdivision is a trapezoidal decomposition and has size
The Search Structure
we build the trapezoidal decomposition using a randomized incremental construction
As a side effect, the algorithm builds a search structure .
A DAG in which
- trapezoids stored in the leaves only once.
- internal nodes are line segments
- could be store multiple times
每个线段有 left 区域、above 区域、below 区域、right 区域。把线段看成一个父节点,这些区域可以看成子节点。
Algorithm
procedure TRAPEZOIDALMAP(S)
- Compute a bounding box, and initialize the decomposition and a search structure .
- Compute a random permutation of the segments in .
Invariant: is a search structure for .
for to do
find the trapezoids intersected by .
replace by new trapezoids.
update : remove the leaves for and insert internal nodes containing .
place pointers from nodes containing to the new trapezoids and update DCEL
Running time in the for loop.
worst-case running time
worst-case space
worst-case query time
Analysis
we bound the expected pre-processing time, query time, and size of the data structure
expected query time for a given query point = average query time over all permutations of
Fix a query point , consider the path in to containing .
query time for length of .
What is the probability that is top()?
We use backwards analysis:
suppose we remove , what is the probability that top() disappears?
What is the probability that is bottom()?
What is the probability that by removing we remove rightp()?
=probability that a new node created when inserting
= is top, is bottom; leftp is an endpoint of , or rightp is an endpoint of
query time for
is the n-th harmonic number.
Similarly size
is number of trapezoids created when inserting
Again, we use backwards analysis:
is trapezoids removed from when deleting
So
preprocessing timetime to insert .
is number of trapezoids created when inserting .
Results
Given a planar subdivision with n segments, pre-process it for point location queries.
Result:
- expected preprocessing:
- expected space:
- expected query time:
- worst case query time:
- worst case space: