DCEL: doubly connected edge list
edge
: an incident semi-edge originating in $v$origin
: the origin vertextwin
: the opposite semi-edge corresponding to the same edgenext
: the next semi-edge on the same faceprev
: the previous semi-edge on the same faceface
: the incident faceouter_component
: an incident semi-edge from the outer boundary of $f$inner_components
: a list containing one incident semi-edge for each inner boundary of $f$We are given a DCEL of a connected subdivision in a plane. Each face of the subdivision, except for the outer face, is convex. Give an efficient pseudocode for the following tasks.
def vertices(f):
if f.outer_component is None:
e0 = f.inner_components[0]
else:
e0 = f.outer_component
vcs = [e0.origin]
e = e0
while e.next != e0:
e = e.next
vcs.append(e.origin)
return vcs
def outer_face(f):
return f.outer_component is None
def faces(v):
e0 = v.edge
fcs = [e0.face]
e = e0
while e.twin.next != e0:
e = e.twin.next
fcs.append(e.face)
return fcs
f = v.edge.face
)f = e.twin.face
and repeatdef common_vertex(f):
if f.outer_component is None:
e0 = f.inner_components[0]
else:
e0 = f.outer_component
fcs = set()
e = e0
fcs.union(faces(e.origin))
while e.next != e0:
e = e.next
fcs.union(faces(e.origin))
fcs.remove(f)
return fcs
def add_segment(f, p, q):
find semi-edge e incident to f such that pq intersects e in a point v
p.edge = Edge()
v.edge = Edge()
v.edge.origin = v
v.edge.face = f
v.edge.next = e.next
v.edge.prev = p.edge
v.edge.twin = e.twin
e.next.prev = v.edge
e.next = Edge()
e.twin.twin = v.edge
e.twin = Edge()
e.twin.origin = v
e.twin.face = v.edge.twin.face
e.twin.next = v.edge.twin.next
e.twin.prev = v.edge.twin
e.twin.twin = e
e.twin.next.prev = e.twin
e.twin.prev.next = e.twin
e.next.origin = v
e.next.face = f
e.next.next = v.edge.prev
e.next.prev = e
e.next.twin = v.edge.prev
p.edge.origin = p
p.edge.face = f
p.edge.next = v.edge
p.edge.prev = e.next
p.edge.twin = e.next
f = e.twin.face
while pq has another intersection u with the boundary of f:
split the face f with uv
f = face on the other side of the edge split by u
v = u
add the segment vq
We are given a DCEL representing a subdivision of the plane and a face $f$ of this subdivision. Assume that each face of the subdivision is defined by a cycle of edges without repetitions. We want to delete all edges incident to $f$, i.e., we delete the edges from the set $D = \lbrace e \mid e \text{ is an edge of } f \rbrace$. Assume that the subdivision remains connected after $D$ is deleted. Write the pseudocode for deleting the edges of $D$ and updates the DCEL. What is the time complexity of the algorithm?
Let $H$ be a set of $n$ lines in the plane which intersect in the same point $p$, and let $H’$ be a set of $m$ lines in the plane which intersect in another point $p’ \ne p$. The lines of $H$ do not contain $p’$ and the lines of $H’$ do not contain $p$.
$v - e + f = 1$ (since we have a connected arrangement with infinite edges)
Let ${L_h}$ and ${L_v}$ be sets of $n$ horizontal lines and $n$ vertical lines in a plane, respectively. Let ${L_p}$ be a set of $n$ lines in a plane intersecting in a point $p$. No line of ${L_p}$ is horizontal or vertical and no line from ${L_h}$ or ${L_v}$ contains the point $p$. Furthermore, no three lines ${\ell_h} \in {L_h}, {\ell_v} \in {L_v}, {\ell_p} \in {L_p}$ intersect in the same point.