\input CgNHdr \begfile{CgN9Garbage.tex of August 4, 1983 1:41 pm --- Stolfi} % garbage from CgN9.tex \chapter{8G}{GARBAGE DELETED FROM CgN9} To simplify the prose, we will refer to the elements of $P$ as the {\it sites}, and $x$ will be called the {\it query}. If the points $\rset{\dist(p,x)\relv p\in P}$ and selecting the minimum. The trivial algorithm for finding the closest point consist in computing all distances $\rset{\dist(p,x)\relv p\in P}$ and selecting the minimum. This requires $\Theta(n)$ time for points in the plane ($\Theta(kn)$ if the points belong to a $k$-dimensional space). Since in general every coordinate of every point must be examined, this algorithm is optimal. This diagram consists of is a subdivision of the space $\Sscr$ into disjoint regions, with the property that two query points fall in the same region if and only if they have the same nearest site. E If the points $V(\set{p1, p2, \ldots, pm})$ \item \section{8.1. The Voronoi diagram in one dimension} As a warm-up exercise, let's consider first the case where the space $\Sscr$ has dimension 1, i.e. is a straight line. We can think of each point as a real number (its coordinate from some fixed origin on the line), so the Euclidean distance between two points $p$ and $q$ is $\leftv p-q \rightv$. Let $p$ and $q$ be two sites with $p>>} If and only if $K$ has affine rank $k-r$, and there is a closed $k$-dimensional ball $S\subset \Sscr$ such that $K$ lies on its boundary and $S$ contains no other sites of $P$.} Therefore, the Voronoi diagram in Euclidean space consists of a collection of convex polytopes, each associated with one site. As we saw before, if the dimension $k$ of $\Sscr$ is 1 the Voronoi regions are either closed intervals, half-rays, or the whole real line. If $k=2$, they are convex polygons; if $k=3$, convex polyhedra. The figure below shows a set of ten points in the plane and its Voronoi diagram:\fig5 From the definition, it is clear that every point of $\Sscr$ belongs to at least one Voronoi region. The next theorem shows that the converse is almost true: \lemma{8.?}{A point $x\in V(p)$ belongs to some other Voronoi region if and only if it is on the boundary of $V(p)$.} \proof{If $x\in V(p)\inte V(q)$, then $p$ and $q$ are both the closest sites to $x$, implying $dist(x, p)=dist(x, q)$. It follows $x\in B(p, q)$. Since $V(p)$ lies entirely in one side of $B(p, q)$ and has $x$ in common with it, $B(p, q)$ is a supporting plane of $V(p)$, and therefore $x$ is on the boundary of $V(p)$. \pp As for the converse, let $x$ be on the boundary of $V(p)$, and consider the set $\Rscr(r)$ of Voronoi regions other than $V(p)$ intersected by a ball $B$ centered at $x$, as a function of its radius $r$. As $r$ goes to zero, $\Rscr(r)$ decreases monotonically according to $\subset$. Since $x$ lies on the boundary of $V(p)$, $B$ always contains some point that is not in $V(p)$, and therefore $\Rscr(r)$ is not empty for all $r$. It follows there is some region $V(q)\neq V(p)$ that is intersected by all such balls, implying that $x$ is also on the boundary of $V(q)$. Since Voronoi regions are closed sets, $x$ belongs to both $V(p)$ and $V(q)$.} From this theorem we conclude immediately that Voronoi regions have pairwise disjoint interiors, and in fact every point of $\Sscr$ is either in the interior of exactly one Voronoi region, or on the boundary of two or more regions. Let $K$ be any subset of $P$, and let us denote by $V(K)$ the set of all points $x\in Sscr$ that belong to all Voronoi regions of the sites in $X$ of Consider the set $X=\interi V(pi)$ of all points of $\Sscr$ that belong to $m\geq 2$ specific Voronoi regions, say $V(p1), V(p2), \ldots, V(pm)$, and to no other. Obviously $X$ is a convex set, all its points are equidistant from all sites $pi$, and are closer to the sites $pi$ than to any other site in $P-\set{p1, p2, \ldots, pm}$. It follows that , it is contained in all bisectors $B(pi, pj)$ with $1\leq i 180\deg > \hat r+\hat s$.} \proof{Let $C$ be a $P$-free circle passing through $p$ and $q$ and through no other sites. Since $Q$ is convex, the segment $rs$ must cross $pq$ at some point $o$ inside $c$. The sites $r$ and $s$ must be outside $C$; so, there are two points $r\pr$ and $s\pr$ where $C$ intersects $r$ and $s$, respectively.\fig3 \pp Consider now the internal angles of the quadrilateral $Q\pr=pr\pr qs\pr$. Since $Q\pr$ is inscribed in a circle, each pair of opposite angles must add to $180\deg$ (To see why, consider the arcs of $C$ subtended by each angle of $Q\pr$). Now, since $r\pr$ and $s\pr$ are interior to the triangles $prq$ and $qsp$, we can conclude that the angles at $p$ and $q$ in $Q$ are definitely greater than those in $Q\pr$. Also, the angles at $r$ and $s$ in $Q$ are definitely smaller than the angles at $r\pr$ and $s\pr$ in $Q\pr$. We conclude that, in the quadrilateral $Q$, $\hat p+\hat q > 180\deg > \hat r+\hat s$.} The converse runs as follows: let $p,q$ be two sites. Then $pq$ is an edge of the Delaunay if and only if for every pair $r, s$ of sites, either Every Delaunay edge is a chord of a $P$-free circle, so in particular it cannot pass through any of the sites. In fact, even more is true: \lemma{\Th{11}}{Two sites $p, q$ are vertices of the same interior (resp. exterior) face of the Delaunay if and only if the corresponding Voronoi regions are incident to the same finite (resp. infinite) Voronoi vertex\foot1{{\bf This lemma is probably superfluous. Theorems \Th{9C} and \Th{10} are enough to prove that the Delaunay and Voronoi are duals of each other (there should be a theorem to this effect in chapter 5). Then lemma \Th{11} folow from properties of dual subdivisions.}}.} \proof{Let $p0, p1, \ldots, p{m-1}$ be the vertices (sites) on the boundary of a Delaunay face $F$, in counterclockwise order as seen from a point interior to the face. Let us denote by $e{ij}$ the Voronoi edge (if any) between $\V\set{pi}$ and $\V\set{pj}$, {\it oriented counterclockwise as seen from $pi$}. (Note that $e{ji}$ is the same edge as $e{ij}$, taken with opposite orientation.) Since there is a Delaunay edge $pip{i+1}$ between any two consecutive sites\foot\dag{Including $p{m-1}$ and $p0$. All indices in this proof are to be taken modulo $m$.}, the Voronoi edge $e{i,i+1}$ (and $e{i-1,i}$) exists for all $i$. \pp By theorem \Th{10}, we know that $e{i,i-1}$ and $e{i,i+1}$ occur consecutively (in that order and in the forward direction) on the boundary of $\V\set{pi}$. It follows that the destination of $e{10}\pr$ is a Voronoi vertex $v$ (possibly $\omega$) that is also the origin of $e{12}$. Since $v$ is the destination of $e{21}$, and $e{23}$ follows $e{21}$ around $\V\set{p2}$, we conclude $v$ is also the origin of $e{23}$. In the same way, we conclude that all edges $e{i,i+1}$ have a common origin $v$. \pp If $F$ is an interior (i.e., bounded) face, then at least one of the angles $p{i-1}pip{i+1}$ (say, $p0p1p2$) is convex. But then the counterclockwise angle between $e{10}$ and $e{12}$ is less than $180\deg$, meaning that $v$ is finite. Conversely, if $F$ is unbounded then at least one of the angles $p{i-1}pip{i+1}$ is concave, and a similar reasoning shows that $v$ is $\omega$. Since all faces $\V\set{p{i}}$ are incident to $v$, this concludes the ``only if'' part of the theorem} \pp Let us now show the converse. Let $\V\set{p0}, \V\set{p1}, \ldots, \V\set{p{m-1}}$ be the Voronoi faces incident to a Voronoi vertex $v$. If $v$ is $\omega$, those Voronoi faces are unbounded; by theorem \Th7, all sites $pi$ lie on the boundary of the $\hull(P)$, and any two of them can be connected by a path entirely outside the hull. Since all Delaunay edges are entirely contained in $\hull(P)$, this path will not cross any of them. Therfore, all the $pi$ lie on the same (exterior) face of the Delaunay. \pp If $v$ is finite, assume the regions $\V\set{p0}, \V\set{p1}, \ldots, \V\set{p{m-1}}$ occur in counterclockwise order around $v$. Since Voronoi faces are convex, the sites $p0, p1, \ldots, p{m-1}$ must also occur in counterclockwise order around $v$. Since $\V\set{pi}$ is adjacent to $\V\set{p{i+1}}$, there is a Delaunay edge $pip{i+1}$, for all $i$. Those edges define a star-shaped polygon (as seen from $v$). By theorem \Th{10}, no other edge can be incident to a site $pi$ from inside the polygon; by theorems \Th9 and \Th{9B}, no Delaunay edges or vetices can lie in its interior. Therefore, the polygon $\langle p0, p1, \ldots, p{m-1}\rangle$ is an (interior) face of the Delaunay} This lemma has a surprising consequence: \theorem{8.6}{Two distinct edges $pq$ and $rs$ of $\Dscr(P)$ are either disjoint or have a single endpoint in common.} \proof{Suppose $p$ lies on $rs$ but is distinct from $r$ and $s$. Then $B(r,p)$ and $B(s,p)$ are parallel, and $C(r,p)\inte C(s,p)=\ety$. \fig4 Since $Vr\subset C(r,p)$ and $Vs\subset C(s,p)$, this contradicts the hypothesis that $r$ and $s$ are connected. \pp Now suppose $pq$ and $rs$ meet at some point $o$ that is none of the four endpoints.\fig4 This implies the quadrilateral $Q=\langle p,r,q,s\rangle$ is convex; by lemma 8.5, we should have both $\hat p+\hat q>\hat r + \hat s$, and vice-versa --- again, a contradiction. Therefore, if $pq$ and $rs$ have a point in common, it must be an endpoint of both segments.} Therefore, the edges of the Delaunay diagram do not cross! This fact is all the more surprising if we note that $pq$ may not cross $e{pq}$, but may cross several other edges $e{p\pr q\pr}$ ``unrelated'' to it.\fig4 \digress {By considering only the incidence relationships between vertices and edges, and ignoring their coordinates, the Voronoi diagram $\Vscr(P)$ can be viewed as an undirected planar graph; indeed, if we take into account also the incidence between faces, vertices and edges, $\Vscr(P)$ is a specific embedding of that graph in the plane, i.e. a {\it planar map}. \dp Given an embedding $M$ of a planar graph $G$, we define a {\it dual graph} $G*$ of $G$ by taking the faces of $M$ as vertices of $G*$, and drawing an edge between $f$ and $g$ in $G*$ whenever $f$ and $g$ share an edge in $M$. (The dual of a graph is not uniquely defined, for different embeddings may give rise to non-isomorphic duals.) We know from Graph Theory that $G*$ is also a planar graph, and therefore can be drawn in the plane without crossing edges. \dp In view of this, theorem 8.6 may not seem so exciting, since $\Dscr(P)$, viewed as a graph, is clearly the dual of $\Vscr(P)$. However, the planarity theorems from Graph Theory assume that the edges of the dual can be drawn with curved lines, and/or that the vertices of the dual can be positioned arbitrarily in the plane. If we require that the edges be straight lines, and that the dual vertices are inside the corresponding faces of the original map, it may be impossible to avoid crossing edges, as is the case for the map below.\fig4 If nothing else, this shows that not every convex subdivision of the plane is the Voronoi diagram of some set $P$. \dp Let $M$ be an embedding of a planar graph $G$, let $G*$ be the dual graph constructed from $M$, and let $M*$ be an embedding of $G*$. We say that $M*$ is the {\it dual map} of $M$ if and only if the neighbors of a given vertex $f$ of $M*$, in counterclockwise order, are the faces of $M$ adjacent to the face $f$, in the same order. In general, not all embeddings of $G*$ have this property, and those which do are topologically equivalent. The next few theorems show that $\Dscr(P)$ is the dual of $\Vscr(P)$ as a map, not just as a graph.} \subsection{\Ch8.\Sec3.\Sbsec3. Delaunay diagrams as convex hulls} {\bf Use quadratic mapping. Perhaps the duality between V and D diagrams could come easier through this.} \lemma{7.2}{Each convex hull edge is a Delaunay edge.}\par \proof{The half-plane supporting the edge and not containing the convex hull is a degenerate circle witness to the Delaunayhood of the edge.}\par \theorem{\Th{16}}{To every oriented circle $C$ on the plane there corresponds a unique oriented plane $\pi(C)$ in three space with the following property: A point $p$ is on (resp. to the left of) $C$ if and only if the image $\lambda(p)$ is on (resp. to the left of) $\pi(C)$.} \lemma{\Th{50}}{Let $T$ be a set of sites, and $S\subset T$. Any edge of $\DT$ whose endpoints are both in $S$ is also an edge of $\DS$.\fig3} \proof{For any such edge $e$, consider the $T$-free circle that proves $e$ is an edge of $\DT$. That circle is also $S$-free, and therefore proves $e$ is an edge of $\DS$.} \lemma{\Th{51}}{Let $T$ be a set of sites, and $S\subset T$. If $e$ is an edge of $\DS$ that is not in $\DT$, then both endpoints of $e$ are connected to $T-S$ in $\DT$.\fig3} \proof{Let $u$ be any endpoint of $e$, and $C$ be the $S$-free circle that proves $e$ is an edge of $\DS$. Since $e$ is not in $\DT$, $C$ contains some site of $T$ (and only sites of $T$) in its interior. Let $C\pr$ be the largest $T$-free circle that is interior to $C$ and tangent to it at the point $u$. The sites on the boundary of $C\pr$ are all in $T$ except $u$ itself. If there is only one such vertex $t$, lie all on the same face of face of $\DT$, and are all in $T$ except $u$; therefore, $S$-free, and therefore proves $e$ is an edge of $\DS$.} \proof{For any such edge $e$, consider the ($S\uni T$)-free circle that proves $e$ is an edge of $\D{s\uni T}$. That circle is also $S$-free, and therefore proves $e$ is an edge of $\DS$.} These observations apply equally well to Delaunay triangulations. In particular, the consequences of adding a single new site $q$ to a Delaunay triangulation $\D$ have a simple structure: we have to delete some of the old edges, and add new edges between $q$ and some old sites $p1, p2, \ldots, pm$. $\V\pr\set{p}$ will be equal to $\V\set{p}$ minus $\V\pr\set{q}$ and its boundary. So, the only faces that will be affected are the ones whose sites are $q$ that will be neighbors of $p$ in the dual $\Dscr\pr$ of $\Vscr\pr$..\fig4 Therefore, the addition of $p$ requires that we compute the new region $Vp\pr$, and erase that portion of $\Vscr$ that lies inside it. The hardest part of this computation is figuring out which points of $P$ will be adjacent to $p$ in $\Dscr\pr$. It is not hard to get one of them: if we locate the region $Vq$ of the original diagram that contains the new point $p$, then $q$ will be the nearest neighbor of $p$ in $P\pr$, and, by lemma 8.11, $p$ and $q$ will be adjacent in $\Dscr(P\pr)$. More than that, the midpoint $o$ of $pq$ will be a point of the edge separating $Vp\pr$ from $Vq\pr$. It is easy to see that, in the original diagram, $o$ belongs to $Vq$. If we proceed along the bissector $B(p,q)$, starting from $o$ and moving counterclockwise as seen from $p$, we will eventually meet the boundary of $Vq$ at some point $v$. Let $Vr$ be the region of $\Vscr$ that is on the other side of the boundary at that point, i.e. let $e{qr}$ be the edge of $Vq$ containing $v$.\fig4 The point $v$ is equidistant from $p$, $q$ and $r$, and no other data point is closer to it than those three; therefore, $v$ is a Voronoi vertex of the new diagram. The edge $e{qr}$ is divided in two pieces by $v$: the one closest to $p$ has to be discarded, but the other will be an edge of $\Vscr\pr$. The third edge of $\Vscr\pr$ incident at $v$ is on the bissector $B(p,r)$; if we start at $v$ and proceed counterclockwise (as seen from $p$) along that bissector, we will eventually leave $Vr$ at some point $v\pr$, wich will be the next vertex of $Vp\pr$. If we repeat this process, we will obtain all edges and vertices of $Vp\pr$, and eventually we will get back to the point $o$. At some iteration of this algorithm, it may happen that the edge we are following leaves the current region $Vq$ through some vertex $v$ of the current Voronoi diagram, rather than across an edge.\fig4 In that case, there will be two or more regions of $\Vscr$ abutting at $v$, besides the one from which we came. To continue the traversal, we must move into the region $Vr$ that is immediately adjacent to $Vq^P$, in {\it clockwise} order as seen from $v$. One way to avoid this situation is to ensure that no four data points lie on the same circle. Another way is to allow edges of zero length (see the discussion of the `` patched'' Voronoi diagram, in section 8.???): if we hit the boundary of $Vq$ at a vertex $v$, we take either of the edges incident at $v$, and proceed as if we had hit only that edge. {\bf This is not as simple as it looks. How do we make sure the resulting graph (abstracting from edge lengths) is still planar and properly embedded? I.e., how do we keep the clockwise orderings of edges around adjacent vertices consistent if the edges have length zero? If you throw in numerical errors, the problem becomes frightening; a satisfactory (but not easy) compromise would be an algorihm that works in all cases if exact rational arithmetic is used throughout. Maybe such a disclaimer should be added to the introduction.} The algorithm below describes these ideas in more detail. We are assuming the Voronoi diagram $\Vscr$ is represented by the data structure discussed in section 8.???. \algorithm{8.1}{Incremental computation of the Delaunay diagram.}{ \step 1. [Locate nearest neighbor.] {Find the point $q\in P$ that is closest to $p$.} \step 2. [Initialize.] {Let $a$ be the null edge record $\Lambda$. Search the list of edges incident to $q$ in counterclockwise order, and let $b$ point to the one that would follow immediately the edge $(q,p)$ (if $q$ has degree 0, i.e. it is the only point in $P$, set $b\gets \lambda$).} \step 3. [Insert new edge.] {Create a new record $e$ for the directed edge $(p,q)$, and insert it before $a$, and its symmetrical $(q,p)$ after $b$. Otherwise, let $e$ be the first edge incident to $q$, in clockwise order, that .}} The relationship between the four lifted points that is described in lemma \Th{40A} is a fundamental predicate of three-dimensional geometry: \definition{\Def6}{We say that four points $p, q, r, s$ of space, in that order, are {\it positively} (resp. {\it negatively}) {\it oriented} if they are not coplanar and the triangle $pqr$ is oriented counterclockwise (resp. clockwise) as seen from $s$.} The property of being positively oriented is the three-dimensional analog of the $\CCW$ predicate, since $\CCW(a, b, c)$ is true if and only if the directed segment from $a$ to $b$ points to the left as seen from $c$. The analogy is even more evident from the following result: \lemma{\Th{41A}}{The points $p$, $q$, $r$, and $s$ of $\reals^3$, in that order, are positively oriented, coplanar, or negatively oriented, depending on whether the determinant $$\Delta(p,q,r,s)=\det{\matrix4{ xpypzp1\cr\va xqyqzq1\cr\va xryrzr1\cr\va xsyszs1\cr}}\eqno(\Eq6)$$ is positive, zero, or negative, respectively.} \proof{Let us displace all four points by a parallel translation so that the point $s$ is moved to the origin; that is, consider the points $p\pr=p-s$, $q\pr=q-s$, $r\pr=r-s$, and $s\pr=s-s=(0,0,0)$. Obviously, the four points $p\pr$, $q\pr$, $r\pr$, and $s\pr$ are oriented with respect ot each other in exactly the same way as $p$, $q$, $r$, and $s$. Furthermore, the determinant $$\Delta(p\pr,q\pr,r\pr,s\pr)=\det{\matrix4{ x{p\pr}y{p\pr}z{p\pr}1\cr\va x{q\pr}y{q\pr}z{q\pr}1\cr\va x{r\pr}y{r\pr}z{r\pr}1\cr\va 0001\cr}} =\det{\matrix4{ xp-xsyp-yszp-zs1\cr\va xq-xsyq-yszq-zs1\cr\va xr-xsyr-yszr-zs1\cr\va xs-xsxs-xsxs-xs1\cr}}$$ is obtained from $\Delta(p,q,r,s)$ by subtracting from the each of the first three columns an appropriate multiple of the fourth. Therefore, the two determinants are equal. By expanding on the four row, we get $$\Delta(p\pr,q\pr,r\pr,s\pr)=\det{\matrix3{ x{p\pr}y{p\pr}z{p\pr}\cr\va x{q\pr}y{q\pr}z{q\pr}\cr\va x{r\pr}y{r\pr}z{r\pr}\cr}}$$ \pp {\bf now prove that this determinant is positive if and only if the triangle $p\pr q\pr r\pr$ is counterclockwise oriented as seen from the origin. We know that it is positive if and only if the vectors $p\pr$, $q\pr$, and $r\pr$ form a right-handed coordinate system. Is that enough? perhaps we should use this in the definition of positively oriented and in lemma \Th{40A}.} } The algorithms we are going to see in this section are all based on the $\incircle$ predicate, defined below, that given four points on the plane tests whether one of them is inside the circle determined by the other three. Actually, the definition we are going to give is somewhat more involved, and at first may seem a bit counterintuitive. Its justification is that the resulting predicate is mathematically ``cleaner'' (that is, easier to manipulate in proofs) and corresponds to a very simple algebraic predicate in terms of the coordinates of the four points. In many applications it is convenient to treat straight lines (with the addition of the point at infinity) as circles with infinite radius. Topologically, the two concepts are equivalent: like a circle, a straight line divides the extended plane in two simply connected regions. However, there is no natural criterion for calling one of these regions the ``interior'' of the line, and the other the ``exterior''. We will resolve this ambiguity by specifying an orientation for the line, and substitute the notions of ``left side'' and ``right side'' for ``interior'' and ``exterior''. Mathematical cleanliness then requires we trat circles in the same manner. This justifies the following definitions: \lemma{\Th{16}}{Every oriented circle is mapped to a planar section of the paraboloid $\Lambda$, and vice-versa.\fig5} \proof{A straight line $\lscr$ on the $(x, y)$ plane is obviously mapped to the intersection of of $\Lambda$ with a vertical plane passsing through $\lscr$. \pp Now consider a circle $C$ with center $c$ and radius $r$. A point $p=(x,y)$ is on $C$ if and only if $$(x-xc)^2+(y-yc)^2=r^2,\eqno(\Eq6)$$ which is equivalent to $$x2+y2=(-2xc)x+(-2yc)y+(r2-xc^2-yc^2).\eqno(\Eq7)$$ But this is precisely the condition for the point $\lambda(p)=(x, y, x2+y2)$ to lie on the plane whose equation is $$z=(-2xc)x+(-2yc)y+(r2-xc^2-yc^2),$$ from which the theorem follows.} \lemma{\Th{16}}{To every oriented circle $C$ there corresponds a unique oriented plane $\pi(C)$ intersecting lambda, and vice-versa, with the property that a point is to the left of $C$, on $C$, or to the right of $C$ depending on whether $\lambda(p)$ is to the left of $\pi(C)$, to the right of $\pi(C)$, Every oriented circle is mapped to a planar section of the paraboloid $\Lambda$, and vice-versa.} In fact, even more is true. Let $pi(C)$ be the plane containing the image of a circle $C$ on $\Lambda$. Then, if we replace $=$ by $\leq$ in equation \Eq6, we immediately conclude that \lemma{\Th{17}}{A point $p$ is inside (resp.outside) a circle $C$ if and only if $\lambda(p)$ is below (resp. above) the plane $\pi(C)$} \subsection{\Ch8.\Sbsec{\Sec2.1}. The $\incircle$ test} {\bf Fix this. Define the incircle test only for ccw quadrilaterals at first. Leave the extension to collinear points for later?} \xx{Pieces removed from here} Another interpretation of the $\incircle$ test can be obtained via the quadratic mapping $\lambda$ defined in the previous section: \lemma{\Th{40A}}{The predicate $\incircle(a, b, c, d)$ is true if and only if the triangle $\lambda(a)\lambda(b)\lambda(c)$ is clockwise oriented as seen from $\lambda(d)$.} \proof{First, consider the case where $a$, $b$ and $c$ lie on a circle $C$ of finite radius. According to lemma \Th{17}, the point $d$ is inside $C$ if and only if its image $\lambda(d)$ on the paraboloid $\Lambda$ is below the plane $\pi(C)$ containing $\lambda(C)$, which is the plane passing through the points $\lambda(a)$, $\lambda(b)$, and $\lambda(c)$. If the points $a$, $b$, and $c$ occur on $C$ in counterclockwise order, then the triangle $\lambda(a)\lambda(b)\lambda(c)$ on the plane $\pi(C)$ will be clockwise oriented as seen from $\lambda(d)$ if and only if $\lambda(d)$ is below $\pi(C)$, i.e., $d$ is inside $C$. If $a$, $b$, and $c$ occur in clockwise order, the situation is reversed: $\lambda(a)\lambda(b)\lambda(c)$ will be clockwise oriented as seen from $\lambda(d)$ if and only if $\lambda(d)$ is above $\pi(C)$, i.e. if and only if $d$ is outside $C$. The theorem then follows from this and from the definition of $\incircle$.\fig6 \pp Now consider the case when the points $a$, $b$ and $c$ are distinct but lie on a common line $\lscr$. The points $\lambda(a)$, $\lambda(b)$, and $\lambda(c)$ determine a unique vertical plane $\pi(\lscr)$ (that also passes through $\lscr$). Let us orient $\lscr$ so that it passes through $a$, $b$, and $c$ in that order (or any cyclic permutation thereof), i.e., so that$\lscr=\circle(a, b, c)$. Let us also define the left half-space of $\pi(\lscr)$ as the one containing the left half-plane of $\lscr$.\fig6 \pp It is obvious from the concavity of $\Lambda$ that $\lambda(a)$, $\lambda(b)$, and $\lambda(c)$ will not be collinear. By analyzing the three possible orderings of $a$, $b$ and $c$ on $\lscr$, we can see that the triangle $\lambda(a)\lambda(b)\lambda(c)$ will be clockwise oriented as seen from $\lambda(d)$ if and only if $\lambda(d)$ lies on the left side of $\pi(\lscr)$, that is, if and only if $d$ lies on the left side of $\lscr$. This concludes the proof.} Lemma \Th{40A} says that $\incircle(a, b, c, d)$ is true if and only if the points $\lambda(a)$, $\lambda(b)$, $\lambda(c)$, and $\lambda(d)$ are negatively oriented. Therefore, we conclude that \theorem{\Th{43}}{The predicate $\incircle(a, b, c, d)$ is true if and only if $$\det{\matrix4{ xayaxa^2+ya^21\cr\va xbybxb^2+yb^21\cr\va xcycxc^2+yc^21\cr\va xdydxd^2+yd^21\cr}}<0.\eqno(\Eq7)$$} \algorithm{\Alg{0A}}{Triangulation of $n$ points by $x$-sort.}{ \begblock \comm{The input is set $P$ of $n\geq2$ points. On output, $T$ will be a triangulation of those points.} \step{\sno{\Step0} Sort th epoints by increasing $x$-coordinate, breaking ties by $y$-coorcinate. Let the points be $p1, p2, \ldots, pn$, in that order.} \step{\sno{\Step1} Let $T$ be the graph consisting of $p1$ and $p2$ connected by a single edge. Let $e$ be that edge, directed from $p2$ to $p1$.} \step{\sno{\Step2} For $i=3,4,\ldots, n$ do:} \begblock \comm{At this point $T$ is a triangulation of $p1, p2, \ldots, p{i-1}$. The origin of $e$ is $p{i-1}$, and its right face is the exterior face of $T$.} \step{\sno{\Step3} Set $e\pr\gets e\oprev$. Connect $pi$ to $p{i-1}$ by a a new edge $f$.} \step{\sno{\Step4} \sna{[Walk clockwise around $T$]} While $\CCW(pi, e\pr\org, e\pr\dest)$ do} \begblock \step{\sno{\Step5} Set $e\pr\gets e\pr\lnext$. Connect $pi$ to $e\pr\org$ by a new edge, and repeat step \Step4.} \endblock \step{\sno{\Step7} \sna{[Walk counterclockwise around $T$]} While $\CCW(e\org, pi, e\dest)$ do} \begblock \step{\sno{\Step8} Set $e\gets e\lnext$. Connect $pi$ to $e\org$ by a new edge $f$, and repeat step \Step6.} \endblock \step{\sno{\Step9} Set $e\gets f$ and repeat from step \Step2.} \endblock \endblock } We can view the whole process as iterated applications of an {\it incremental algorithm} that, given $P$ and a new site $s$, constructs a for the set $P\pr=P\uni\set{s}$. Suppose we have just added the new site $s$ to $\DT$ by algorithm \Alg{0.5}, resulting in a new triangulation $T\pr$ of $P\pr$. We now apply algorithm \Alg0 to $T\pr$. For simplicity, let us assume $s$ was located in an interior face $F=uvw$ of $\DT$:\fig4 \subsection{\Sbsec{\Sec2.1}. Incremental triangulation} To apply algorithm \Alg0, we need first construct an arbitrary triangulation of the set $P$, which is not an entirely trivial task. One method we can use is to start from a minimal triangulation (say, two sites connected by an edge), and add to it the remaining sites, one at a time. To insert a new site $s$ into the current triangulation $T$, we first locate the face $F$ of $T$ that contains $s$. If it is an interior face, we connect its three vertices to $s$ by new edges. If it is the exterior face, we connect to $s$ all vertices of $F$ that are visible from $s$.\fig5 \subsection{\Sbsec{\Sec2.2}. Incremental Delaunay triangulation} In summary, the proposed method for constructing a Delaunay triangulation of $P$ is to begin with a trivial triangulation (two sites and a single edge), use algorithm \Alg{0.5} repeatedly to insert the remaining sites one by one, and then feed the resulting triangulation to the edge-swapping algorithm \Alg0. A slight variant of this process gives us an {\it incremental} algorithm for Delaunay triangulation. The idea is to apply the edge-swapping algorithm \Alg0 to each intermediate triangulation, after inserting each new site, so that at every stage we have a Delaunay triangulation for the sites added so far. In other words, given a Delaunay triangulation $\DT$ for $P$ and a new site $s$, we construct a Delaunay triangulation $\DT\pr$ for the set $P\pr=P\uni\set{s}$. Let us consider this variant in more detail. Suppose we have just added the new site $s$ to $\DT$ by algorithm \Alg{0.5}, resulting in a new triangulation $T\pr$ of $P\pr$. We now apply algorithm \Alg0 to $T\pr$. For simplicity, let us assume $s$ was located in an interior face $F=uvw$ of $\DT$:\fig4 All edges in the Delaunay triangulation $\DT$ were known to satisfy the angle condition. What can we say about $T\pr$? are all its edges suspect? Clearly not: the only edges for which the condition may have become false are those adjacent to $F$, namely $uv$, $vw$, and $wu$. Furthermore, the new edges $su$, $sv$ and $sw$ always satisfy the angle condition, as is easily shown. Since $\DT$ is a Delaunay triangulation of $P$, the circumcircle $C$ of $F$ is $P$-free. The new site $s$ is strictly inside $C$, and therefore the circle $Cu$ passing through $s$ and tangent internally to $C$ at $u$ is $P\pr$-free. In fact, $Cu$ passes through $s$ and $u$, but through no other site of $P\pr$. This proves $su$ is an edge of the Delaunay diagram of $P\pr$, and therefore (by lemma \Th{21}) it satisfies the angle condition in {\it any} triangulation of $P\pr$. The same is clearly true of $sv$ and $sw$. So, in step \Step1 of algorithm \Alg0 we can initialize $S$ to $\set{uv, vw, wu}$ only, and proceed to the main loop (steps \Step2--\Step4). At this point, the following statements about the current triangulation are obviously true: \indent 1. Every edge $e=pq$ in $S$ has $pqs$ as its left face. \indent 2. Every edge that was not in $\DT$ is incident to $s$, and is an edge of the Delaunay diagram of $P\pr$. Now consider what happens on the execution of steps \Step3--\Step4. If the edge $e=pq$ lies on the exterior face, or satisfies the angle condition, it is simply ignored, and we return to step 2. Otherwise $e$ is deleted from the triangulation $T\pr$, and replaced by the new edge $sr$.\fig3 At this point algorithm \Alg0 would add to the bag $S$ the four edges $pr$, $rq$, $qs$ and $sp$, on the grounds that the swapping of $e$ may have falsified their angle properties. However, by statement 2 above and lemma \Th{21} we know that $qs$ and $sp$ still are ``good'', so we only have to stack $pr$ and $rq$. Now observe that statement 1 above is still true, since the stacked edges $pr$ and $rq$ have left faces $prs$ and $rqs$. We will show now that statement 2 too is still true. The only non-obvious part isto show that the new edge $rs$ is a Delaunay edge for $P\pr$. The right face $prq$ of the deleted edge $e$ was an internal face of the triangulation. The vertices $p$, $q$, and $r$ are all distinct from $s$. By statement 2 the edges $pr$, $rq$ and $qp$ were all original edges of $\DT$, and therefore $prq$ was one of its interior faces. So, its circumcircle $C$ was $P$-free. On the other hand, $C$ contains $s$, for $e$ failed the angle test. Then consider the circle $Cr$ passing through $s$ and tangent internally to $C$ at $r$: this circle $P\pr$-free, and indeed passes through no other site of $P\pr$ other than $r$ and $s$. This proves $rs$ is an edge of the Delaunay diagram of $P\pr$.\fig3 Therefore, when we return to step 2 statements 1 and 2 above are still true. An inductive argument shows that the above reasoning applies to all iterations of steps \Step2--\Step4. Moreover, the proof can easily be applied also to the cases where $s$ is found to lie on the outer face, or on an edge of the triangulation $\DT$. In any of those cases, the insertion of $s$ creates a star-shaped or ``fan-shaped'' region consisting of zero or more new internal faces $sp0p1, sp1p2, \ldors, sp{m-1}pm$ (where $pm$ may or may not be $p0$). Every internal face of $T\pr$ that is not one of these is an original face of $\DT$. The same arguments used above show that $spi$ is an edge of the Delaunay diagram of $P\pr$. Therefore, the only edges of $\DT$ that may have had their angle property falsified are $p0p1, p1p2, \ldots, p{m-1}pm$. These simplifications are implemented in algorithm \Alg1 below: \algorithm{\Alg1}{Incremental construction of a Delaunay triangulation.}{ \begblock \comm{The input is a Delaunay triangulation $\DT$ of $P$, and a new site $s$ not in $P$. On output, $\DT$ will have been transformed into a Delaunay triangulation $\DT\pr$ of $P\pr=P\uni\set{s}$. The set $S$ keeeps track of the ``dubious'' edges, as in algorithm \Alg0.} \step{\sno{\Step0} Locate and insert $s$ in the triangulation $\DT$, obtaining a new triangulation $T\pr$.} \step{\sno{\Step1} Let $sp0p1, sp1p2, \ldots, sp{m-1}pm$ be the interior faces of $T\pr$ incident to $s$, in counterclockwise order. Set $S\gets\set{p0p1, p1p2, \ldots, p{m-1}pm}$.} \step{\sno{\Step2} Whle $S\neq\empty$, do} \begblock \step{\sno{\Step3} Remove some edge $e=pq$ from $S$. If $e$ is an interior edge, and does not satisfy the angle property, then} \begblock \step{\sno{\Step4} Let $prqs$ be the edge quadrilateral of $e$. Swap $e$, and set $S\gets S\uni \set{pr, rq}$} \endblock \endblock \step{\nono Repeat from step 2.} \endblock } This is not all, however. In coding this algorithm, the most natural representation for the set $S$ is a stack. If in steps \Step1 and \Step4 the edges are pushed into $S$ in the given order, then the contents of $S$ at any time, from the bottom up, is a path $x0,x1, x2, \ldots, xk$ starting from the site $x0=p0$. Furthermore, by condition 1 the left face of each edge $xi x{i+1}$ is the triangle $xi x{i+1} s$. These triangles constitute a fan-shaped region with ``center'' at the site $s$. The effect of steps \Step3 and \Step4 on this region is particularly simple: at each iteration, the last triangle is either removed from the region (i.e., the top edge $e$ of $S$ is ignored), or it is replaced by two triangles ($e$ is swapped and two edges are pushed into $S$).\fig4 Finally, note that every edge $xi x{i+1}$ on the stack, except the first one, is folowed in counterclockwise order around $xi$ by the edges $xi s$ and $xi x{i-1}$. The stack $S$ is then superfluous: given its top edge $e$, we can get the one just below it by computing $e\onext\onext\sym$. \footprob{\Prob{\Sbsec{\Sec2.0}.1}}{Code algorithm \Alg1 without using the stack $S$.} The total number of iterations of steps \Step2--\Step4 is easily determined. If in step \Step0 we introduce $m$ new edges connecting the site $s$ to the rest of $T\pr$, then the initial size of $S$ is between $m-2$ and $m$. Every time $s$ gains a new incident edge in step \Step4, two other edges are pushed onto $S$. Every iteration of steps \Step2--\Step4 deletes exactly one edge from $S$. Therefore, if the final degree of $s$ in $\DT\pr$ is $d$, then the total number of iterations is between $2d-m-2$ and $2d-m$. If $P$ contains $n$ sites, the number of edges in the triangulation $\DT\pr$ is $O(n)$, and so are the degree of $s$ and the running time of algorithm \Alg1 (except possibly for step \Step0, which is discussed below). In fact, all of the $d$ edges incident to $s$ in $\DT\pr$ are Delaunay edges, and so any algorithm that updates $\DT$ to a Delaunay triangulation of $P\pr$ must add at least those edges. We conclude that algorithm \Alg1 is optimal. \xx{Analysis} \xx{Say that it can be done by dropping in one point at a time. Combine this with algorithm \Alg0 to give an $O(n)$ per point, $O(n^2)$ total time algorithm for the Delunay. Mention simplification where point are sorted before by $x$.} {\bf STOPPED HERE July 20, 1983 8:10 pm} \subsection{BEGIN JUNK} The Dealunay and Voronoi diagrams can be constructed in a rather straightforward way by the following incremental algorithm: starting with an empty diagram, we add the sites one by one, updating the diagram after each insertion. At each step, we have a Voronoi diagram $\V=\VP$ and a new data point $q\not\in P$; the goal is to construct from them the updated diagram $\V\pr=\V{P\pr}$ corresponding to the augmented set $P\pr=P\un \set{q}$. The new Voronoi diagram $\V\pr$ will obviously have one face more than the original diagram $\V$, namely $\V\pr\set{q}$. Let $\V\pr\set{p1}, \V\pr\set{p2}, \ldots, \V\pr\set{pm}$ be the faces adjacent to it in $\V\pr$, in counterclockwise order. The face $\V\pr\set{q}$ will consist of pieces cut out from the faces $\V\set{p1}, \V\set{p2},\ldots, \V\set{pm}$, plus pieces of the Voronoi edges and vertices incident to them. The only new edges in $\V\pr$ will be those on the boundary of $\V\pr\set{q}$; that is, the addition of a new site cannot create new edges between old faces. An edge of $\V$ will disappear completely only if it separates two of the $\V\set{pi}$.\figno(\Fig{10})5 Let us recast these statements in terms of Delaunay diagrams: \lemma{\Th{49}}{Any edge of $\D\pr=\D{P\uni\set{q}}$ that is not in $\D=\DP$ is incident to $q$. Any edge of $\D$ that is not in $\D\pr$ connects two sites that are neighbors of $q$ in $\D\pr$.\fig3} \mfig7 \proof{Let $e$ be an edge of $\D\pr$ with both endpoints in $P$. Consider the $P\pr$-free circle $C$ that proves $e$ is in $\D\pr$; that circle is obviously $P$-free, and proves that $e$ is in $\D$. Therefore, an edge that is in $\D\pr$ but not in $\D$ must be incident to $q$. \pp Now let $e$ be an edge of $\D$ that is not in $\D\pr$. Let $u$ and $v$ be its endpoints, and let $C$ be the $P$-free circle that proves $e$ is in $\D$. Since $e$ is not in $\D\pr$, $C$ cannot be $P\pr$-free, that is, $q$ must be inside $C$. Then consider the circle $C\pru$ that lies inside $C$, is tangent to it at $u$, and passes through $q$. This circle proves $uq$ is an edge of $\D\pr$. The proof for $v$ is analogous.} \endmfig Lemma \Th{49} shows that the relation between $\D$ and $\D\pr$ is rather simple. If $p1, p2, \ldots, pm$ are the neighbors of $q$ in $\D\pr$, then the edges $qpi$ will be the only new ones in $\D\pr$, and the edges that have to be deleted from $\D$ (if any) are connecting two of the $pi$.\fig4 A similar observation holds also for Delaunay triangulations: \lemma{\Th{49A}}{If $\DT$ is a Delaunay triangulation of $P$, then there is a Delaunay triangulation $\DT\pr$ of $P$ such that \tp (1) every edge of $\DT\pr$ that is not in $\DT$ is incident to $q$, and \tp (2) the endpoints of every edge of $\DT$ that is not in $D\pr$ are neighbors of $q$ in $\DT\pr$.} We will prove this lemma by exhibiting an algorithm that constructs $\DT\pr$ from $\DT$. \subsection{JUNK: BEGIN} In practice, we may want to take the triangulation of the Delaunay diagram one step further, by adding three dummy sites $\pi1, \pi2, \pi3$ such that all other sites are well within the triangle with those vertices. \fig4 If those dummy sites are sufficiently far away, all edges and internal faces of $\DP$ will be also edges and faces of $\D{P\uni \set{\pi1, \pi2, \pi3}}$, but {\it all} faces of the latter (including the exterior one) will be triangles. This avoids having special code for dealing with the outer face, and can even lead to a simplification of the data structure. On th other hand, this extension is somewhat incompatible with some of the algorithms we will see later on, so we will introduce it on a case-by-case basis, and always state it explicitly. \footprob{\Prob{\Sbsec{\Sec1.7}.1}}{(a) Give a data structure for triangulations of a manifold that uses less pointers per edge that the quad-edge data structure, which allows $\sym$, $\onext$, $\rot$, and $\oprev$ in constant time. Be careful to preserve uniformity between dual and primal.\bxpar {\it Ans.}: Keep only one record $\onext$ for a primal edge and its $\sym$, and represent directed edges as pairs (edge record, rot exponent). To get $\onext$ of dual edges, use the identity $e\rot\onext=e\sym\onext\sym\onext\rot$, valid in triangulations.} \subsection{END JUNK.} To simplify the algorithm, we will assume $P$ includes three dummy sites $w0, w1, w2$ such that the triangle $w0w1w2$ contains $q$ and all other ``normal'' sites of $P$. Furthermore, we will assume these dummy sites are so far away that they do not ``interfere'' with the normal ones. That is, the Delaunay diagram of $P-\set{w0, w1, w2}$ is a subgraph of $\DP$, and every internal face of the former is an internal face of the latter. In other words, $\DP$ consists of $\D{P-\set{w0, w1, w2}}$ surrounded by the triangle $w0w1w2$, with the space between the two subdivided into traingular faces.\fig4 \xx{Do we need this trick in other algorithms? if no, then remove the previous mention of it, and merge it here.} \xx{Better do without this trick. Add the following proviso to the algorithm: if $q$ is not in any interior face, connect it to all visible vertices of the outer face.} To satisfy this property, the dummy sites must lie outside the circumcircle of the every internal face of $\DP$. Unfortunately, the problem of finding three points with those properties seems as hard as computing the Delaunay itself: in particular, there seems to be no simple upper bound to the radius of those circumcircles. To get around this problem, we must resort to a trick: we must consider these points to lie at ``practically infinite distance'' in appropriate directions. More specifically, we will consider $w0$, $w1$ and $w2$ to lie at infinite distance from the origin, respectively at $0\deg$, $120\deg$ and $240\deg$ from the $x$-axis.\fig3 This requires we extend our definitions of Delaunay diagrams and triangulations to allow for such ``infinitely remote'' sites. A mathematically precise definition would be too long to be worthwhile, so we will limit ourselves to a semi-intuitive interpretation. We will define a geometric concept (edge, face, circumcircle, triangulation, etc) involving dummy sites by a limiting process, where each $wi$ is replaced by a finite point that is moved towards infinity in the corresponding direction. For example, the interior of the circle passing through $w0$ and two normal sites $r, s$ (with $yr\angle BCD + \angle DAB$. \xx{The following should really be a discussion of the properties of the ``positively oriented'' predicate.} The $\incircle$ test possesses several interesting properties: \lemma{\Th{44}}{If $a$, $b$, $c$, $d$ are any four non-cocircular points in the plane, then transposing any adjacent pair in the predicate $\incircle(a,b,c,d)$ will change the value of the predicate from true to false, or vice versa.} \proof{This is obvious from theorem \Th{43} and the properties of determinants.} In particular, the boolean sequence $\incircle(a,b,c,d)$, $\incircle(b,c,d,a)$, $\incircle(c,d,a,b)$, $\incircle(d,a,b,c)$ is either T(rue), F(alse), T, F, or F, T, F, T. More generally, permuting the arguments of $\incircle(a,b,c,d)$ will either preserve or reverse its value, depending on whether the permutation has even or odd parity. However, the predicate $\incircle$ is always false if the four points are cocircular, independently of their order. By theorem \Th{15}, the first one is a Delaunay triangulation if and only if the circles $abc$ and $cda$ are both $P$-free, that is, $\incircle(a,b,c,d)$ and $\incircle(c,d,a,b)$ are both false. From the properties of $\incircle$ we know these two are equivalent, and also they are equivalent to $\outcircle is not inside the circle $abc$, and $b$ is not inside the circle $cda$. Now consider the arcs subtended by the internal angles $\hat a, \hat b, \hat c, \hat d$ of $Q$ on the circle $abc$. Its is clear that $d$ will be on or outside that circle if and only if the arcs subtended by $\hat a$ and $\hat c$ add to $360\deg$ or more, that is, $\hat a+\hat c \geq 180\deg$.\fig3 Since the internal angles of any quadrilateral add up to $360\deg$, this condition is equivalent to $\hat b+\hat d \leq 180\deg$. By symmetry, the {\it second} diagram above is a Delaunay triangulation when $\hat b+\hat d \geq 180\deg$, or equivalently when $\hat a+\hat c \leq 180\deg$. In the limiting case when $\hat a+\hat c = 180\deg=\hat b+\hat d$, all four points lie on the same circle, and both triangulations are Delaunay. We conclude that in either Delaunay triangulation of $P$, the diagonal edge $pq$ used in it has the property that the internal angles $\hat p$ and $\hat q$ of $Q$ add to at least $180\deg$, or equivalently only that the other two angles $\hat r$ and $\hat s$ add to at most $180\deg$. If $prq$ and $qsp$ are the vertices (in counterclockwise order) of two adjacent interior faces of a triangulation, we say that $p,r, q$, and $s$ (in that order) are the vertices of the {\it edge quadrilateral} corresponding to $pq$.\fig3 \lemma{\Th{20}}{Let $e=pq$ be an edge of a triangulation with edge quadrilateral $prqs$. The following affirmations are all equivalent: \tp 1. $\hat p+\hat q \geq 180\deg$; \tp 2. $\hat s+\hat r \leq 180\deg$; \tp 3. $r$ is not inside the circle $pqs$; \tp 4. $s$ is not inside the circle $prq$; \tp 5. $\hat p \geq 180$, or $q$ is inside the circle $spr$; \tp 6. $\hat q \geq 180$, or $p$ is inside the circle $rqs$. \tp 7. There is a circle through $p$ and $q$ such that neither $r$ nor $s$ lies inside it. \tp 8. There is no circle through $r$ and $s$ such that both $p$ and $q$ lie outside it.} \proof{ \pp Now assume $\incircle(a,b,c,d)$, and consider the circle $C\pr$ tangent internally to $C$ at $b$ and passing through $d$. This circle touches $C$ only at $b$, and therefore $a$ and $c$ lie outside it, proving condition 4.\fig3 \pp Conversely, assume there a circle $C\pr$ through $b$ and $d$ such that $a$ and $c$ are both outside it.???} Let $P$ consist of four sites $a,b,c,d$, defining in this order the vertices of a convex quadrilateral $Q$. This set admits of only two triangulations, consisting of the exterior edges $ab$, $bc$, $cd$, and $da$, and one of the two diagonals $ac$ or $bd$:\fig3 From the properties of $\incircle$, we know that $$\incircle(a,b,c,d)=\outcircle(b,c,d,a)=\incircle(c,d,a,b)=\outcircle(d,a,b,c).$$ Since $a,b,c,d$ are listed in counterclockwise order around $Q$, the circles $abc$, $bcd$, $cda$, and $dab$ are all counterclockwise oriented. So, all four tests above have their ``natural'' interpretations. That is, $\incircle(a,b,c,d)$ is true if and only if $d$ is interior to the circle $abc$, and so forth. Now, if $\incircle(a,b,c,d)$ is false, the circle $abc$ is $P$-free; by the identities above, the same will be true of the circle $cda$, and the triangulation using the diagonal $bd$ will be a Delaunay one. Similarly, if the circle $bcd$ is $P$-free, the same will be true of the circle $dab$, and the triangulation using $ac$ will be Delaunay. In the limiting case where all four points are cocircular, the four circles coincide and are $P$-free, so either diagonal will give a Delaunay triangulation. Now consider the internal angles $\hat a, \hat b, \hat c,\hatd$ of the quadrilateral $Q$. By lemma \Th{20C}, $\incircle (a,b,c,d)$ is false if and only if $\hat a+\hat c \geq 180\deg$, or equivalently $\hat b+\hat d \leq 180\deg$. Conversely, $\incircle (b,c,d,a)$ is false if and only if $\hat b+\hat d \geq 180\deg$, or equivalently $\hat a+\hat c \leq 180\deg$. The discussion above then can be restated as follows: {\it a Delaunay triangulation of the vertices of $Q$ must use the diagonal of $Q$ connecting the two opposite internal angles with largest sum}. These are also the two opposite angles adding up to $180\deg$ or more. This rule works also if $Q$ is simple but not convex. Such a quadilateral has exactly one interior angle that is larger than $180\deg$; according to the rule above, a Delaunay triangulation of its vertices should use the diagonal connecting this vertex to the opposite one. Actually, in this case the only triangulation of those four sites uses {\it both} diagonals of $Q$, in addition to its four sides.\fig3 We will now extend this discussion to Delaunay triangulations of more than four vertices. \definition{\Def{12}}{Let $e=pq$ be an interior edge of a triangulation, and let $Q=prqs$ be its edge quadrilateral. We say that $e$ satisfies the {\it angle property} if it connects the opposite angles of $Q$ having largest possible sum, that is, if $\hat p+\hat q \geq \hat s+\hat r$.} \lemma{\Th{21}}{Any edge of $\DP$ not on the exterior face satisfies the strict angle property in any triangulation of $P$ that uses it.} \footprob{\Prob{\Sbsec{\Sec1.9}.3}}{Let us define a {\it $C$-subdivision} as a convex subdivision of the plane with convex outer boundary and such that all vertices of each interior face $F$ lie on a common circle $CF$. Clearly, every Delaunay diagram is a $C$-subdivison. (a) Exhibit a $C$-subdivision that is not a Delaunay diagram. (b) Write an algorithm that tests whether a quad-edge data structure represents a $C$-subdivision. (c) Extend the angle property to $C$-subdivisions, as follows: we say that an edge $e=pq$ of a $C$-subdivision, with left and right faces $F$ and $G$, satisfies the strict angle property if the internal angles at $p$ and $q$ of the polygon $F\uni G$ add up to more than $180\deg$. Prove that this is the same as saying that no vertices of $F$ lie on or inside $CG$, or equivalently that no vertices of $G$ lie on or inside $CF$. (d) Prove that a $C$-subdivision is a Delaunay diagram if and only if every edge in it satisfies the strict angle property. (e) Write an algorithm that tests whether a $C$-subdivision a Delaunay diagram.} \lemma{\Th{20D}}{Any edge $e$ of an arbitrary Delaunay triangulation of $P$ that does not satisfy the angle property cannot be an edge fails the angle As in the introdutory discussion, properties 4 and 5 imply that $e$ could be used in a Delaunay triangulation {\it if we considered only the four vertices $p,q,r,s$}. When all sites are considered, however, there may exist {\it no} Delaunay triangulation containing $e$:\fig3 \lemma{\Th{19}}{A triangulation $T$ of $P$ is a Delaunay triangulation if and only if every interior edge of $T$ has the angle property.} \proof{Let us assume $S$ is a Delaunay triangulation, and $Q=prqs$ is any of its edge quadrilaterals. By lemma \Th{15}, there is a $P$-free circle $C$ circumscribed around the face $prq$. Let $o$ be any point of $pq$; since $o$ is interior to $C$ and $s$ is not, the (closed) segement $os$ must intersect the boundary of $C$ at some point $s\pr$. It is clear that $s\pr$ will be separated from $r$ by the line of $pq$.\fig3 The arcs subtended on $C$ by the inscribed angles $\angle s\pr pr$ and $\angle rqs\pr$ add to $360\deg$, so the angles themselves add to $180\deg$. Since $s\pr$ lies inside (or on the boundary of) the triangle $qsp$, the internal angles $\hat p=\angle spr$ and $\hat q=\angle rqs$ of $Q$ are greater than or equal to $\angle s\pr pr$ and $\angle rqs\pr$, respectively. It follows that $\hat p + \hat q\geq 180\deg$. \pp In the same way, we conclude that $\angle qs\pr p + \angle prq=180\deg$, and that in $Q$ the internal angle $\hat s=\angle qsp$ is less than or equal to $\angle qs\pr p$, so $\hat r+\hat s\leq 180\deg$. \pp \xx{What about the ``if'' part?}} \lemma{\Th{20D}}{Any edge $e$ of an arbitrary Delaunay triangulation of $P$ that does not satisfy the angle property cannot be an edge fails the angle if $e$ fails the angle test, then it cannot possibly be an edge of any Delaunay triangulation: \xx{mumble some about Delaunay of four sites (angle test is equivalent to considering the Delaunay of the vertices of the edge quadrilateral)} \proof{Form what we saw in chapter \Ch3 \xx{(let's pretend so)} we know that $\hull(\lambda(K))$ is a facet of $\hull(\lambda(P))=\H$ if and only if there is an oriented plane $\pi$ passing through all points of $\lambda(K)$, and all other points of $\lambda(P)$ lie either in the interior of $\hull(\lambda(K))$ or strictly on one particular side of $\pi$. Because of the strict concavity of the paraboloid $\Lambda$, $\hull(\lambda(K))$ cannot contain any point of $\lambda(P)$ other than those in $\lambda(K)$, and all of the latter are vertices of $\hull(\lambda(K))$. So, the points in $\lambda(K)$ are the vertices of a facet of $\H$ if and only if there is an oriented plane $\pi$ passing through all points of $\lambda(K)$, and all other points of $\lambda(P)$ lie on one particular side of $\pi$. Now, from lemmas \Th{13}, \Th{16}, and \Th{17} it follows that $\DP K$ is nonempty if and only if there is a plane $\pi$ passing through the points $\lambda(K)$ and strictly below the other points of $\lambda(P)$. Th theorem then folows.} In other words, the Delaunay diagram of a set $P$ is isomorphic to the ``underside'' of the three-dimensional convex hull of $\lambda(P)$! In fact, every edge and face of the Delaunay is the projection on the $(x, y)$ plane of a edge or face of that hull that is visible from below. \par\vfill\eject\end