CSE 555 Spring 2010 HW #3
Chao Xu(106978083)
(1)
Assume no 2 points have the same
x
-coordinate, if there are, rotate the plane such that no 2 points have thesame
x
-coordinate.
H
has
n
vertices,
P
has
m
vertices.Find a extreme point of
H
in
x
-coordinate (
O
(
n
)). Let that point be
p
. Draw a vertical line
l
though
p
.Find the edge that intersect
l
and visible to
p
.(
O
(
m
)). Let the intersecting points be
a
and
a
. Such edgemust exist because
H
is inside
P
. Let those two edges be
E
1
and
E
2
. Find the vertex on
E
1
and
E
2
withlarger
x
-coordinate. Pick the one with the smaller
x
-coordinate. wlog, let it be the vertex on
E
1
and letthat be
b
. Let the intersection of the vertical that goes though
q
and edge
E
2
be
b
(
O
(1)). Find the set
S
that contains all the verticies inside the trapezoid
aa
b
b
(
O
(
m
)). Connect
p
to the one with the largest
x
-coordinate. It will create a vertex bridge. Total
O
(
n
+
m
).Suppose the vertex in
S
with the largest
x
-coordinate is not visible. Then there must be a edge blocking it.
case 1
the edge has a vertex with larger
x
-coordinate inside
aa
b
b
, then that vertex’s
x
-coordinate islarger than the vertex with the largest
x
-coordinate in
S
, a contradiction.
case 2
If the edge’s both vertices are not inside
aa
b
b
, then the edge have to cross
E
1
or
E
2
at someplace, the polygon is not simple, a contradiction.There is no edge block the visibility. The algorithm is correct.
(2)
Find the bounding box of
P
and
Q
. In fact, only the
y
-bounds are useful. This is a
O
(
|
P
|
+
|
Q
|
) operations.Then draw a horizontal line in the overlapping
y
bounds, let it be
h
. This line have to intersect
P
and
Q
atsome point.1. Find the intersection of
Q
and
h
that has maximum and minimal
x
-coordinates.2. Let them be
maxQ
and
minQ
respectively.3. Find the intesection of
P
and
h
, such that it’s
x
-coordinate is the minimal but still larger than
maxQ
’s
x
-coordinate.4. If one exists, make a edge between the intersections. It completes a bridge, and can be fed into thesimple polygon checking algorithm. If it doesn’t exist, do 3 with
max
and
min
,
larger
and
smaller
switched.5. If still non exist, do 1 to 4 with
P
and
Q
switched.Every step cost linear time. The algorithm is a
O
(
|
P
|
+
|
Q
|
) algorithm, and will find all polygons that haveintersecting boundaries.
(3)
Problem 3.2
Similar to Chvatal’s comb.1
Leave a Comment
91 out of 100