# Consistent Digital Line Segments

- 285 Downloads
- 4 Citations

## Abstract

We introduce a novel and general approach for digitalization of line segments in the plane that satisfies a set of axioms naturally arising from Euclidean axioms. In particular, we show how to derive such a system of digital segments from any total order on the integers. As a consequence, using a well-chosen total order, we manage to define a system of digital segments such that all digital segments are, in Hausdorff metric, optimally close to their corresponding Euclidean segments, thus giving an explicit construction that resolves the main question of Chun et al. (Discrete Comput. Geom. 42(3):359–378, 2009).

## Keywords

Digitalization Plane Integer grid## 1 Introduction

One of the most fundamental challenges in digital geometry is to define a “good” digital representation of a geometric object. Of course, the meaning of the word “good” here heavily depends on particular conditions we may impose. Looking at the problem of digitalization in the plane, the goal is to find a set of points on the integer grid ℤ^{2} that approximates well a given object. The topology of the grid ℤ^{2} is commonly defined by the graph whose vertices are all the points of the grid, and each point is connected by an edge to each of the four points that are either horizontally or vertically adjacent to it.

Knowing that a straight line segment is one of the most basic geometric objects and a building block for many other objects, defining its digitalization in a satisfying manner is vital. Hence, it is no wonder that this has been a hot scientific topic in the last few decades, see [4] for a recent survey and [2, 3, 6] for related work, dealing with the problem of representing objects in digital geometry without causing topological and combinatorial inconsistencies.

*p*and

*q*in the grid ℤ

^{2}we want to define the digital line segment

*S*(

*p*,

*q*) connecting them, that is, {

*p*,

*q*}⊆

*S*(

*p*,

*q*)⊆ℤ

^{2}. Chun et al. in [1] put forward the following four axioms that arise naturally from properties of line segments in Euclidean geometry.

- (S1)
*Grid path property*: For all*p*,*q*∈ℤ^{2},*S*(*p*,*q*) is the vertex set of a path from*p*to*q*in the grid graph. - (S2)
*Symmetry property*: For all*p*,*q*∈ℤ^{2}, we have*S*(*p*,*q*)=*S*(*q*,*p*). - (S3)
*Subsegment property*: For all*p*,*q*∈ℤ^{2}and every*r*∈*S*(*p*,*q*), we have*S*(*p*,*r*)⊆*S*(*p*,*q*). - (S4)
*Prolongation property*: For all*p*,*q*∈ℤ^{2}, there exists*r*∈ℤ^{2}, such that*r*∉*S*(*p*,*q*) and*S*(*p*,*q*)⊆*S*(*p*,*r*).

*p*=(

*p*

_{ x },

*p*

_{ y }) and

*q*=(

*q*

_{ x },

*q*

_{ y }), where

*p*

_{ x }≤

*q*

_{ x }and 0≤

*q*

_{ y }−

*p*

_{ y }<

*q*

_{ x }−

*p*

_{ x }, is \(\{(x, \lfloor (x-p_{x})\frac{q_{y}-p_{y}}{q_{x}-p_{x}}+p_{y}+0.5 \rfloor): p_{x}\leq x \leq q_{x} \}\), see [4]. This does not satisfy (S1), but it could be easily fixed by a slight modification of the definition. Still, it also does not satisfy (S3), for example, for

*p*=(0,0),

*r*=(1,0),

*q*=(4,1), the digital subsegment from

*r*to

*q*is not contained in the digital segment from

*p*to

*q*, see Fig. 1.

Even though the set of axioms (S1)–(S4) seems rather natural, there are still some fairly exotic examples of digital segment systems that satisfy all four of them. For example, let us fix a double spiral \(\mathcal{D}\) centered at an arbitrary point of ℤ^{2}, traversing all the points of ℤ^{2}. As it is a spanning path of the grid graph, we can set *S*(*p*,*q*) to be the path between *p* and *q* on \(\mathcal{D}\), for every *p*,*q*∈ℤ^{2}. It is easy to verify that this system satisfies axioms (S1)–(S4).

- (S5)
*Monotonicity property*: If both*p*,*q*∈ℤ^{2}lie on a line that is either horizontal or vertical, then the whole segment*S*(*p*,*q*) belongs to this line.

Here, we have phrased the monotonicity axiom differently, but still, the system of axioms (S1)–(S5) remains equivalent to the one given in [1]. The monotonicity axiom in [1] is given in the following form: “(R5) For any *r*∈*S*(*pq*), \(|\overline{pr}| \leq|\overline{pq}|\), where \(|\overline{ab}|\) is the length of the Euclidean segment from *a* to *b*”. Now (S5) follows immediately from (S1), (S3) and (R5), whereas (S5) together with (S1) and (S3) readily implies (R5).

*consistent digital line segments system (CDS)*. It is straightforward to verify that every CDS also satisfies the following three conditions.

- (C1)
If the slope of the Euclidean line going through

*p*and*q*is non-negative, then the slope of the Euclidean line going through any two points of*S*(*p*,*q*) is non-negative. The same holds for non-positive slopes. - (C2)
For all

*p*,*q*∈ℤ^{2}, the grid-parallel box spanned by points*p*and*q*contains*S*(*p*,*q*). - (C3)
If the intersection of two digital segments contains two points

*p*,*q*∈ℤ^{2}, then their intersection also contains the whole digital segment*S*(*p*,*q*).

We give a simple example of a CDS, where the segments follow the boundary of the grid-parallel box spanned by the endpoints. Let *p*,*q*∈ℤ^{2} be two points with coordinates *p*=(*p* _{ x },*p* _{ y }) and *q*=(*q* _{ x },*q* _{ y }). If *p* _{ y }≤*q* _{ y }, we define *S*(*p*,*q*)=*S*(*q*,*p*)={(*x*,*p* _{ y }):min{*p* _{ x },*q* _{ x }}≤*x*≤max{*p* _{ x },*q* _{ x }}}∪{(*q* _{ x },*y*):*p* _{ y }≤*y*≤*q* _{ y }}}. If *p* _{ y }>*q* _{ y }, we swap the points *p* and *q*, and define the segment as in the previous case.

It can be easily verified that this way we defined a CDS, but the digital segments in this system visually still do not resemble well the Euclidean segments.

*v*,

*w*∈ℝ

^{2}and

*A*⊆ℝ

^{2}, let

*d*(

*v*,

*w*)=|

*v*−

*w*| and

*d*(

*v*,

*A*)=inf

_{ a∈A }

*d*(

*v*,

*a*) denote the usual Euclidean distances between two points, and between a point and a set. For two sets

*A*and

*B*, we denote their Hausdorff distance by

*H*(

*A*,

*B*), so

- (H)
*Small Hausdorff distance property*: For every*p*,*q*∈ℤ^{2}, we have \(H(\overline{pq},S(p,q))\allowbreak = O(\log d(p,q))\).

Note that in the CDS example we gave, the Hausdorff distance between a Euclidean segment of length *d* and its digitalization can be as large as *d*/2.

