Visibility Graph - Geometric Computing Lab

Download Report

Transcript Visibility Graph - Geometric Computing Lab

Visibility Graph
Team 10
NakWon Lee, Dongwoo Kim
Robot Motion Planning
β€’ Consider the case of point robot
β€’ The polygons in S are obstacles, and their total
number of edges is denoted by n
β€’ The point robot can touch obstacles, because
obstacles are open set.
β€’ Start position π‘π‘ π‘‘π‘Žπ‘Ÿπ‘‘ . Goal position π‘π‘”π‘œπ‘Žπ‘™ .
β€’ Paths do not intersect the interior of any of the
obstacles.
Robot Motion Planning
β€’ Use trapezoidal map 𝑇(πΆπ‘“π‘Ÿπ‘’π‘’ )of the free
configuration space πΆπ‘“π‘Ÿπ‘’π‘’ .
β€’ Configuration space is the parameter space of a
robot 𝑅. Denoted by 𝐢(𝑅).
β€’ For a point robot, πΆπ‘“π‘Ÿπ‘’π‘’ 𝑅 was simply the empty
space between obstacles.
Configuration Space
Shortest Paths
β€’ Construct the trapezoidal map 𝑇(πΆπ‘“π‘Ÿπ‘’π‘’ ) for
configuration space πΆπ‘“π‘Ÿπ‘’π‘’ .
β€’ Construct the load map πΊπ‘Ÿπ‘œπ‘Žπ‘‘ .
β€’ Find the trapezoids which have the start point or
end point.
β€’ Find the shortest route in the load map πΊπ‘Ÿπ‘œπ‘Žπ‘‘ using
breadth first search algorithm.
Shortest Paths
Shortest Paths
β€’ Shortest path in road map is not a real shortest path
β€’ because some arcs are btw nodes that are far apart, whereas
others are btw nodes that are close to each other.
β€’ It is just minimum number of hop.
β€’ To improve this problem, give each arc a weight
corresponding to the Euclidean length, and use graph
search algorithm that find the shortest path in a
weighted graph.
β€’ Dijkstra's algorithm
β€’ But, it is still not a shortest path.
Shortest Paths
β€’ Think of this path as an elastic
rubber band.
β€’ Fix the endpoints at the start and
goal position.
β€’ Try to tighten the rubber band.
β€’ It will be stopped by the obstacles.
β€’ The new path will follow parts of
the obstacle boundaries and
straight line segments through
open space.
Shortest Paths
β€’ Lemma 15.1 Any shortest path between π‘π‘ π‘‘π‘Žπ‘Ÿπ‘‘ and
π‘π‘”π‘œπ‘Žπ‘™ among a set 𝑆 of disjoint polygonal obstacles
is a polygonal path whose inner vertices are
vertices of 𝑆
β€’ Inner vertex – A vertex that is not the begin or endpoint
of the path.
Shortest Paths
β€’ Proof.
β€’ Suppose for a contradiction that a shortest path 𝜏 is not
polygonal.
β€’ Point 𝑝 on 𝜏 that lies in the interior of the free space
with the property that no line segment containing 𝑝 is
contained in 𝜏.
𝑝
𝜏
𝑣1
π‘›π‘œπ‘‘ 𝑝
𝑣2
Shortest Paths
β€’ There is a disc of positive radius centered
at 𝑝 that is completely contained in the
free space.
β€’ Part of 𝜏 inside the disk, which is not a
straight line segment, can be shortened
by replacing it with the segment
connecting the points which lie on circle.
β€’ Contradict the theorem β€œany shortest
path must be locally shortest”.
Shortest Paths
β€’ Now consider a vertex 𝑣 on 𝜏. It cannot lies in the interior of the free
space.
β€’ Consider the disc centered at 𝑣 such that half of the disc is contained in
the free space.
β€’ Can replace the sub path inside the disc with a straight line segment.
β€’ The only possibility left is that 𝑣 is an obstacle vertex.
𝑣
𝑣
short cut
𝜏
𝑣1
𝜏
𝑣2
𝑣1
𝑣2
Shortest Paths
β€’ Construct a road map with this characterization.
β€’ This road map is visibility graph of 𝑆, denoted by
𝐺𝑣𝑖𝑠 (𝑆).
β€’ Its nodes are the vertices of 𝑆.
β€’ There is an edge between vertices 𝑣 and 𝑀 if they
can see each other.
β€’ The segment 𝑣𝑀 dose not intersect the interior of
any obstacle in 𝑆.
Shortest Paths
β€’ Two vertices that can see each other are called
visible.
β€’ The segment connecting visible two vertices is
called a visibility edge.
β€’ Endpoint of the same obstacle edge always see
each other.
β€’ Hence, the obstacle edges form a subset of the
edges of 𝐺𝑣𝑖𝑠 (𝑆).
Shortest Paths
β€’ To make a complete road map to find shortest path,
add start and goal point as vertices to 𝑆.
β€’ So we consider the visibility graph of the set
𝑆 βˆ— ≔ 𝑆 βˆͺ {π‘π‘ π‘‘π‘Žπ‘Ÿπ‘‘ , π‘π‘”π‘œπ‘Žπ‘™ }.
β€’ Corollary 15.2 The shortest path between π‘π‘ π‘‘π‘Žπ‘Ÿπ‘‘
and π‘π‘”π‘œπ‘Žπ‘™ among a set 𝑆 of disjoint polygonal
obstacles consists of arcs of the visibility graph
𝐺𝑣𝑖𝑠 (𝑆 βˆ— ), where 𝑆 βˆ— ≔ 𝑆 βˆͺ {π‘π‘ π‘‘π‘Žπ‘Ÿπ‘‘ , π‘π‘”π‘œπ‘Žπ‘™ }.
Shortest Paths
Visibility Graph
Definition:
β€’ The visibility graph of s and t and the obstacle set
is a graph whose vertices are s and t the obstacle
vertices, and vertices v and w are joined by an edge
if v and w are either mutually visible or if (v, w) is
an edge of some obstacle.
Visibility Graph
Visible Vertices
Visible Vertices
Visible
Definition
Two points p and q are mutually visible if the open
line segment joining them doesn't intersect the
interior of any obstacle.
Search Tree
Computing the Visibility Graph
β€’ VisibleVertices: 𝑂(π‘›π‘™π‘œπ‘”π‘›) – (sorting)
β€’ Operation on blanced search tree : 𝑂(π‘™π‘œπ‘”π‘›)
β€’ For every vertices with Visible Vertices.
β€’ VisibilityGraph – 𝑂(𝑛2 π‘™π‘œπ‘”π‘›)
Computing the Visibility Graph
β€’ Give an 𝑂(𝑛2 ) procedure for constructing.
β€’ 𝑛 is the number of line segments in the plane.
β€’ No three vertices are collinear??
β€’ The algorithm is not output sensitive.
β€’ An 𝑂(𝑛 log 𝑛 + π‘˜) algorithm (π‘˜ is the number of
edges in visibility graph) is existent but quite
complicated.
Computing the Visibility Graph
β€’ The text’s algorithm operates by doing sweep one
vertex at a time.
β€’ New algorithm does the sweep for all vertices
simultaneously.
β€’ When we use the arrangement, angular sort can be
performed for all vertices in 𝑂(𝑛2 ) time.
β€’ If we build the entire arrangement, this sorting
algorithm will involve 𝑂(𝑛2 ) space.
β€’ However it can be implemented in 𝑂(𝑛) space
using an algorithm called topological plane sweep.
Computing the Visibility Graph
β€’ First, recall the algorithm for computing trapezoidal
maps.
β€’ Shoot a bullet up and down from every vertex until
it hits its first line segment.
β€’ Angle πœƒ continuously sweeps out all slopes from
βˆ’ ∞ to +∞.
β€’ All bullet lines attached to all the vertices begin to
turn slowly counterclockwise.
Computing the Visibility Graph
β€’ The question is what are the significant event
points, and what happens with each event?
Computing the Visibility Graph
β€’ It is useful to view the problem both in its primal
and dual form.
β€’ 2𝑛 (𝑛 is the number of segments) segment end
points 𝑣 = (π‘£π‘Ž , 𝑣𝑏 ), its dual line 𝑣 βˆ— : 𝑦 = π‘£π‘Ž π‘₯ βˆ’ 𝑣𝑏 .
β€’ Significant event occurs whenever a bullet path in
the primal plane jumps from one line segment to
another.
β€’ This occurs when πœƒ reaches the slope of the line
joining two visible endpoints 𝑣 and 𝑀.
Computing the Visibility Graph
event
event
event
Computing the Visibility Graph
β€’ To keep track of which endpoints are visible and
which are not is complicated.
β€’ Instead we will take events to be all angles πœƒ
between two endpoints, whether they are visible
or not.
β€’ By duality, the slope of such an event will
correspond to the π‘Ž-coordinate of the intersection
of dual lines 𝑣 βˆ— and 𝑀 βˆ— in the dual arrangement.
Dual Arrangement
x-coordinate is the slope of dual segment
Dual of point D
Dual of point C
Find Events
β€’ By sweeping the arrangement of the 2𝑛 dual lines
from left-to-right, we will enumerate all the slope
events in angular order.
Find Events
Angular order
β€’ By using topological plane sweep,
event do not need to be sorted.
Topological Plane Sweep
β€’ Provides a way to sweep an
arrangement of lines using
a β€œflexible” sweeping line.
β€’ Because events do not
need to be sorted, we can
avoid 𝑂(log 𝑛) factor.
Topological Plane Sweep
β€’ Upper horizon tree
β€’ Lower horizon tree
Topological Plane Sweep
β€’ Data structure
β€’ 𝐸[1: 𝑛] – array of line equation. 𝐸 𝑖 = (π‘Žπ‘– , 𝑏𝑖 ), if the 𝑖th line
of 𝐻, 𝑙𝑖 , is 𝑦 = π‘Žπ‘– π‘₯ + 𝑏𝑖 .
β€’ π»π‘‡π‘ˆ[1: 𝑛] – an array representing the upper horizon tree.
π»π‘‡π‘ˆ[𝑖] is a pair (πœ†π‘– , πœŒπ‘– ) of indices indicating the lines that
delimit the segment of 𝑙𝑖 in the upper horizon tree to the left
and to the right.
β€’ 𝐻𝑇𝐿 1: 𝑛 – represents the lower horizon tree.
β€’ 𝐼 – a set of integers, represented as a stack. If 𝑖 is in 𝐼, then 𝑐𝑖
and 𝑐𝑖+1 share a common right endpoint.
β€’ 𝑀[1: 𝑛] – an array holding the current sequence of indices
that form the lines π‘š1 , π‘š2 , β‹― , π‘šπ‘› of the cut.
β€’ 𝑁 1: 𝑛 – a list of pairs of indices indicating the lines
delimiting each edge of the cut. 𝑁[𝑖] thus encodes the
endpoints of the edge on 𝑀[𝑖]. The same convention as that
above is used for missing endpoints.
Topological Plane Sweep
If segment is the rightmost on 𝑙𝑖 ,
set πœŒπ‘– = 0
If segment is the leftmost on 𝑙𝑖 ,
set πœ†π‘– = βˆ’1
Topological Plane Sweep
β€’ Algorithm
Initialization:
β€’ 1. Sort the lines of the arrangement by slope.
β€’ 2. Find the leftmost and the rightmost intersection point of the lines. Let the
two points be (π‘₯𝑙 , 𝑦𝑙 ) and (π‘₯π‘Ÿ , π‘¦π‘Ÿ ).
β€’ 3. Create vertical lines π‘₯ = π‘₯𝑙 βˆ’ 1, π‘₯ = π‘₯π‘Ÿ + 1 as left boundary and right
boundary. Determine the intersection points of lines 𝑙1 , β‹― , 𝑙𝑛 with the
boundaries.
β€’ 4. Create upper horizon tree: Insert 𝑙1 , β‹― , 𝑙𝑛 . Assume 𝑙1 , β‹― , π‘™π‘˜ have been
inserted. These lines form an upper bay. To insert π‘™π‘˜+1 , begin at its endpoint on
the left boundary. Walk in counter clockwise order around the bay till we find
the intersection point of π‘™π‘˜+1 with an edge.
β€’ 5. Create lower horizon tree similarly by starting the travers at endpoints on the
right boundary.
β€’ 6. Initialize 𝑁: Let π»π‘‡π‘ˆ[𝑖] = (βˆ’1, π‘Ÿ) and 𝐻𝑇𝐿[𝑖] = (βˆ’1, 𝑠). If π‘™π‘Ÿ intersects 𝑙𝑖 to
the left of the intersection point of 𝑙𝑠 and 𝑙𝑖 then the right delimiting line of 𝑒𝑖 is
π‘Ÿ. Otherwise, the right delimiting line of 𝑒𝑖 is 𝑠.
β€’ 7. Initialize 𝐼 by scanning 𝑁.
Topological Plane Sweep
β€’ Algorithm
Elementary Step
β€’ While 𝐼 = Ξ›
β€’ 1. Pop 𝑖 from 𝐼
β€’ 2. Swap 𝑀[𝑖], 𝑀[𝑖 + 1] /*lines are going to cross, after the
elementary step*/
β€’ 3. 𝑁 𝑖 . πœ† ← 𝑁 𝑖 + 1 . 𝜌, 𝑁 𝑖 + 1 . πœ† ← 𝑁[𝑖]. 𝜌 /*the point of
elementary step becomes the left endpoint of the two new cut
edges */
β€’ 4. Update π»π‘‡π‘ˆ, 𝐻𝑇𝐿.
β€’ 5. 𝑁 𝑖 . 𝜌 ← π‘π‘™π‘œπ‘ π‘’π‘Ÿ π»π‘‡π‘ˆ 𝑀 𝑖 . 𝜌, 𝐻𝑇𝐿 𝑀 𝑖 . 𝜌, 𝑁 𝑖 + 1 . 𝜌 ←
π‘π‘™π‘œπ‘ π‘’π‘Ÿ π»π‘‡π‘ˆ 𝑀 𝑖 + 1 . 𝜌, 𝐻𝑇𝐿 𝑀 𝑖 + 1 . 𝜌 /* find the new right
endpoints */
β€’ 6. If 𝑁[𝑖 + 1]. 𝜌 = 𝑀[𝑖 + 2] then push 𝑖 + 1 into 𝐼. If 𝑁[𝑖]. 𝜌 =
𝑀[𝑖 βˆ’ 1] then push 𝑖 βˆ’ 1 into 𝐼. /* push valid vertices formed after
sweeping into I if there is any */
What Happens at Each Event
β€’ For each vertex 𝑣, there are two bullet paths
growing from 𝑣 along the line with slope πœƒ.
β€’ Let 𝑓(𝑣) and 𝑏(𝑣) denote the line segments that
forward bullet path and backward bullet path hit.
β€’ If either path does not hit any segment then we
store a special null value.
β€’ Each slope is determined by exactly two lines.
What Happens at Each Event
β€’ Possible scenarios
What Happens at Each Event
β€’ Same segment
β€’ If 𝑣 and 𝑀 are endpoints of the same segment, then
they are visible, and we add the edge (𝑣, 𝑀) to the
visibility graph.
β€’ How can I check this?
What Happens at Each Event
β€’ Invisible
β€’ Consider the distance
from 𝑣 to 𝑀.
β€’ Compute the contact
point of the bullet path
shot from 𝑣 in direction
πœƒ with segment 𝑓(𝑣) or
𝑏(𝑣).
β€’ If 𝑣𝑀 is longer than 𝑣𝑝,
𝑣 and 𝑀 are not visible.
Calculate the distance of 𝑣𝑀
𝑝
Calculate the distance of 𝑣𝑝
What Happens at Each Event
β€’ Segment entry
β€’ If we are entering the segment, then we set 𝑓(𝑣) or
𝑏(𝑣) to this segment.
β€’ 𝑣𝑀 can be a visibility edge.
What Happens at Each Event
β€’ Segment exit
β€’ The bullet path will need to
shoot out and find the next
segment that it hits.
β€’ It is available in 𝑂(1) time.
β€’ Since we are sweeping over 𝑀
at the same time that we are
sweeping over 𝑣.
β€’ We know that the bullet
extension from 𝑀 hits 𝑓 𝑀 .
β€’ So, new 𝑓(𝑣) is same as 𝑓(𝑀).
𝑓(𝑀)
Thank You
Q&A