0% found this document useful (0 votes)
79 views

CSM 131 Chapter 5 to Chapter 7-الهندسة PDF

This chapter discusses visibility graphs and shortest path planning. It introduces visibility graphs as a roadmap for finding the shortest path between a start and goal point while avoiding obstacles. The vertices of the visibility graph are the vertices of the obstacle polygons, and its edges connect any two vertices that are mutually visible. The chapter describes how to construct the visibility graph in O(n2logn) time using a rotational plane sweep. It also presents an algorithm to find the shortest path between two points in the visibility graph using Dijkstra's algorithm.

Uploaded by

ahmed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
79 views

CSM 131 Chapter 5 to Chapter 7-الهندسة PDF

This chapter discusses visibility graphs and shortest path planning. It introduces visibility graphs as a roadmap for finding the shortest path between a start and goal point while avoiding obstacles. The vertices of the visibility graph are the vertices of the obstacle polygons, and its edges connect any two vertices that are mutually visible. The chapter describes how to construct the visibility graph in O(n2logn) time using a rotational plane sweep. It also presents an algorithm to find the shortest path between two points in the visibility graph using Dijkstra's algorithm.

Uploaded by

ahmed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 67

Chapter 5

ORTHOGONAL RANGE SEARCHING


objectives

 Orthogonal Range Searching and KD-trees:1-


Dimensional Range Searching,
 Multi-dimensional range search.
 Kd-tree, 1-Dimensional Kd-tree, Algorithm for
finding split node,
 Algorithm for 1 Dimensional range searching.
 2-Dimensional kd-tree, Algorithm to create 2-
Dimensional kd-tree,
 Range trees.
Querying a pointset

 High-dimensional geometry is everywhere:


Conformation space, images, the web, bio, . . .
 Queries in a database can be interpreted
geometrically: records are high-dim points, record
queries are queries on the points.
A typical query interpreted geometrically

 Databases store records or objects

 Personnel database: Each employee has a name, id


code, date of birth, function, salary, start date of
employment, ...
 Fields are textual or numerical
A typical query interpreted geometrically
A query in 3 dimensions

“report all employees born between 1950 and 1955 who earn
between $3,000 and $4,000 a month and have between two
and four children”?

represent each employee by a point in 3-dimensional space:


 the first coordinate represents the date of birth,
 the second coordinate the salary,
 the third coordinate the number of children.

To answer the query we now have to report all points inside the
axisparallel box [19,500,000 : 19,559,999]×[3,000 :
4,000]×[2:4].
A query in 3 dimensions
The geometric approach

 We are interested in answering queries on d fields of


the records in our database, in sublinear time
(hopefully in log n).
 Transform the records to points in d-dimensional
space and store them in suitable data structures.
 The transformed query asks for all points inside a d-
dimensional axis-parallel box (may be unbounded).
 Such a query is called ‘‘rectangular’’ or ‘‘orthogonal’’
range query. Format: I1 × I2 × · · · × Id where Ii is
the query interval for coordinate i.
1-Dimensional Range Searching

 Data: Points P={p1, p2, … pn} in 1-D space (set of real


numbers)
 Query: Which points are in 1-D query rectangle (in
interval [x, x’])
Balanced binary search trees
Balanced Binary Search Trees

 The search path for 25


• The search paths for 25 and for 90
 A 1-dimensional range query with [25, 90]
Node types for a query

Three types of nodes for a given query:


 White nodes: never visited by the query
 Grey nodes: visited by the query, unclear if they lead
to output
 Black nodes: visited by the query, whole subtree is
output
Example 1D range query

 A 1-dimensional range query with [61, 90]


1D range counting query

 A 1-dimensional range tree for range counting


queries
 A 1-dimensional range counting query with [25, 90]
Kd-trees

 Kd-trees, the idea: Split the point set alternatingly by


x-coordinate and by y-coordinate
 split by x-coordinate: split by a vertical line that has
half the points left or on, and half right
 split by y-coordinate: split by a horizontal line that
has half the points below or on, and half above
Kd-trees
kd-tree example1

 insert: (30,40), (5,25), (10,12), (70,70), (50,30),


(35,45)
kd-tree example1

insert: (30,40), (5,25), (10,12), (70,70), (50,30), (35,45)