While this question was not resolved in [1], a clever construction of a system of digital rays *emanating from the origin of* ℤ^{2} that satisfy (S1)–(S5) and (H) was presented. Moreover, it was shown using Schmidt’s theorem [5] that already for rays emanating from the origin, the log-bound imposed in condition (H) is the best bound we can hope for, directly implying the following theorem.

### Theorem 1

(Chun et al. [1])

*There exists a constant* *c*>0, *such that for any CDS and any* *ℓ*>0, *there exist* *p*,*q*∈ℤ^{2} *with* *d*(*p*,*q*)>*ℓ*, *such that* \(H(\overline{pq},S(p,q))> c\log d(p,q)\).

In this paper, we introduce a novel and general approach for the construction of a CDS. Namely, for any total order ≺ on ℤ, we show how to derive a CDS from ≺. (By total order we always mean a strict total order.) This process is described in Sect. 2. As a consequence, in Sect. 3, we manage to define a CDS that satisfies (H), deriving it from a specially chosen order on ℤ, and thus giving an explicit construction that resolves the main question of [1].

### Theorem 2

*There is a CDS that satisfies condition* (*H*).

Note that Theorem 1 ensures that such a CDS is optimal up to a constant factor in terms of the Hausdorff distance from the Euclidean segments. In Sect. 4 we make a step toward a characterization of CDSes, demonstrating their natural connection to total orders on ℤ, while in Sect. 5 we make use of the digital line segment definition to introduce digital lines. Finally, in Sect. 6 we discuss prospects of using a similar approach to define a CDS in higher dimensions.

## 2 Digital Line Segments Derived from a Total Order on ℤ

Let ≺ be a total order on ℤ. We are going to define a CDS \(\mathcal{S}_{\prec}\), deriving it from ≺.

Let *p*,*q*∈ℤ^{2}, *p*=(*p* _{ x },*p* _{ y }) and *q*=(*q* _{ x },*q* _{ y }). If *p* _{ x }>*q* _{ x }, we swap *p* and *q*. Hence, from now on we may assume that *p* _{ x }≤*q* _{ x }.

If *p* _{ y }≤*q* _{ y }, then *S* _{≺}(*p*,*q*) is defined as follows. We start at the point *p*=(*p* _{ x },*p* _{ y }) and we repeatedly go either up or to the right, visiting the points from ℤ^{2}, until we reach *q*. Note that the sum of the coordinates *x*+*y* increases by 1 in each step. In total we have to make *q* _{ x }+*q* _{ y }−*p* _{ x }−*p* _{ y } steps and in exactly *q* _{ y }−*p* _{ y } of them we have to go up. The decision whether to go up or to the right is made as follows: if we are at a point (*x*,*y*) for which *x*+*y* is among the *q* _{ y }−*p* _{ y } greatest elements of the interval [*p* _{ x }+*p* _{ y },*q* _{ x }+*q* _{ y }−1] according to ≺, we go up, otherwise we go to the right. We will refer to this interval as the *segment interval*.

If *p* _{ y }>*q* _{ y }, that is, if *p* is the top-left and *q* the bottom-right corner of the grid-parallel box spanned by *p* and *q*, then we define *S* _{≺}(*p*,*q*) as the mirror reflection of *S* _{≺}((−*q* _{ x },*q* _{ y }),(−*p* _{ x },*p* _{ y })) over the *y*-axis.

### Example

*p*=(0,0) and

*q*=(2,2). Their segment interval consists of four numbers, 0,1,2,3. If ≺ is the natural order on ℤ, then the two greatest elements of the segment interval are 2 and 3. Since 0+0 is not one of these, at (0,0) we go right, to (1,0). At (1,0) we again go to the right, to (2,0), from there to (2,1) (since 2+0 is one of the greater elements) and finally to (2,2), see Fig. 2. In fact, it can be easily seen that using the natural order on ℤ we get the CDS mentioned in Sect. 1, the one that always follows the boundary of the box spanned by the endpoints.

### Theorem 3

\(\mathcal{S}_{\prec}\), *defined as above*, *is a CDS*.

### Proof

We will verify that \(\mathcal{S}_{\prec}\) satisfies the axioms (S1)–(S5).

(S1) The condition (S1) follows directly from the definition of \(\mathcal{S}_{\prec}\).

(S2) Let *p*,*q* be two points from ℤ^{2}. If the first coordinates of *p* and *q* are different, then condition (S2) follows directly. Otherwise, *p* and *q* belong to the same vertical line, and from the construction we see that both *S* _{≺}(*p*,*q*) and *S* _{≺}(*q*,*p*) consist of all the points on that line between *p* and *q*.

(S3) For a contradiction, assume that there are points *p*=(*p* _{ x },*p* _{ y }), *q*=(*q* _{ x },*q* _{ y }) and *r*=(*r* _{ x },*r* _{ y }), with *r*∈*S* _{≺}(*p*,*q*), such that \(S_{\prec}(p,r) \not\subseteq S_{\prec}(p,q)\). W.l.o.g. we may assume that \(\overline{pq}\) has a non-negative slope.

*Case 1.*

*p*

_{ x }≤

*q*

_{ x }and

*p*

_{ y }≤

*q*

_{ y }. We also have

*p*

_{ x }≤

*r*

_{ x }and

*p*

_{ y }≤

*r*

_{ y }, and going on each of the segments

*S*

_{≺}(

*p*,

*r*) and

*S*

_{≺}(

*p*,

*q*) point-by-point starting from

*p*, we move either up or right. By assumption, these two segments separate at some point (

*a*,

*b*) and then meet again, for the first time after this separation, at some other point (

*c*,

*d*), see Fig. 3. One of the segments goes up at (

*a*,

*b*) and enters (

*c*,

*d*) horizontally coming from the left, which implies that

*a*+

*b*is among the greater numbers of the segment interval of this segment, while

*c*+

*d*−1 is not, thus

*c*+

*d*−1≺

*a*+

*b*. But the other segment goes horizontally at (

*a*,

*b*) and enters (

*c*,

*d*) vertically coming from below, which similarly implies

*a*+

*b*≺

*c*+

*d*−1, a contradiction.

*Case 2.* *q* _{ x }≤*p* _{ x } and *q* _{ y }≤*p* _{ y }. We also have *q* _{ x }≤*r* _{ x } and *q* _{ y }≤*r* _{ y }. By assumption, the two segments starting at *q* and *r*, *S* _{≺}(*q*,*p*) and *S* _{≺}(*r*,*p*), separate at some point (*a*,*b*) and then meet again, for the first time after this separation, at some other point (*c*,*d*). Using the same argument as before, we get a contradiction. Hence, (S3) holds.

(S4) To show that condition (S4) holds, consider the segment from *p*=(*p* _{ x },*p* _{ y }) to *q*=(*q* _{ x },*q* _{ y }). W.l.o.g. we can assume that *p* _{ x }≤*q* _{ x } and *p* _{ y }≤*q* _{ y }. We distinguish two cases.

*Case 1.* If *q* _{ x }+*q* _{ y } is among the *q* _{ y }−*p* _{ y }+1 greatest numbers of [*p* _{ x }+*p* _{ y },*q* _{ x }+*q* _{ y }] according to ≺, then we can prolong the segment going one step vertically up, that is, the segment *S* _{≺}((*p* _{ x },*p* _{ y }),(*q* _{ x },*q* _{ y }+1)) contains the segment *S* _{≺}((*p* _{ x },*p* _{ y }),(*q* _{ x },*q* _{ y })) as a subsegment.

*Case 2.* If, on the other hand, *q* _{ x }+*q* _{ y } is not among the *q* _{ y }−*p* _{ y } greatest numbers of [*p* _{ x }+*p* _{ y },*q* _{ x }+*q* _{ y }], we can prolong the segment horizontally to the right, that is, *S* _{≺}((*p* _{ x },*p* _{ y }),(*q* _{ x },*q* _{ y }))⊂*S* _{≺}((*p* _{ x },*p* _{ y }),(*q* _{ x }+1,*q* _{ y })).

Note that if *q* _{ x }+*q* _{ y } is exactly the (*q* _{ y }−*p* _{ y }+1)th number in [*p* _{ x }+*p* _{ y },*q* _{ x }+*q* _{ y }], then the conclusions of both cases are true, and indeed the rays emanating from (*p* _{ x },*p* _{ y }) split at (*q* _{ x },*q* _{ y }).

(S5) The condition (S5) follows directly from the definition of \(\mathcal{S}_{\prec}\). □

Apparently, for segments with non-negative slope, in the definition of *S* _{≺}(*p*,*q*), only the sum of the coordinates of the points plays a role, so if we translate *p* and *q* by a vector (*t*,−*t*), for any integer *t*, the digital line segment will look the same.

### Observation 4

Let *t*∈ℤ be an integer, and let *p* and *q* be two points determining a line with non-negative slope. Then *S* _{≺}(*p*+(*t*,−*t*),*q*+(*t*,−*t*))=*S* _{≺}(*p*,*q*)+(*t*,−*t*)={(*x*+*t*,*y*−*t*)∈ℤ^{2}:(*x*,*y*)∈*S* _{≺}(*p*,*q*)}.

It might be desirable to have translation invariance in any direction. But if we insist on that and impose the condition that *S* _{≺}(*p*+(*a*,*b*),*q*+(*a*,*b*))=*S* _{≺}(*p*,*q*)+(*a*,*b*) for any vector (*a*,*b*)∈*Z* ^{2}, the problem becomes trivial. It is easy to see that the CDS defined in Sect. 1 following the grid-parallel box, and its counterpart—the CDS we get by always following the box on the other side, are the only solutions that are translation invariant in every direction.

## 3 Digital Segments with Small Hausdorff Distance to Euclidean Segments

*k*≠0 and

*l*≥2, let |

*k*|

_{ l }denote the number of times

*k*is divisible by

*l*, that is,

_{ l }to be infinity, that is, |0|

_{ l }is defined to be greater than |

*k*|

_{ l }for any

*k*≠0. A total order on ℤ is defined as follows. Let

*a*≺

*b*if and only if there exists a non-negative integer

*i*such that |

*a*−

*i*|

_{2}<|

*b*−

*i*|

_{2}, and for all

*j*∈{0,…,

*i*−1} we have |

*a*−

*j*|

_{2}=|

*b*−

*j*|

_{2}. In plain words, for two integers

*a*and

*b*, we say that the one that contains a higher power of 2 is greater under ≺. In case of a tie, we repeatedly subtract 1 from both

*a*and

*b*, until at some point one of them contains a higher power of 2 than the other. Thus, for example, −1≺−5≺3≺−3≺5≺1≺−2≺6≺−6≺2≺−4≺4≺0.

For positive integers, this is equivalent to ordering them based on the least significant difference in the binary representation. Note that if we take the elements of an interval of the form (−2^{ n },2^{ n }) in ≺-decreasing order and we apply the function 0.5−*x*2^{−n−1} to them, then we get the first few elements of the Van der Corput sequence [7].

At first sight it may be surprising to observe that all the segments emanating from the origin in our construction coincide with the ones given in the construction of digital rays in [1]. However, it is not a coincidence, as the construction from [1], though different in nature, also relies on the same total order on the integers.

Recall that for points *v*,*w*∈ℝ^{2} and *A*⊆ℝ^{2}, *d*(*v*,*w*)=|*v*−*w*| and *d*(*v*,*A*)=inf_{ a∈A } *d*(*v*,*a*) denote the usual Euclidean distances between points and between a point and a set, respectively. For *p*,*q*,*r*,*s*∈ℤ^{2}, by \(\overline {pqrs}\) we denote the union of the Euclidean line segments from *p* to *q*, from *q* to *r*, and from *r* to *s*.

### Observation 5

For any *p*,*q*∈ℤ^{2}, \(H(S_{\prec}(p,q),\overline{pq}) =\max\{d(r,\overline{pq}) : r \in S_{\prec}(p,q) \}\).

We proceed by proving three statements that we will ultimately use to prove Theorem 2.

Moving from a digital segment to one of its subsegments, the Hausdorff distance to the corresponding Euclidean segment may increase. But the following lemma shows that the distance can at most double.

### Lemma 6

*If*

*p*,

*q*∈ℤ

^{2}

*and*

*r*,

*s*∈

*S*

_{≺}(

*p*,

*q*).

*Then*

### Proof

We know that \(d(r,\overline{pq}) \leq H(\overline {pq},S_{\prec}(p,q)) =:h\) and \(d(s,\overline{pq}) \leq h\), therefore \(H(\overline {prsq},\overline{pq})\leq h\). Hence, for all \(v \in\overline{pq}\), \(d(v,\overline{prsq})\leq h\). Let *t*∈*S* _{≺}(*r*,*s*)⊆*S* _{≺}(*p*,*q*) and \(v \in \overline{pq}\) be such that \(d(t,v) = d(t,\overline{pq}) \leq h\). Using the triangle inequality we conclude \(d(t,\overline{prsq}) \leq d(t,v) +d(v,\overline{prsq}) \leq2h\). Because of (C2), we have \(d(t,\overline {rs}) =d(t,\overline{prsq}) \leq2h\), and therefore \(H(S_{\prec}(r,s),\overline{rs}) \leq2h\). □

### Lemma 7

*Let*

*p*,

*q*,

*r*,

*r*′∈ℤ

^{2},

*such that*\(r_{x} - p_{x} =q_{x} - r'_{x} + \varepsilon\), \(r_{y} - p_{y} = q_{y} - r_{y}' - \varepsilon\),

*with*