kd-tree example2

 insert: (7,2), (9,6), (5,4), (4,7), (8,1), (2,3)


kd-tree example2
Chapter 6

VORONOI DIAGRAMS
Objectives

 Voronoi Diagram Definition


 Basic Properties,
 Bisector of two points in a plane,
 Open-half plane.
 Voronoi Cells,
 Computing the Voronoi Diagram,
Post Office: What is the area of service?

pi : site points
e : Voronoi edge
v : Voronoi vertex

v
pi e
Definition of Voronoi Diagram

 Let P be a set of n distinct points (sites) in the plane.

 The Voronoi diagram of P is the subdivision of the


plane into n cells, one for each site.

 A point q lies in the cell corresponding to a site pi  P


iff
Euclidean_Distance( q, pi ) < Euclidean_distance( q, pj ), for
each pi  P, j  i.
Voronoi Diagram Example: 1 site
Two sites form a perpendicular bisector

Voronoi Diagram is a line


that extends infinitely in
both directions, and the
two half planes on either
side.
Collinear sites form a series of parallel lines
Voronoi Cells and Segments

Segment v

Bounded Cell Unbounded Cell


Voronoi Properties
A point q lies on a Voronoi edge between sites pi and
pj ,the largest empty circle centered at q touches
only pi and pj
 A Voronoi edge is a subset of locus of points
equidistant from pi and pj

pi : site points
e : Voronoi edge
v : Voronoi vertex v
pi e
Voronoi Properties

A point q is a vertex , the largest empty circle


centered at q touches at least 3 sites
 A Voronoi vertex is an intersection of 3 more
segments, each equidistant from a pair of sites

Voronoi diagram is a useful


planar subdivision of a
discrete point set

v
pi e
Drawing Voronoi diagram

(1) The input points, step one, are called sites, labeled
here A, B, C, etc.
Drawing Voronoi diagram

(2) The next step is to connect the sites to all of their nearest
neighbors without making a line that crosses another.
This is known technically as the Delauney Triangulation.
Drawing Voronoi diagram

(3) Step three is to find and mark the centerpoint of every


line on the Delauney graph
Drawing Voronoi diagram

(4) The fourth step is to draw the perpendicular bisector for each
Delauney line.
This is where careful accuracy, in finding the centerpoints, and in
drawing a tight 90 degree angle, pays off. If everything has been
done correctly, there will always be three lines converging at a
point, unless the input sites are on a perfectly regular rectangular
grid
Drawing Voronoi diagram

(5) The fifth step is to retrace the outline of each Voronoi cell
from the perpendicular bisectors.
Drawing Voronoi diagram
Chapter 7
1

VISIBILITY GRAPHS

1/29/2022
We would like to find a good path, rather than any
feasible path as done in motion planning.
Shortest path is usually good, but not necessarily the
best. Number of turns is important, speed is important,
etc.

We consider only translating planar robot and seek shortest


path. 2 1/29/2022
Roadmap
Reminder Free area
obtained
Minkowski sum
Get trapezoids
of free area

Roadmap
construction

Find shortest
path in roadmap

This is not necessarily the shortest


path
3 1/29/2022
Roadmap

Shortest path
Pgoal
Pstart Shortest path
of roadmap

When BFS is used, path of minimum number of vertices is


found.
For weighted roadmap Dijkstra’s algorithm can be
used.
4 1/29/2022
Lemma : Any shortest path between Pstart and Pgoal
among the set S of polygonl objects is a polygonal
path whose inner vertices are of S.
Proof : If the shortest path
 was not polygonal, it would
have a point p interior of free
space (not a vertex of S), and
not contained in any line
segment of  (otherwise 
must be polygonal).
5 1/29/2022
Shortest
path
Pgoal
Pstart

6 1/29/2022
void ShortestPath ( S, pstart , pgoal ) {
Gvis  VisibilityGraph ( S p start , pgoal ) ;
Assign weight to each eu, v Gvis ; // Euclidean length uv
Find shortest path from pstart to pgoal with Dijkstra's algorithm ;
}
With n polygonal objects and O(n) nodes, naïve
computation of Gvis would take O(n3) time.

Dijkstra’s algorithm finds shortest path between two


nodes of n nodes and k arcs graph in O(nlogn + k) time.

It is possible to compute Gvis in O(n2logn) time.

7 1/29/2022
Computing the Visibility Graph
graph VisibilityGraph ( S ) {
Initialize GV, E, V is all vertices of S, E  ;
 u V {
W  VisibleVertices(u, S) ;
 v W { add eu, v to E }
} return GV, E ; }
Checking the visibility between two vertices, not much
can be done. All objects must be tested for intersection,
taking O(n) time. By ordering the vertices it is possible
to accelerate tests by using info obtained in previous
tests.
8 1/29/2022
Scanning Ray – Rotational Planar
4
Sweep
5
3

1 6

p
7

14
9

13
10
12 11
9 1/29/2022
points VisibleVertices ( p, S ) {
1. Sort vertices of S clockwise w.r.t p. In case of
tie closer precedes farther. Let  w1, , wn  be the
points ;
2. Construct balanced search tree T storing edge
intersections with scanning ray ; Initialize T ;
W  ; // initialize visible points
for ( i 1 to n ) { // traverse all points
if Visible (p, wi ) { W W wi  } // visibility test
add / delete to / from T edges starting / ending at wi .
} return W ; }
10 1/29/2022
p p
wi1 wi1
wi wi

p wi is visible p wi is not
wi1 wivisible
1

wi wi

All special cases can be detected at visibility test of


wi

11 1/29/2022
boolean Visible ( p, wi )
if ( pwi intersects wi's object, locally at wi ) {return false}
// ordinary hiding test
else if (( i 1 ) || ( wi1 is not on pwi )) {
find in T the leftmost edge e ;
if ((e exists) && pwi (intersects e)) {return false}
else {return true}
}
// colinear p, wi1, wi
else if (wi1 is not visible) {return false}
else {
find in T edge e intersecting wi1wi ;
if (e exists) {return false}
else {return true}}}
12 1/29/2022
Chapter 6

VORONOI DIAGRAMS
Objectives

 Voronoi Diagram Definition


 Basic Properties,
 Bisector of two points in a plane,
 Open-half plane.
 Voronoi Cells,
 Computing the Voronoi Diagram,
Post Office: What is the area of service?

pi : site points
e : Voronoi edge
v : Voronoi vertex

v
pi e
Definition of Voronoi Diagram

 Let P be a set of n distinct points (sites) in the plane.

 The Voronoi diagram of P is the subdivision of the


plane into n cells, one for each site.

 A point q lies in the cell corresponding to a site pi  P


iff
Euclidean_Distance( q, pi ) < Euclidean_distance( q, pj ), for
each pi  P, j  i.
Voronoi Diagram Example: 1 site
Two sites form a perpendicular bisector

Voronoi Diagram is a line


that extends infinitely in
both directions, and the
two half planes on either
side.
Collinear sites form a series of parallel lines
Voronoi Cells and Segments

Segment v

Bounded Cell Unbounded Cell


Voronoi Properties
A point q lies on a Voronoi edge between sites pi and
pj ,the largest empty circle centered at q touches
only pi and pj
 A Voronoi edge is a subset of locus of points
equidistant from pi and pj

pi : site points
e : Voronoi edge
v : Voronoi vertex v
pi e
Voronoi Properties

A point q is a vertex , the largest empty circle


centered at q touches at least 3 sites
 A Voronoi vertex is an intersection of 3 more
segments, each equidistant from a pair of sites

Voronoi diagram is a useful


planar subdivision of a
discrete point set

v
pi e
Drawing Voronoi diagram

(1) The input points, step one, are called sites, labeled
here A, B, C, etc.
Drawing Voronoi diagram

(2) The next step is to connect the sites to all of their nearest
neighbors without making a line that crosses another.
This is known technically as the Delauney Triangulation.
Drawing Voronoi diagram

(3) Step three is to find and mark the centerpoint of every


line on the Delauney graph
Drawing Voronoi diagram

(4) The fourth step is to draw the perpendicular bisector for each
Delauney line.
This is where careful accuracy, in finding the centerpoints, and in
drawing a tight 90 degree angle, pays off. If everything has been
done correctly, there will always be three lines converging at a
point, unless the input sites are on a perfectly regular rectangular
grid
Drawing Voronoi diagram

(5) The fifth step is to retrace the outline of each Voronoi cell
from the perpendicular bisectors.
Drawing Voronoi diagram

You might also like