*ε*∈{0,1,−1}, \(r'_{x} = r_{x}\)

*and*\(r'_{y} = r_{y}+1\) (

*see Fig*. 6).

*Then*\(H(\overline{pq},\overline{prr'q}) \leq c = \sqrt{5}/2\).

### Proof

*p*=(0,0,

*q*

_{ x }≥0, and

*q*

_{ y }≥0. We have

*r*

_{ x }−

*ε*=

*q*

_{ x }and 2

*r*

_{ y }+

*ε*+1=

*q*

_{ y }. So we get Similarly,

*ξ*:=

*q*

_{ x }/

*q*

_{ y }, we observe that no matter whether

*ε*=0,

*ε*=1, or

*ε*=−1 as the function

*ξ*=2. □

The following lemma is a statement about the order ≺ and will be the key ingredient of the proof of Theorem 2.

### Lemma 8

*Let*{

*x*∈ℤ|

*A*≤

*x*<

*B*}

*be an interval of integers with the following properties*:

- (i)
*Its number of elements is**B*−*A*=2^{ k+1}−1,*for some number**k*, - (ii)
|(

*A*+*B*−1)/2|_{2}≥*k*,*and for any other**A*≤*x*<*B*,*x*≠(*A*+*B*−1)/2,*we have*|*x*|_{2}<*k*.

*Let*\(x_{1} \prec x_{2} \prec\cdots\prec x_{2^{k+1} - 1}\)

*be the elements of the interval sorted in increasing order according to*≺.

*Then elements from the left half and elements from the right half of the interval alternate*,

*that is*,

*if*

*x*

_{ i }<(

*A*+

*B*−1)/2

*for some*1≤

*i*<2

^{ k+1}−1,

*then*

*x*

_{ i+1}≥(

*A*+

*B*−1)/2.

### Proof

Define *M*:=(*A*+*B*−1)/2. Assume for a contradiction that there is an 1≤*i*<2^{ k+1}−1 such that both *x* _{ i }<*M* and *x* _{ i+1}<*M*. First we look at the case that |*A*−1|_{2}<|*M*|_{2}. Then, on one hand, *x* _{ i }≺*x* _{ i }+2^{ k }, because |*x* _{ i }−*j*|_{2}=|*x* _{ i }+2^{ k }−*j*|_{2} for all 0≤*j*≤*x* _{ i }−*A* and |*x* _{ i }−*j*|_{2}=|*A*−1|_{2}<|*M*|_{2}=|*x* _{ i }+2^{ k }−*j*|_{2} for *j*=*x* _{ i }−(*A*−1). (We use the simple observation that if |*x*|_{2}<*k*, then |*x*+2^{ k }|_{2}=|*x*|_{2}.) But, on the other hand, *x* _{ i }+2^{ k }≺*x* _{ i+1}, because there is a 0≤*j* _{0}≤*x* _{ i }−*A* such that |*x* _{ i }+2^{ k }−*j* _{0}|_{2}=|*x* _{ i }−*j* _{0}|_{2}<|*x* _{ i+1}−*j* _{0}|_{2} and |*x* _{ i }+2^{ k }−*j*|_{2}=|*x* _{ i }−*j*|_{2}=|*x* _{ i+1}−*j*|_{2} for all 0≤*j*<*j* _{0} (if the first *j* _{0} such that |*x* _{ i }−*j* _{0}|_{2} and |*x* _{ i+1}−*j* _{0}|_{2} differ were *j* _{0}=*x* _{ i }−*A*+1, then *x* _{ i+1}≺*x* _{ i }, because |*A*−1|_{2}≥*k*). So *x* _{ i }≺*x* _{ i }+2^{ k }≺*x* _{ i+1}, a contradiction.

In the case |*A*−1|_{2}>|*M*|_{2}, we can argue similarly that *x* _{ i }≺*x* _{ i+1}+2^{ k }≺*x* _{ i+1}. (Note that equality never occurs, as |*A*−1|_{2}=|*M*|_{2} implies |(*A*−1+*M*)/2|_{2}≥|*M*|_{2}≥*k*, but |(*A*−1+*M*)/2|_{2}<*k* by assumption.)

We have shown that if *x* _{ i }<*M*, then *x* _{ i+1}≥*M*. Similarly, *x* _{ i }>*M* implies *x* _{ i+1}≤*M*. This follows directly by the pigeon-hole principle: Every *x* _{ i }<*M* has a unique successor *x* _{ i+1}>*M* and exactly half of the elements of [*A*,*B*)∖{*M*} are smaller than *M*, so there cannot be any *x* _{ j }>*M* whose successor is also greater than *M*. □

Now we are ready to prove our main result, Theorem 2, by showing that the CDS \(\mathcal{S}_{\prec}\) satisfies the condition (H).

### Proof of Theorem 2

*p*,

*q*∈ℤ

^{2}. We may assume that

*p*

_{ x }<

*q*

_{ x }and

*p*

_{ y }<

*q*

_{ y }. We are going to prove that \(H(\overline {pq},S_{\prec}(p,q))\leq2c\log(q_{x}+q_{y}-p_{x}-p_{y}) \) for \(c=\sqrt{5}/2\). Let

*r*∈

*S*

_{≺}(

*p*,

*q*) be the point with the property that

*r*

_{ x }+

*r*

_{ y }is the greatest element of the segment interval, that is,

*r*

_{ x }+

*r*

_{ y }≻

*s*for all

*s*∈[

*p*

_{ x }+

*p*

_{ y },

*q*

_{ x }+

*q*

_{ y }),

*s*≠

*r*

_{ x }+

*r*

_{ y }, see Fig. 7 for an example. Now let

*s*′ be the second greatest element of the segment interval according to ≺. Define

*k*:=|

*s*′|

_{2}+1.

We can extend the segment *S* _{≺}(*p*,*q*) over both endpoints, moving both *p* and *q* such that |*p* _{ x }+*p* _{ y }−1|_{2}≥*k* and |*q* _{ x }+*q* _{ y }|_{2}≥*k*, that is, we extend the segment as far as we can, so that *k*, defined as above, remains unchanged. From Lemma 6 we find that by this extension we decreased the Hausdorff distance by at most a factor of 2. Now the segment interval contains exactly 2^{ k+1}−1 elements and *r* _{ x }+*r* _{ y } is the element in the very middle. We call such a segment *normalized*.

We are going to proceed by induction on *k* to prove that for all normalized digital line segments *S* _{≺}(*p*,*q*), we have \(H(\overline {pq},S_{\prec}(p,q)) \leq ck \) with \(c = \sqrt{5}/2\). This will prove the theorem, as *k*+1=log(*q* _{ x }+*q* _{ y }−*p* _{ x }−*p* _{ y }+1), and then the distance of the unnormalized original segment (we started from) is at most 2*ck*=2*c*(log(*q* _{ x }+*q* _{ y }−*p* _{ x }−*p* _{ y }+1)−1)≤2*c*log(*q* _{ x }+*q* _{ y }−*p* _{ x }−*p* _{ y }).

In the base case *k*=1, the segment interval consists of 3 numbers, so *S* _{≺}(*p*,*q*) is a path of length 3 and by checking all possibilities we see that \(H(\overline{pq},S_{\prec}(p,q)) < c\).

If *k*>1, the idea is to split the segment at *r* into two subsegments that are similar in some sense and apply induction. Let *r*′=(*r* _{ x },*r* _{ y }+1) be the point that comes after *r* in the segment *S* _{≺}(*p*,*q*). (We know that we go up at *r*, because we go up at least once and *r* _{ x }+*r* _{ y } is the greatest element of the segment interval.) Consider the subsegments *S* _{≺}(*p*,*r*) and *S* _{≺}(*r*′,*q*) and partition the segment interval accordingly. The key observation is that picking the elements of the interval according to ≺ starting with the greatest, we first get *r*, and then alternately an element of the left and the right subsegment interval. This is shown in Lemma 8, setting *A*=*p* _{ x }+*p* _{ y }, *B*=*q* _{ x }+*q* _{ y }. Therefore, up to a difference of at most one, half of the *q* _{ y }−*p* _{ y }−1 greatest elements (after *r* _{ x }+*r* _{ y }) belong to [*p* _{ x }+*p* _{ y },*r* _{ x }+*r* _{ y }) and half of them to [*r* _{ x }+*r* _{ y }+1,*q* _{ x }+*q* _{ y }). This implies that *p*,*q*,*r*,*r*′ meet the conditions of Lemma 7, leading to \(H(\overline{pq},\overline{prr'q}) \leq c\). By the induction hypothesis we have \(H(\overline{pr},S_{\prec}(p,r)) \leq c(k-1)\) and \(H(\overline{r'q},S_{\prec}(r',q)) \leq c(k-1)\). Now \(H(\overline{prr'q},S_{\prec}(p,q)) =\max\{H(\overline{pr},S_{\prec}(p,r)),H(\overline{r'q},S_{\prec}(r',q))\} \leq c(k-1)\). Using the triangle inequality we conclude \(H(\overline{pq},S_{\prec}(p,q))\leq ck\). □

## 4 A Step Towards a Characterization of CDSes

Now we approach the same problem from a different angle, taking arbitrary CDSes and trying to find some common patterns in their structure. Knowing that condition (C1) holds for all CDSes, it is easy to verify that we can analyze the segments with non-positive and non-negative slopes separately, as they are completely independent. More precisely, the union of any CDS on segments with non-positive slopes and another CDS on segments with non-negative slopes is automatically a CDS. Having this in mind, in this section we will proceed with the analysis of only one half of a CDS, namely of segments with non-negative slope.

We will show that, in a CDS, all the segments with non-negative slope emanating from a fixed point must be derived from a total order. However, as we will show later, these orders may differ for different points.

### Theorem 9

*For any CDS and for any point* *p*=(*p* _{ x },*p* _{ y })∈ℤ^{2}, *there is a total order* ≺_{ p } *that is uniquely defined on both* (−∞,*p* _{ x }+*p* _{ y }−1] *and* [*p* _{ x }+*p* _{ y },+∞), *such that the segments with non*-*negative slope emanating from* *p* *are derived from* ≺_{ p } (*in the way described in Sect*. 2).

### Proof

We fix a CDS \(\mathcal{S}\) and a point *p*. The segments with non-negative slope with *p*=(*p* _{ x },*p* _{ y }) as their upper-right point will induce an order on the integers smaller than *p* _{ x }+*p* _{ y }, and the segments for which *p* is the lower-left endpoint will induce an order on the rest of the integers. In the following we will just look at the latter type of segments. First, we prove an auxiliary statement.

### Lemma 10

*In a CDS*, *it cannot happen that for two segments with non*-*negative slope having the same lower*-*left endpoint* *p*, *one of them goes up at* (*a*,*C*−*a*) *and the other goes right at* (*b*,*C*−*b*), *for some* *C* *and* *a*>*b*.

### Proof of Lemma 10

*a*−

*b*+1 segments between the point

*p*and each of the points on the line

*x*+

*y*=

*C*between the points (

*a*,

*C*−

*a*) and (

*b*,

*C*−

*b*). It is possible to extend all of them through their upper-right endpoints, applying (S4). Note that each of the extended segments goes through a different point on the line

*x*+

*y*=

*C*, and hence, because of condition (C3), no two of them can go through the same point on the line

*x*+

*y*=

*C*+1. But there are only

*a*−

*b*available points on the line

*x*+

*y*=

*C*+1 between the points (

*a*,

*C*−

*a*+1) and (

*b*+1,

*C*−

*b*), one less than the number of segments, a contradiction. □

Coming back to the proof of the theorem, we define the relation ≺_{ p } in the following way. Whenever there is a segment in \(\mathcal{S}\) with non-negative slope starting at *p*, going right at a point (*x*,*D*−*x*) and going up at a point (*x*′,*E*−*x*′), for some *x* and *x*′, we set *D*≺_{ p } *E*. This way we defined a relation on [*p* _{ x }+*p* _{ y },+∞), which is obviously irreflexive. To show that ≺_{ p } is a total order, it remains to prove that it is asymmetric, transitive and total.

To show asymmetry, assume for a contradiction that for some integers *D* and *E* we have both *D*≺_{ p } *E* and *E*≺_{ p } *D*. That can happen only when there are two segments with non-negative slope having *p* as their lower-left endpoint, such that on the line *x*+*y*=*D* one of them goes up, the other right, and then on *x*+*y*=*E* they both go in different direction than at *x*+*y*=*D*. But then the situation described in Lemma 10 must occur on one of the two lines, a contradiction.

Next, if *C*≺_{ p } *D* and *D*≺_{ p } *E*, then we also have *C*≺_{ p } *E* – we just take a segment starting from *p* that goes right at *C* and up at *D*, and (if necessary) extend it until it passes the line *x*+*y*=*E*. It must also go up at *E*, because of *D*≺_{ p } *E* and the asymmetry of ≺_{ p }. Hence, the relation ≺_{ p } is transitive.

It remains to prove the totality of ≺_{ p }. That is, for any pair of integers *p* _{ x }+*p* _{ y }≤*D*<*E*, either *D*≺_{ p } *E* or *E*≺_{ p } *D* holds. Consider a segment from *p* to some point *q* on the line *x*+*y*=*E*, such that this segment splits at *q*, that is, there are two extensions of the segment, one going up and another one going right. Such a segment exists since in the upper-right quadrant of *p*, the line *x*+*y*=*E*+1 contains one more point than the line *x*+*y*=*E*. If we look at all the segments between *p* and the points on *x*+*y*=*E*+1, the pigeon-hole principle ensures that two of them will contain the same point *q* on the line *x*+*y*=*E*. Now the segment *S*(*p*,*q*) crosses the line *x*+*y*=*D* at some point *q*′. Depending on whether it goes up or right at the point *q*′, either *E*≺_{ p } *D* or *D*≺_{ p } *E* holds. □

*waterline example*because of the special role of the

*x*-axis. To connect two points with a segment, we do the following. Above the

*x*-axis we go first right, then up, below the

*x*-axis we go first up, then right, and when we have to traverse the

*x*-axis, we go straight up to it, then travel on it to the right, and finally continue up, see Fig. 9. It is easy to check that this construction satisfies all five axioms.

Now, if we consider a point *p*=(*a*,*b*) below the waterline, *b*<0, the induced total order ≺_{ p } on [*a*+*b*,+∞) is *a*≺_{ p } *a*+1≺_{ p }⋯≺_{ p }(+∞)≺_{ p } *a*−1≺_{ p } *a*−2≺_{ p }⋯≺_{ p } *a*+*b*, and the order on (−∞,*a*+*b*−1] is *a*+*b*−1≺_{ p } *a*+*b*−2≺_{ p }⋯≺_{ p }−∞. If *p* is above the waterline, *b*≥0, the induced total orders are *a*−1≺_{ p } *a*−2≺_{ p }⋯≺_{ p }(−∞)≺_{ p } *a*≺_{ p } *a*+1≺_{ p }⋯≺_{ p } *a*+*b*−1 and *a*+*b*≺_{ p } *a*+*b*+1≺_{ p }⋯≺_{ p }+∞. Obviously, there is no total order on ℤ compatible with these orders for all possible choices of *p*. For example, if we choose *p*=(*a*,*b*)=(1,−1), we get 1≺_{ p }0, but if we choose *p*=(*a*,*b*)=(−1,1), we get 0≺_{ p }1.

*x*-axis in the waterline example can be fulfilled by any other monotone digital line with a positive slope; above the line go right, then up, below the line go up, then right, and whenever the line is hit, follow it until either the

*x*- or the

*y*-coordinate matches that of the final destination, see Fig. 10. Again, it is straightforward to show that this way we obtain a CDS.

A way to see that such a CDS cannot be derived from a total order is to observe that now the diagonal translation of a digital line segment does not always yield another digital line segment, that is, these examples do not satisfy the condition from Observation 4. Actually, we can prove that it suffices to add this condition to force a unifying total order on all integers.

### Theorem 11

*Let*\(\mathcal{S}\)

*be a restriction of a CDS to the set of all segments with non*-

*negative slopes*,

*such that for any*

*t*∈ℤ

*and any*

*p*,

*q*∈ℤ

^{2},

*Then there is a unique total order*≺

*on*ℤ

*such that*\(\mathcal{S} =\mathcal{S}_{\prec}\).

### Proof

*p*,

*q*∈ℤ

^{2}. By Theorem 9, the segments starting at

*p*define a unique total order ≺

_{ p }on [

*p*

_{ x }+

*p*

_{ y },∞), and similarly the segments starting at

*q*define a unique total order ≺

_{ q }on [

*q*

_{ x }+

*q*

_{ y },∞). Let us suppose that

*q*

_{ x }+

*q*

_{ y }≥

*p*

_{ x }+

*p*

_{ y }. We want to check whether these two orders agree on [

*q*

_{ x }+

*q*

_{ y },∞). Assume for a contradiction that there are integers

*q*

_{ x }+

*q*

_{ y }≤

*A*<

*B*such that there is a segment

*S*starting at

*p*going to some point

*r*, implying

*B*≺

_{ p }

*A*, and another segment

*T*starting at

*q*, implying

*A*≺

_{ q }

*B*, see Fig. 11 for an example. We translate the segment

*S*diagonally by a vector (

*t*,−

*t*) until

*q*lies on the translated segment

*S*′ from

*p*′ to

*r*′. Then the subsegment from

*q*to

*r*′ still goes up at level

*A*and to the right at level

*B*, implying

*B*≺

_{ q }

*A*, a contradiction.

Therefore, we can define a unique total order ≺ as follows. To compare two integers *A* and *B* take any point *p* with *p* _{ x }+*p* _{ y }≤*A* and define *A*≺*B* if and only if *A*≺_{ p } *B*. By the argument above, this definition is independent of the choice of *p* and the arguments in the proof of Theorem 9 carry over to ≺, showing that it is a total order. □

## 5 Digital Lines

Even though our focus is on the digitalization of line segments, the present setup can be conveniently extended to a definition of digital lines. We say that a *digital line* is the vertex set of a path infinite in both directions in the ℤ^{2} base graph, such that the digital line segment between any two points on the digital line belongs to the digital line.

In this section we restrict our attention to CDSs that are derived from a total order as described in Sect. 2. Furthermore, for simplicity, we are only going to consider lines with non-negative slope, meaning that the Euclidean segment between any two points of the line has non-negative slope (including zero and infinity).

Consider a digital line *ℓ* derived from \(\mathcal{S}_{\prec}\). We define *A* _{ ℓ }⊆ℤ to be the set of numbers *x*+*y* for which *ℓ* goes upward at (*x*,*y*) and call it the *slope set* of *ℓ*. Note that the slope set *A* _{ ℓ } is an interval in (ℤ,≺) which is unbounded in the increasing direction, i.e., if *x*∈*A* _{ ℓ }, then for any *y*≻*x* we have *y*∈*A* _{ ℓ }. This implies that there is a natural total order on the set of possible slope sets given by inclusion.

The following observation follows directly from the definition of *S* _{≺}.

### Observation 12

Every line *ℓ* can be described by its slope set *A* _{ ℓ } and a point *p* it contains. Also, given a point *p*, every ≺-interval *A* that is unbounded in the increasing direction is a valid slope set of a line through *p*, that is, there is a line *ℓ* such that *p*∈*ℓ* and *A* _{ ℓ }=*A*.

It follows directly from Theorem 3 that two lines having a point in common cannot split and then meet later. Similarly, two lines cannot meet and split without crossing. (If they did, by Observation 4 we could translate one of them diagonally to produce a contradiction with axiom (S3).)

### Observation 13

If two different lines intersect, then they either cross, having a common segment, or they have a common half-line.

### Lemma 14

*Consider two different slope sets*

*A*

*and*

*B*

*with*

*A*⊂

*B*.

*Let*

*I*=

*B*∖

*A*

*be the difference of the slope sets*.

- (1)
*If**I**is finite*,*then there are lines**l**and**s**such that**A*_{ l }=*A*,*A*_{ s }=*B**and**l**and**s**intersect in a lower*-*left halfline and there are lines**l*′,*s*′*with slope sets**A*_{ l′}=*A*,*A*_{ s′}=*B**intersecting in an upper*-*right halfline*. - (2)
*If**I**is infinite and bounded in one direction in the natural order on*ℤ,*then we can find lines**l**and**s**with slope sets**A**and**B**intersecting in a lower*-*left or an upper*-*right halfline*,*depending on whether**I**is lower*-*or upper*-*bounded with respect to the natural order*. - (3)
*If**I**is unbounded in both directions*,*then all lines**l**and**s**with slope sets**A**and**B**do intersect in a finite segment*.

### Proof

If *I* is finite, let *c* be its smallest element according to the natural order. Let *p* be a point with *p* _{ x }+*p* _{ y }=*c*. Construct the line *l* with slope set *A* through *p* and the line *s* through *p* with slope set *B*. To the lower left of *p*, *l* and *s* coincide, because for all *z*≤*p* _{ x }+*p* _{ y } (in the natural order), *z*∈*A* if and only if *z*∈*B*. Similarly, picking a point *q* such that *q* _{ x }+*q* _{ y } equals the biggest element of *I* in the natural order, one can construct the line with slope set *A* and the line with slope set *B* through *q*. These two lines are going to coincide to the upper right of *q*.

If *I* is infinite and there is a *k*∈ℤ such that for all *i*∈*I*, *i*<*k*, then pick a point *p* with *p* _{ x }+*p* _{ y }=*k*. The line *l* with slope set *A* through *p* and the line *s* with slope set *B* through *P* have the halfline starting at *p* in common, because for all *z*∈ℤ with *z*≥*k*, *z* is in *A* if and only if *z* is in *B*.

Finally, consider lines *l* and *s* with slope sets *A*⊂*B* such that *I*=*B*∖*A* is unbounded in both directions according to the natural order. For any point *p*∈*l*, look at the corresponding point *p*′∈*s* on the same level, that is, with \(p'_{x} + p'_{y} = p_{x} +p_{y}\). Moving *p* on *l* toward the upper right, the difference \(p_{y} -p'_{y} = p'_{x} - p_{x}\) decreases monotonically. (Whenever *p* _{ x }+*p* _{ y }∈*I*, *p* is moving to the right, but *p*′ is moving up, so \(p_{y} - p'_{y}\) decreases by one.) The same way, the difference increases from time to time if we move *p* on *l* into the other direction. Because *I* is unbounded both ways, there is no point after which the difference remains constant moving to the upper right, nor a point after which the difference remains constant moving *p* to the lower left. Therefore, *l* and *s* have to intersect in a common line segment. □

We define two lines to be *parallel* if they do not cross, that is, according to Observation 13, two lines are parallel if they are disjoint or if they agree on a halfline. We distinguish two possible cases for the slope sets *A* _{ ℓ } of a line *ℓ*. If there is a *c*∈ℤ such that *A* _{ ℓ }=[*c*,∞)_{≺}={*a*∈ℤ| *a*≻*c*}∪{*c*} or *A* _{ ℓ }=(*c*,∞)_{≺}={*a*∈ℤ| *a*≻*c*}, that is, if its boundary can be described by the smallest element, either including or excluding this element, then we call the slope set *A* _{ ℓ } *rational*. In the special cases *A* _{ ℓ }=ℤ and *A* _{ ℓ }=∅ we define *A* _{ ℓ } as rational, too. If no such *c* exists, or, in other words, if *A* _{ ℓ } does not have a smallest element and its complement ℤ∖*A* _{ ℓ } does not have a greatest element (and they are not empty), then we call *A* _{ ℓ } *irrational*.

We proceed by analyzing the digital lines derived from the total order that we defined in Sect. 3, using the powers of 2. We denote this order by ≺^{∗}. With the help of the previous lemma, we can characterize which lines do have unique parallels and which do not.

### Theorem 15

*Let*

*ℓ*

*be a line with respect to*\(\mathcal{S}_{\prec^{*}}\),

*and let*

*p*∈ℤ

^{2}

*be a point with*

*p*∉

*ℓ*.

- (1)
*If the slope set**A*_{ ℓ }*is irrational*,*then there is a unique line**ℓ*′*through**p**that is parallel to**ℓ*.*Furthermore*,*A*_{ ℓ′}=*A*_{ ℓ }. - (2)
*If**A*_{ ℓ }*is rational*,*then**ℓ**has exactly two parallels**ℓ*′*and**ℓ*″*through**p*,*one of them with the same slope set as**ℓ*,*the other with a slope set that differs by one element*.*Consequently**ℓ*′*and**ℓ*″*have a common halfline in one direction*,*and split at one point to run parallel at distance one in the other direction*.

### Proof

Note that ≺^{∗} is a dense order on ℤ, that is, for any two integers *a*≺^{∗} *b*, we find a *c*∈ℤ such that *a*≺^{∗} *c*≺^{∗} *b*. Equivalently, this means that every ≺^{∗}-interval \([a,b]_{\prec^{*}}\) with *a*≠*b* is infinite. Let *s* be an arbitrary line through *p* parallel to *ℓ*. Consider the symmetric difference of the slope sets *I*=*A* _{ ℓ }△*A* _{ s }. If *I* is empty, the slope sets are equal and *s* is the diagonal translate of *ℓ* going through *p*. If *I*≠∅, by density of the order, *I* is either infinite or consists only of one element *a*. If *I* is infinite, then it is unbounded according to the natural order in both directions. (Besides density, this is the only property of ≺^{∗} that we use.) According to Lemma 14, *s* and *ℓ* do intersect in a finite segment in this case, which is a contradiction because *s* is parallel to *ℓ*. Therefore, *I* consists of one element. If *A* _{ ℓ } is irrational, by adding one element to *A* _{ ℓ } or removing one element from *A* _{ ℓ } we do not get a ≺^{∗}-interval. Hence, in this case, there is only one possible slope set for any line parallel to *ℓ*, namely, *A* _{ ℓ }. If *A* _{ ℓ } is rational, then either *A* _{ ℓ }={*a*∈ℤ| *c*≺^{∗} *a*}∪{*c*} or *A* _{ ℓ }={*a*∈ℤ| *c*≺^{∗} *a*}, for some *c*∈ℤ, so adding *c* or removing *c*, respectively, yields the only different possible slope set for a parallel through *p*. As the slope sets of these two parallels differ by only one element, they have either a common halfline to the left or a common halfline to the right. □

## 6 Higher Dimensions

It is natural to ask whether there is a CDS in more than two dimensions. The definition of a CDS directly carries over to the higher dimensional spaces. Instead of ℤ^{2} we now consider ℤ^{ d }, for a fixed integer *d*≥3, with the usual graph structure, that is, two points *p* and *q* are adjacent if they differ in exactly one coordinate by exactly one. The axioms (S1)–(S4) stay the same, verbatim, and the monotonicity axiom (S5) now reads as follows: If for *p*=(*p* _{1},…,*p* _{ d }),*q*=(*q* _{1},…,*q* _{ d })∈ℤ^{ d } there is an *i* such that *p* _{ i }=*q* _{ i }, then for all *r*=(*r* _{1},…,*r* _{ d })∈*S*(*p*,*q*) we have *r* _{ i }=*p* _{ i }=*q* _{ i }. We define the *slope type* of a pair of points (*p*,*q*) as the sign vector (*σ* _{1},…,*σ* _{ d })∈{+1,−1}^{ d }, *σ* _{ i }=+1, if *p* _{ i }≤*q* _{ i }, and *σ* _{ i }=−1, if *p* _{ i }>*q* _{ i }. The slope type of a digital segment *S*(*p*,*q*) is defined as the slope type of (*p*,*q*). We say that a segment has *strictly positive slope*, if its slope type is (+1,…,+1), that is, the coordinates are monotone increasing in each coordinate.

It is not hard to see that we can again derive a consistent system from an arbitrary total order ≺ on ℤ, if we consider only segments that have strictly positive slope, that is, slope type (+1,…,+1); the only difference in the construction is that now we have to cut the segment interval [*p* _{1}+⋯+*p* _{ d },*q* _{1}+⋯+*q* _{ d }−1] into *d* parts, according to ≺. Let *p*,*q*∈ℤ^{ d } be two points, such that *p* _{ i }≤*q* _{ i } for all 1≤*i*≤*d*. We can define the segment *S* _{≺}(*p*,*q*) in a similar way as in the two dimensional case—starting at *p* and repeatedly going in one of the *d* possible directions, collecting points from ℤ^{ d }, until we reach *q*. If we are at a point (*r* _{1},…,*r* _{ d }) for which *r* _{1}+*r* _{2}+⋯+*r* _{ d } is among the *q* _{ d }−*p* _{ d } greatest elements of the segment interval [*p* _{1}+⋯+*p* _{ d },*q* _{1}+⋯+*q* _{ d }−1] according to ≺, we proceed in direction *d*; if it is among the *q* _{ d−1}−*p* _{ d−1} greatest elements of the segment interval that remain after removing the *q* _{ d }−*p* _{ d } elements that were the greatest, we proceed in direction *d*−1, and so on. Finally, if *r* _{1}+*r* _{2}+⋯+*r* _{ d } is among the *q* _{1}−*p* _{1} smallest elements of the segment interval, we proceed in direction 1.

### Theorem 16

*The definition above yields a CDS of segments with strictly positive slope*.

### Proof

The crucial axiom to verify is the subsegment property (S3). As in the proof of Theorem 3, assume there are two segments with strictly positive slope, splitting at some point *p* and meeting again for the first time at *q* (see Fig. 3). The two subsegments from *p* to *q* can be seen as words over the alphabet [*d*]={1,2,…,*d*}, where 1 stands for going in the first direction, 2 for going in the second direction, and so on. So let *α*=*a* _{1} *a* _{2}⋯*a* _{ k },*β*=*b* _{1} *b* _{2},…,*b* _{ k }∈[*d*]^{ k } be these two words. By assumption they differ at the beginning and at the end and they contain the same number of each of the letters, that is, for any *l*∈[*d*], |{*i*:*a* _{ i }=*l*}|=|{*i*:*b* _{ i }=*l*}|. Without loss of generality we may assume that *a* _{1}>*b* _{1}. Then there must be an 1<*i*≤*k* such that *a* _{ i }<*a* _{1} and *b* _{ i }>*b* _{1}. (If there were no such *i*, then for any 1<*i*≤*k* with *a* _{ i }<*a* _{1} we have *b* _{ i }≤*b* _{1}<*a* _{1}. Now looking at all letters that are strictly smaller than *a* _{1} in both words, we see that there is at least one such letter more in *b*, namely at the first position, a contradiction.) This leads to a contradiction, as translated back to the original setting it implies *p* _{1}+⋯+*p* _{ d }≻*p* _{1}+⋯+*p* _{ d }+*i*−1, if we look at the interval of the first segment, and at the same time *p* _{1}+⋯+*p* _{ d }≺*p* _{1}+⋯+*p* _{ d }+*i*−1, if we look at the interval of the second segment. This proves (S3).

The rest of the axioms can be verified similarly as in the 2-dimensional case. □

## 7 Conclusion

The main result of this paper is the construction of a CDS in the plane with the property that the digital segments are reasonably close, in the Hausdorff metric, to their Euclidean counterparts. The solution we provide is optimal up to a constant factor. The key idea is to derive a CDS from a total order on ℤ.

It is shown that adding an additional constraint, namely translation invariance in the diagonal direction, there is a one to one correspondence between CDSes and total orders on ℤ. However, there remain “exotic” examples not satisfying this condition, like the waterline example presented in Sect. 4, which consequently are not derived from a total order. Are there other “exotic” examples? How can we completely characterize all consistent digital line segment systems in the plane?

Moving to higher dimensional spaces, the trivial CDSes following the axis-parallel box spanned by the two end points naturally generalize. Also, one can generalize the waterline example—in three dimensions, for example, we can define a CDS as follows. For points *p* and *q*, suppose that *p* is farther away from the plane *z*=0 than *q*. Starting at *p*, we first move towards the *z*=0 plane vertically, until either the *z*-coordinate equals *q* _{ z } or we hit the plane *z*=0. Then we move horizontally, following some planar CDS, until we are on the same vertical line as *q*. Finally, if necessary, we move away from the *z*=0 plane vertically to reach *q*. Note that, just like their planar counterparts, these systems do not satisfy the small Hausdorff distance property (H).

Our approach using total orders remains applicable if we restrict to consistent digital rays emanating from one common point or if we only allow segments of a certain slope type. However, when trying to combine systems with different slope types, it seems inevitable to violate property (S3), as shown in Fig. 12, unless we use systems derived from very special total orders, in which case the system does not satisfy property (H). Hence, the question if there is a CDS satisfying the small Hausdorff distance property (H) in dimension higher than two remains open.

## Notes

### Acknowledgements

We are indebted to Jiří Matoušek, who posed this problem at the 7th Gremo Workshop on Open Problems—GWOP 2009. We would like to thank József Solymosi for participating in the fruitful discussions that led to the main result of this paper. We thank the organizers of GWOP 2009 for inviting us to the workshop and providing us with a gratifying working environment. Finally, we are grateful to the anonymous referees, whose useful and detailed comments improved our paper a lot.

M. Stojaković was partly supported by Ministry of Science and Technological Development, Republic of Serbia, and Provincial Secretariat for Science, Province of Vojvodina.

## References

- 1.Chun, J., Korman, M., Nöllenburg, M., Tokuyama, T.: Consistent digital rays. Discrete Comput. Geom.
**42**(3), 359–378 (2009) MathSciNetzbMATHCrossRefGoogle Scholar - 2.Goodrich, M.T., Guibas, L.J., Hershberger, J., Tanenbaum, P.J.: Snap rounding line segments efficiently in two and three dimensions (1997) Google Scholar
- 3.Greene, D.H., Yao, F.F.: Finite-resolution computational geometry. In: FOCS’86: Proceedings of the 27th Annual Symposium on Foundations of Computer Science, Washington, DC, USA, pp. 143–152. IEEE Comput. Soc., Los Alamitos (1986) Google Scholar
- 4.Klette, R., Rosenfeld, A.: Digital straightness—a review. Discrete Appl. Math.
**139**(1–3), 197–230 (2004) MathSciNetzbMATHCrossRefGoogle Scholar - 5.Schmidt, W.M.: Irregularities of distribution. VII. Acta Arith.
**21**, 45–50 (1972) MathSciNetzbMATHGoogle Scholar - 6.Sugihara, K.: Robust geometric computation based on topological consistency. In: Alexandrov, V.N., Dongarra, J., Juliano, B.A., Renner, R.S., Tan, C.J.K. (eds.) International Conference on Computational Science (1). Lecture Notes in Computer Science, vol. 2073, pp. 12–26. Springer, Berlin (2001) Google Scholar
- 7.van der Corput, J.: Verteilungsfunktionen. I. Mitt. Proc. Akad. Wet. Amsterdam
**38**, 813–821 (1935) Google Scholar