Orientation Preserving Maps of the Square Grid II

For a ﬁnite set S ⊂ R 2 , a map ϕ : S → R 2 is orientation preserving if for every non-collinear triple u , v, w ∈ S the orientation of the triangle u , v, w is the same as that of thetriangle ϕ( u ), ϕ(v), ϕ(w) .Assumingthat ϕ : G n → R 2 isanorientationpreserving map where G n is the grid { 0 , ± 1 , . . . , ± n } 2 and n is large enough we prove that there is a projective transformation μ : R 2 → R 2 such that (cid:5) μ ◦ ϕ( z ) − z (cid:5) = O ( 1 / n ) for every z ∈ G n .


Introduction
This paper is about orientation preserving maps of the n × n grid and is a continuation of the results in [1].We denote by G n the grid {(i, j) ∈ Z 2 : −n ≤ i, j ≤ n} and by G * n the grid {(i, j) ∈ Z 2 : 1 ≤ i, j ≤ n}.A map ϕ : G n → R 2 is orientation preserving if for every non-collinear triple u, v, w ∈ G n the orientation of the triangle u, v, w is the same as that of the triangle ϕ(u), ϕ(v), ϕ(w), or with a formula sign det u v w 1 1 1 = sign det ϕ(u) ϕ(v) ϕ(w) 1 1 1 .
Our main result is that given an orientation preserving map ϕ : G n → R 2 (and n is large enough) there is a projective transformation μ such that μ • ϕ(z) − z is small for every z ∈ G, namely, it is of order 1/n.Precisely we have the following result.
Theorem 1.1 Assume that n ∈ N is large and ϕ : G n → R 2 an orientation preserving map.Then there is a projective transformation μ : R 2 → R 2 such that μ•ϕ(z)−z = O(1/n) for every z ∈ G n .
The bound O(1/n) is best possible which is shown by an example in Sect. 5.
A corollary to our main result is a sharp version of [1,Thm. 1.1] stating that if ϕ : G n → R 2 is an orientation preserving map, then G n contains a large subgrid on which an affine image of ϕ is very close to the identity.Our main result implies a stronger form of this theorem, namely the following.Theorem 1.2 For every k ∈ N and for every ε ∈ (0, 0.1) there is n = n(k, ε) such that if ϕ : G n → R 2 is an orientation preserving map, then there is an affine transformation α : R 2 → R 2 and a ∈ Z 2 such that a + G k ⊂ G n and for every z Here n(k, ε) = O(k 2 /ε) and this estimate is best possible.
We prove this theorem in Sect. 4.An example showing that the bound n(k, ε) = O(k 2 /ε) is best possible was given in [1].
The existence of n(k, ε) in Theorem 1.2 was already proved by Nešetřil and Valtr [7, Lem.10] as the key tool for proving several Ramsey-type results.However, the proof in the paper [7] relied on repeated compactness arguments, thus it gave no upper bound on n.The first explicit bound n(k, ε) = O(k 4 /ε 2 ) was given in [1].From the (discrete and) computational geometry point of view, the most interesting consequences of any explicit bound, including our new bound n(k, ε) = O(k 2 /ε), in Theorem 1.2 might be those which are connected with the study of order types, as described in the next section.

Motivation and Rigidity
An order type of size n is the equivalence class of all ordered n-point sets that can be mapped into each other by a strongly orientation preserving map, where a map ϕ : A → R 2 from a finite planar point set A to R 2 is strongly orientation preserving if it is orientation preserving and, additionally, it maps collinear triples of A to collinear triples.
Order types have been studied from various perspectives.For example, a famous result of Goodman et al. [4] and of Kratochvíl and Matoušek [5], states that there are order types of size n with double exponential span.Here the span of a finite point set A ⊂ R 2 is the ratio between the maximum distance in A and the minimum distance in A. Note that due to projective transformations the supremum of the spans of the sets of any fixed order type (of size at least three) is ∞.We define the span of an order type as the infimum of the spans of the point sets in the corresponding equivalence class.A neat and recent result of Goaoc and Welzl [2] states that the expected number of extreme points of a random order type (in R 2 ) is slightly smaller than 4 when random order types are chosen from the uniform distribution on all order types of size n.
For more information on order types see the paper of Goodman and Pollack [3] for classical results and the recent paper of Pilz and Welzl [8] for further references.Our companion paper [1] explains further connections between order types and orientation preserving maps of G n .
Our main result says that a certain order type (namely that of G * n ) is "projectively rigid" meaning that every representation of that order type can be mapped by a projective (and orientation preserving) map to another representation which is "very close" to a fixed order type.Without giving the precise definition, what Theorem 1.1 states in this form is that the order type of G * n is projectively rigid with an error of O(1/n).Or in other words, its "projective rigidity" is O(1/n), at least for large n.
Some caution is in place here though.It is clear that the projective rigidity of (the order type of) G * 2 is zero.However one can show that the projective rigidity of G * The points A, B ∈ R 2 are ε-close if their x and y coordinates differ in at most ε, that is, A − B < ε.Here and throughout the paper • is the maximum norm.For distinct A, B ∈ R 2 , L(A, B) denotes the line they span, [A, B] the segment they define, and AB their Euclidean distance.
Assume that ε is a positive real.We say that (G, ϕ) is ε-close if for every point A of the grid ϕ(A) and A are ε-close.Note that this definition makes sense even when ε is not small.Soon we will work with a 16-close (G, ϕ) pair.With this notation another form of Theorem 1.1 is the following.Theorem 3.1 If n is large enough and (G n , ϕ) is an orientation preserving pair, then there exists a projective transformation μ such that

We will frequently work with a general
Here we assume that k > 2t > 0.
Some further notation: If G * is a subgrid of G n and ϕ : G n → R 2 is a map (orientation preserving or not), then the restriction of ϕ to G * is denoted invariably by ϕ.So it makes sense to say that the pair (G * , ϕ) is orientation preserving.
In the proofs we use constants c, c 0 , c 1 , c 2 , c 3 > 0, they are universal and explicitly computable.Often we need a lower bound on k (or n) which is always of the form k > k 0 where k 0 is again universal and explicit.Frequently we will just say that something holds for large enough k.We will also use the convenient O( • ) notation.In such cases the implied constants are again universal and explicitly computable.
The starting point of the proof of Theorem 3.1 is a lemma whose simple proof is given in Appendix A.
The proof of Theorem 1.1 has many ingredients and is based on the next five lemmas.Let (G * , ϕ) be an orientation preserving pair with G * a k ×k grid.A unit cell, or simply a cell, Q(i, j), of G * is the set of four points (i, j), (i +1, j), (i, j +1), (i +1, j +1) ∈ G * .Given ε > 0 the cell Q(i, j) is said to be ε-close if for some real numbers x, y the following holds: Lemma 3.7 Assume that δ < 0.01 and n > k, k even and large, and ϕ : The proof of Theorem 1.1 goes via a recursion during which we will often change ϕ to μ • ϕ where μ is a projective (or affine) map.It will be convenient to keep the same notation, that is, to rename μ • ϕ as ϕ.We hope that this will not cause any confusion.
Here comes a quick sketch of the proof.For the starting step we assume n is large and choose the largest odd m ∈ N with n > 2m 2 − m.Lemma 3.2 shows that (G m , ϕ) is p-separated.Using Lemma 3.3 we find an affine map ν such that (G m−2 , ν • ϕ) is 16-close and is of course orientation preserving.Set k = m − 2 which is odd.The starting point of the recursion is the pair (G k , ν •ϕ), or with our convenient convention (G k , ϕ) which is 16-close and orientation preserving and (G n , ϕ) well-defined (k is odd).
In a general step of the recursion we have a pair (G k , ϕ) (with k odd) which is 16close and orientation preserving and ϕ is defined on G n (but may not be orientation preserving on the whole G n ).We apply Lemma 3.4.Then the new pair (G k , μ • ϕ), or rather (G k , ϕ) is orientation preserving and c-close (with the constant c from the lemma) and ϕ is the identity on the four vertices of G k .The map ϕ is still defined on G n and we show (in Lemma 8.1) that it is orientation preserving on the subgrid Several properties of the pair (G k , ϕ) have to be established next.For instance, Lemma 10.1 says that the ϕ image of the four vertices of the cell are very close to the vertices of a unit square.The midpoint lemma (Lemma 11.1) shows that when M ∈ G * is the midpoint of the segment [A, B] where A, B ∈ G * , then ϕ(M) is very close to the line L (ϕ(A), ϕ(B)); this holds when the direction of L(A, B) is one of eight special directions; for the details see Sect.11.We will encounter the case when (G 2k , ϕ) is c-close and its cells are ε-close and we have to estimate how far ϕ(0, 0) deviates from (0, 0) as a function of the deviations at the four vertices of G 2k .This, together with similar deviation estimates, is carried out in Sect.12.These estimates are used in the proof of Lemma 3.6 A n,n = (an, bn) A 0,0 = (0, 0) 4 Proof of Theorem 1.2 It will be convenient to work with the grid {0, 1, . . ., n} 2 , to be denoted by G * .Suppose (G * , ϕ) is an orientation preserving pair, and ϕ maps points of G * to points in the so called ϕ-plane P. Originally only the points ϕ(A), A ∈ G * , are known in P. Together with the projective map μ from Theorem 1.1 we also have, in the image space of μ • ϕ (which we call the μ-plane) the vertical lines V i = {(x, y) : x = i} and the horizontal lines H j = {(x, y) : y = j} for i, j ∈ {0, 1, . . ., n}.These lines form a chessboard like structure.The lines v i = μ −1 (V i ) lie in P and are concurrent, and so are the lines h j = μ −1 (H j ) ⊂ P. The lines h 0 , h n , v 0 , v n bound a convex quadrilateral with vertices A i, j = h i ∩ v j for i, j ∈ {0, n}.Because of the symmetry of the chessboard we may assume that A 0,0 is contained in both segments [A n,0 , h 0 ∩ h n ] and [A 0,n , v 0 ∩ v n ]; see Fig. 1, left.Now we introduce a coordinate system in P by setting A 0,0 = (0, 0), A n,0 = (n, 0), A 0,n = (0, n), see Fig. 1 as well.Then A n,n is a well-defined point v n ∩ h n = (an, bn) where 1 < a, b.With this convention we see that .
We want to show that (i, j) and ϕ(i, j) (for i, j ≤ k) are close to each other in the ϕ-plane P. For that we need another affine, or in this case linear, map α : P → P, namely the one given by This is the affine map we are looking for: (i, j) and α • ϕ(i, j) are close to each other (for suitable values of i, j), as we shall see soon.Setting D = a + b − 1 we determine first The points (i, j) and μ • ϕ(i, j) in the μ-plane are within distance O(1/n) of each other because of Theorem 1.1.For concreteness we assume (μ • ϕ(i, j) − (i, j) < c 0 /n =: .So these points lie in the square with vertices (i ± , j ± ) in the μ-plane.
Consequently the α • μ −1 images of (i, j) and μ • ϕ(i, j) lie in the α • μ −1 image of this square, see Fig. 1, right.We compute the x and y component of the vector This will give an upper bound on α Recall the definition of E and note that Dn − E > Dn/2 because D > 1 and The same estimate holds for the y component of v.
n 0 contains a copy of G * k 0 such that with a suitable affine map α, we have α • ϕ(z) − z < ε for every z in that copy.Every G * k in that G * k 0 satisfies the requirements, and k ≥ 2. Thus n = (6c 0 k 2 )/ε works for all k < k 0 .

The Bound in Theorem 1.1 is Best Possible
Here (and later) we need a simple claim about properties of projective maps.Assume η > 0 is small and let A 0,0 , A 0,1 , A 1,0 , A 1,1 ∈ R 2 be points such that A i, j − (i, j) < η for all i, j ∈ {0, 1}.There is a unique projective map μ : R 2 → R 2 with μ(A i, j ) = (i, j) for all i, j ∈ {0, 1}.
The proof is in Appendix B. We mention that with more effort one can show μ(z) − z < 2η + O(η 2 ) but that is not important for us.Now we begin the proof that the bound in Theorem 1.1 is best possible.Given two distinct points of G n , their line either contains the origin, or intersects the x-axis at a point (x, 0) with |x| ≥ 1/(2n).This is true because x is the solution of a linear equation with every coefficient an integer between −2n and 2n.The same applies to the intersection point with the y-axis.So every line determined by two points of G n either passes through the origin or avoids the interior of the convex hull of the four points (±1/(2n), ±1/(2n)).
For the example showing that O(1/n) is best possible in Theorem 1.1 we take ϕ to be the identity at every point of G n except at the origin where ϕ(0, 0) = z := (1/(3n), 0).The previous argument shows that (G n , ϕ) is an orientation preserving pair.Assume now that ν is a projective map with ν • ϕ(z) − z < ε for every z ∈ G n .We are going to show that ε > 1/(50n).

Proof of Lemma 3.3
We set and apply an affine transformation ν such that, for the ν • ϕ blocks, the horizontal separator lines become horizontal, the vertical separators become vertical and the diagonal separators have slope 1.With our convenient convention we assume that this is already the case for ϕ.After that we can still shift/scale the image without changing the slope of any line.
We have k − 1 vertical and horizontal separator lines and 2k − 2 diagonal separator lines.Let a 1 , . . ., a k−1 be the x-coordinates of the vertical separators and b 1 , . . ., b k−1 be the y-coordinates of the horizontal separators.Let both of these sequences be increasing.Apply a shift/scale such that Let L 3 be the diagonal separator that separates the ϕ image of the diagonal blocks G * on the grid line y = x + 3 and on the grid line y = x + 2; see Fig. 2. Similarly let L −3 be the diagonal separator separating the ϕ image of the diagonal blocks on the grid line y = x − 3 and on the grid line y = x − 2.
The rectangle which is below the line L 3 and therefore (a i , b i+1 ) is also below the line L 3 (see Fig. 2).Similarly we get that the point 2 be the distance of the two lines L 3 and L −3 .Then the length of any axis-aligned monotone decreasing polygonal path from L 3 to L −3 is d.Based on the position of the grid points relative to the two diagonals L 3 and L −3 we see that Observe that there are k − 2 i , namely 2 , . . ., k−1 , and they add up to Let D be the maximum of i for 2 ≤ i ≤ k − 1.Their average is 2 therefore 2 ≤ D. We have i < d for every i so D < d.Finally k − 2 is a multiple of 4 so we can group the sum i into groups of size 4, each adding up to more than d, so We can assume here that E j is positive because reflecting the rectangle with respect to its centre would produce the same situation just the values E j are changed to −E j .Assume on the contrary that E = E j > 22. Observe that and we may assume that 3 ≤ j ≤ k − 3. We distinguish two cases based on whether j is "closer" to 1 or k − 1.
Consider the line x + y = 2 j + E, which contains the point (a j , b j ).Clearly ϕ( j + 1, j + 1) is above that line.But then one of the points (if they exist) ϕ(1, 2 j + 2) or ϕ(2 j + 2, 1) has to be above that line as well, otherwise ϕ would reverse the orientation of the triangle (2 j + 2, 1), has to be above that line as well.The first two points exist if 2 j ≤ k − 3 and the latter two exist if 2 j ≥ k − 3 and j ≤ k − 3. Case 1: 2 j ≤ k − 3. Without loss of generality we can assume that ϕ(1, which is a contradiction.
Case 2: 2 j ≥ k − 3. We can assume again that ϕ and since a i and b i are less than 8 apart, we get that −15 < a i − i, b i − i < 15.The claim of the lemma follows from the fact that for 2 ≤ i, j ≤ k − 1 the point ϕ(i, j) has x and y-coordinates in the intervals Remark 6.1 This proof uses an argument that we like to call "doubling": if E i is large, then so is E 2i , or rather E 2i+2 .Assuming E j is maximal, E 2 j+2 is large but at most E j , giving upper bound on E j .We will use this doubling argument later as well.

Proof of Lemma 3.4
This proof is fairly simple.We are going to use Claim 5.1 for the square [−k, k]2 instead of the unit square [0, 1] 2 .The parameter η is replaced by 16 which is fine because k is large.In this case the claim says that for the unique projective map μ satisfying and for large enough k.The lemma holds with c = 210.
To complete the proof we have to see that (G k , μ • ϕ) is orientation preserving.Let be the line that μ maps to the line at infinity.We are going to show that avoids the square The intersection point of the lines 3 where the four small squares are centred around (±k, ±k) and their side lengths are 32.It is not hard to check that Fig. 3 The set D contains P P ∈ C.This shows that when P x > 0, then P is contained in the convex set Let E be the copy of D, rotated around the origin by angle +π/2; E is not shown in Fig. 3.By symmetry A simple computation reveals that every line passing through a point of D and a point of E is at least at distance k(k − 3c)/(2c) from the origin.Then by symmetry, the line L(P, Q) is at least this far away from the origin and avoids the square The map μ carries the line = L(P, Q) to the line at infinity, and so μ does not change the orientation of a triangle in G k if its vertices are on the same side of as the origin.

Lemma 8.1 and Its Proof
On a step of the recurrence, after the application of the projective map μ, there is an orientation preserving and c-close pair (G k , ϕ).Let be the line in the plane of G n that μ sends to the line at infinity.The next lemma is about this situation.
For lack of space Fig. 4 does not show the lines L i .
The points ϕ(B i ) and ϕ(C i ) lie in the small squares of side lengths 2c centred at B i and C i , respectively.As k is much larger than c, the direction of the line L i is very close to that of i for i = 1, 2, 3. Denote by + i the halfplane with bounding line i that contains (k, k) for i = 1, 2, 3.The intersection 3   1 + i is a triangle containing (k, k).It follows that 3  1 L + i is also a triangle which is close to .But then 3  1 Remark 8. 2 This proof shows that (G k [m], ϕ) is also orientation preserving for m larger than 20, up to probably m ≤ k/10 but we don't need this.
9 Preparations for Lemma 3.5 This section gives an auxiliary result for Lemma 3.5.Recall that the target there is to show that every cell in We prove first that the ϕ-image of a unit cell is close to an aligned square.The x and y components of ϕ(i, j) will be written as x(i, j) and y(i, j), respectively.One more piece of notation giving the x and y components of the vectors ϕ(i + t, j) − ϕ(i, j) and ϕ(i, j + t) − ϕ(i, j): So for instance H x t (i, j) is the horizontal component of the vector ϕ(i +t, j)−ϕ(i, j) while V x t (i, j) is its vertical component.
Note the condition 1 < i, j < k − 1 says, for instance, that (9.2) only applies to unit cells

Proof
The ratio H y t (i, j)/H x t (i, j) is equal to the slope of the line through ϕ(i, j) and ϕ(i +t, j).Consider the segment [(i, j), (i +t, j)], where 2 ≤ j ≤ k−1.Compare its position to the four points (1, j − 1), (1, j + 1), (k, j − 1), (k, j + 1).The slope s of the line L (ϕ(i, j), ϕ(i + t, j)) is more than that of L (ϕ(1, j + 1), ϕ(k, j − 1)) but less than that of L (ϕ(1, j − 1), ϕ(k, j + 1)), that is, By switching the roles of the x and y coordinates we get the same bounds for the vertical segments.Therefore the image of each unit cell is already close to some rectangle.We remark here that H x(i, j) > 0 follows.Indeed, assuming j ≤ k/2, H x(i, j) ≤ 0 would imply that ϕ(i, j + 1) and ϕ(k, k) are on opposite sides of L (ϕ(1, k), ϕ(i, j)) contradicting the orientation preserving property.A similar argument works when j > k/2.It follows further that H x t (i, j) = i+t−1 s=i H x(s, j) > 0. Completely analogously V y(i, j), V y t (i, j) > 0 follows as well.
Consider the triangle ϕ(i, j), ϕ(i +1, j), ϕ(i, j +1).Assume that = H x(i, j) ≥ V y(i, j), then = max {H x(i, j), V y(i, j)} and write δ := − V y(i, j) ≥ 0. Then the slope of the diagonal times −1 is Using the values of and δ we get 2) when = H x(i, j).The same argument works when = V y(i, j) and gives at least for large k.This proves (9.2) when = V y(i, j).
Symmetry implies that, analogously to (9.2), we have This shows that the sides of the quadrilateral ϕ(Q(i, j)) are almost equal.Moreover, since Q(i − 1, j) and Q(i, j) share a side, holds as well provided i − 1 > 1.We can see now that the image of a unit cell is very close to an aligned square.We want to show that it is close to a unit square.This is the content of the next section.
10 Proof of Lemma 3.5 Lemma 10.1 Under the conditions of the previous lemma and for large enough k, where the constant in O( • ) depends only on c. Therefore every unit cell is ε-close with ε = c 1 /k where c 1 depends only on c.
The lemma shows via (9.1) and (9.2) that the vectors ϕ(i + 1, j) − ϕ(i, j) are almost horizontal, and the vectors ϕ(i, j + 1) − ϕ(i, j) are almost vertical and both have length almost one, implying that the unit cell This completes the proof of Lemma 3.5.Let L be the horizontal line through ϕ(A) and L the horizontal line through ϕ(A ).Let M and N be the intersection of L the with lines L (ϕ(C), ϕ(B)) and L (ϕ(D), ϕ(B)) respectively.Let L intersect the four sides of the (non-convex) quadrilateral ϕ(A), ϕ(D), ϕ(C), ϕ(B) in the points P, Q, R, T in that order.Let S be the intersection of L and L (ϕ(B), ϕ(B )).Since ϕ is orientation preserving we have the following six points on the line L from left to right in order: P, ϕ(A ), Q, R, S, T and the points ϕ(A), M, N are on the line L. The order of M and N depends whether ϕ(B) is above or below the line L.

Proof
There are five almost vertical lines, namely the four sides of the (non-convex) quadrilateral whose vertices are ϕ

(A), ϕ(D), ϕ(B), ϕ(C) and the line L (ϕ(B), ϕ(B )).
The absolute value of the slope of these five lines is at least (t − 2c)/(2 + 2c) > k/(12 + 12c).This implies using Lemma 9.1 that Because of the order of the six points on L we have The distance of C to L is at least t − 1 − 2c and to L is at most 2t where the last inequality holds for large enough k, we omit the straightforward calculations.Similarly using the point D instead of C we get that Combining all these inequalities gives that We use next (9.4)twice to see that Switching the roles of x and y, an identical argument shows that for a fixed j the numbers V y(i, j) differ from V y(k/2, j) by at most O(k −1 ).Since for every i, j the numbers V y(i, j) and H x(i, j) differ by at most O(k −1 ), we get that for every i, j the numbers H x(i, j), H x(i, k/2), V y(i, k/2), V y(k/2, k/2) differ by at most O(k −1 ).Thus the numbers H x(i, j) are almost equal: any two of them differ by at most O(k −1 ).
We are nearly finished with the proof.Observe that by symmetry.
We just proved that ϕ(G * [−1]) is locally very close to a unit grid.This implies that the distance of the images of (i, j) and ).This is great for small values of t but is useless when t is comparable to k, since we get a O(1) error.So it can happen that the distance between the images of (1, 1) and (k, 1) is k + 100, say, and the distance between the images of (1, k) and (k, k) is k − 100, which is 200 apart, too large for our purposes.
The next step is crucial, where the local property (of ϕ(G * [−1]) being locally very close to a unit grid) is extended to the whole grid.The next section is devoted proving the lemmas needed for that.
Lemma 11.1 Let (G * , ϕ) be an orientation preserving and c-close pair (with G * a k × k grid, and c from Lemma 3.4).Suppose that every unit cell in G * is ε-close, where ε = c 1 /k.Let A, B, M be grid points of G * on a line parallel to a short vector e such that M is the midpoint of the segment AB and t ≥ 3c is the integer such that AB = 2te.Then the distance of ϕ(M) to the line L (ϕ(A), ϕ(B)) is less than 7ε + 1/(2t − 2c − 1).
Proof Apart from symmetries there are only three distinct cases for the short vector e, namely e = (1, 0) or (1, 1) or (1, 2).There are two further cases depending on the orientation of the triangle with vertices ϕ(A), ϕ(M), and ϕ(B): ϕ(M) is either "above" or "below" the line L 0 := L (ϕ(A), ϕ(B)).These two cases are again symmetric.So we can assume that ϕ(M) is above L 0 ; see Fig. 6.Define f = (0, −1).In order to make the computations simpler we assume (using translations), that A = ϕ(A) = (0, 0), so in the figure A and ϕ Therefore the three lines L 0 , L 1 , L 2 determine a triangle that contains ϕ(M).See Fig. 6; this triangle is so small that the figure does not show the point ϕ(M).Clearly the distance of ϕ(M) to the line L 0 is less than the distance of L 0 to the opposite vertex of the triangle, which is the intersection point, say N , of the lines L 1 and L 2 .
The line through N and parallel with f intersects L 0 in N .It is evident that the distance of N from L 0 is less than the length of [N , N ].We are going to establish an upper bound on the length of [N , N ] in the three cases.Note first that ϕ

depending on the value of e.
Suppose for a moment that ε = 0. Then ϕ(A + f ), ϕ(B − f − e), etc all coincide with ϕ(A) + f , ϕ(B) − f − e, etc, respectively.The length N N can be computed easily: one determines the coordinates of the point N = L 1 ∩ L 2 , N = (x 0 , y 0 ) say.
Then one computes y-component of N ∈ L 0 so N = (x 0 , y 1 ).The length of [N , N ] is equal to y 0 − y 1 .The details of this computation are explained in Appendix C. The outcome is that When ε > 0 the points ϕ(A) + f , ϕ(B), ϕ(A − f + e), etc are in the aligned and small squares of side length 2ε (or 4ε or 6ε, depending on e) centred at ϕ(A + f ), ϕ(B), ϕ(A) − f + e, etc.It is not hard to check (see Fig. 6) that N N is maximal when the line L 1 is tangent from above to the small squares centred at ϕ(A) + f , ϕ(B) − f − e, and L 2 is tangent from above to the corresponding small squares around ϕ(B) + f , ϕ(A) − f + e, while L 0 is tangent from below to the small squares centred at ϕ(A) and ϕ(B).The red lines in the figure show these lines tangent to some squares.The three red lines determine a triangle that contains the triangle determined by L 0 , L 1 , L 3 , so N N is shorter than the length of the segment which is the intersection of L(N , N ) and .
The lines L 1 and L 2 have to be translated upwards (from their position when ε = 0), and L 0 downwards in direction f .The amount of these translations is half the width of an aligned square of side length 6ε orthogonal to the direction of the lines L 1 and L 2 and L 0 .As t > 3c is large, the directions of these lines are close to that of L (ϕ(A), ϕ(B)), which is also close to that of L(A, B).The maximal amount can be determined directly in all three cases.It turns out to be always smaller than 3.5ε; details are left to the interested reader.Translation goes once up and once down implying that and the result follows as |a| < 2c.
If a 1-Lipschitz function f on [n] has the property that the value at every midpoint is close to the average of the values at the two endpoints, and the value at the ends are 0, then the function is bounded.More precisely: Lemma 11.2 Let n > 100 and c * be some positive constant.Assume the function f : {0, 1, . . ., n} → R satisfies the following properties: The proof uses a version of the doubling argument and is explained in Appendix D. The lemma is needed for the following result, where the constants c and c 1 come from Lemmas 3.4 and 10.1.
Proof Let d(i) be the vertical and signed distance of Q i = ϕ(i, j) from the line and let f (i) = kd(i)/10.We claim that the function f (i) fulfills the conditions of Lemma 11.2; f is defined on [k] and not on {0, 1, . . ., n} but that does not matter. Evidently To check the other properties we need some preparations.Let . Let s + and s − be the slope of the line L(A 2 , B 1 ) and L(A 1 , B 2 ), respectively; see Fig. 7.

Claim 11.4 For large enough k we have
and because the cells are ε-close, both vectors A 2 − A 1 and B 2 − B 1 are within distance 2ε from the vector (0, 2) in the maximum norm.Thus From this s + −s − can be estimated the usual way (we omit the straightforward details) and the bound 9/k follows for large enough k.
Let P i be the intersection of and the vertical line through , therefore its slope, s * , is between s + and s − , and so is the slope (11.1) We use this with h = i + 1 first, combined with Claim 11.4: The last condition to be checked is the midpoint property.Let t ≥ k/10 and let and let M the intersection of and the vertical line through M, see Fig. 7.We know that The horizontal distance between M and Q i , This holds if k is large enough, namely larger than 10(2c + 1) because t > k/10.Thus The slope of the line L(Q i−t , Q i+t ) is between s + and s − .Equation (11.1) shows that Then Since 2 ≤ k/t, we have So the midpoint property is true with c * = (9c + 3.5c 1 + 1)/10.By Lemma 11.2 we know that for all i, | f (i)| < 62c * + 4 and therefore

Auxiliary Lemmas
In this section we will work with the grid G 2k , and we assume throughout that (G 2k , ϕ) is c-close and its cells are ε-close.In this section ε > 0 is considered a parameter, but the reader may think it is just c 1 /k.We set We show next that ϕ(0, 0) is close to the point where the diagonals of this quadrilateral meet.
We call x i the x-deviation at ϕ(A i ), or simply the x-deviation, and y i is the y-deviation.
The claim states that the deviation at (0, 0) is a linear function of the deviations at the vertices plus a small error term.
Proof The intersection point of the lines is the solution of two linear equations in variables X and Y : Direct checking shows that the solution is The midpoint lemma (Lemma 11.1) states that the point ϕ(0, 0) is at distance at most 7ε + O(k −1 ) from the line L 1 .The same upper bound applies to its distance from L 2 .Then ϕ(0, 0) lies in the parallelogram whose sides are parallel with L 1 and L 2 , and opposite sides are at distance at most 14ε+ O(k −1 ).The diameter of this parallelogram is at most 2(14ε + O(k −1 )) because the slope of L 1 and L 2 is close to −1 and 1.Finally, we note that (X , Y ), the intersection point of L 1 and L 2 , also lies in this parallelogram, and then ϕ(0, 0) − (0, 0) < 28ε + O(k −1 ), indeed.
We define next The intersection of the diagonals is again close to ϕ(0, 0).  13 Proof of Lemma 3.6 In this section (G 8k , ϕ) is an orientation preserving pair, which is c-close, every cell is ε-close with ε = c 1 /k, and ϕ coincides with the identity on the vertices of G 8k .
We are going to show that every (i, j) ∈ G 8k is O(k Let M be the maximum error in the x and y coordinates, that is, Assume that this maximum error is in the x coordinate at the point (i, j).The target is to prove that M = O(k −1 ).Lemma 11.3 shows that the x-deviations at (i, 8k) and (i, −8k) cannot be both less than M − c 3 /k in absolute value.We assume that the x-deviation at (i, 8k) is M * := ϕ(i, 8k) x − i.Then either Without loss of generality we suppose that i < 0.
with an error term which is at most c 3 /k.Assuming M * > 0 term by term estimation in the previous equation gives that implying that M < 28c 3 /(3k).The case when M * < 0 is similar: Lemma 12.3 gives the following expression for the x-deviation at (−6k, 8k): with an error term which is at most c 3 /k.Our first target is to show that |x 2 | is large.Assume first that x 1 = M * > 0. As the x-deviation at (−6k, 8k) is small, at most c 3 /k, we see that  Translate L 1 and separately L 2 so that they contain the (new) origin and let L * 1 and L * 2 denote the translated copies.These two line split the plane into four cones, define C 1 as the cone containing (2k, k).It is clear that Q ⊂ C 1 .Translate the lines L 3 and L 4 so that they go through the point (3k/2, 0) and let L * 3 and L * 4 denote the translated copies.These lines again define four cones.Let C 2 be the one that contains A simple inspection shows that the diameter of C 1 ∩C 2 is the segment connecting the points (x 1 , y 1 ) := L * 1 ∩ L * 4 and (x 2 , y 2 ) := L * 2 ∩ L * 3 .So we have to solve two systems of linear equations, each with two equations in two variables.Straightforward and generous (yet tedious) calculations show that 0 < x 1 −x 2 < 6δ and 0 < y 1 − y 2 < 22δ In the general step of the recursion we have a pair (G k , ϕ) which is 16-close and orientation preserving and ϕ is defined on the whole G n , k odd.Lemma 3.4 gives a projective map μ such that (G k [−1], μ• ϕ) is orientation preserving and c-close (with the constant c from the lemma) and μ • ϕ is the identity on the four vertices of G k .
Let be the line that μ maps to the line at infinity.Then μ • ϕ is still defined on G n unless ϕ(A) lies on for some point A ∈ G n .Even if this happens, μ • ϕ(A) is a welldefined point at infinity for which later projective maps can be applied with no trouble.Alternatively we can start by assuming that the points ϕ(i, j) for all (i, j) ∈ G n are in algebraically independent position.Then μ • ϕ(A) ∈ never happens, and we can use a limit or approximation argument in the end.
As G k [−1] is exactly G k−1 , after renaming we have the orientation preserving and c-close pair (G k−1 , ϕ) and ϕ is the identity on the four vertices of G k−1 and remains so for the rest of this step of the recursion.Here ϕ is defined on G n and may not be orientation preserving on the whole G n .
Next Lemma 10.We mention that a similar argument with a similar purpose was used in [1].

Lemma 3 . 3 Lemma 3 . 4
Let k − 2 be a multiple of 4, and G * be a k × k grid.If (G * , ϕ) is pseparated, then there exists an affine transformation ν such that(G * [−1], ν • ϕ) is 16-close.If (G k , ϕ) is orientation preserving, 16-close, and k is large enough, then there exists a projective transformation μ such that μ • ϕ is the identity on the four vertices of G k and (G k , μ • ϕ) is orientation preserving and c-close, where c is an explicit constant.

Lemma 3 . 6
and (G * , ϕ) is an orientation preserving pair which is c-close and k > k 0 where k 0 depends only on c.Then every unit cell in G * [−1] is ε-close with ε = c 1 /k.Assume k is large and is a multiple of 8, and (G k , ϕ) is an orientation preserving pair which is c-close and every cell in

Lemma 8 . 1
Under the above conditions (G k [20], ϕ) is also orientation preserving provided k is large enough.Proof Let + denote the halfplane (with bounding line ) that contains G k .It is evident that the orientation of a triangle with vertices A, B, C ∈ G n is the same as that of the triangle ϕ(A), ϕ(B), ϕ(C) if and only if + contains one or three of the points A, B, C. So it suffices to prove that (a, b) ∈ + for every (a, b) ∈ G k [20] \ G k .Define A = (a, b).Because of symmetry we may assume that k < a ≤ 20 and 0 ≤ b ≤ k + 20.Assume that, on the contrary, A / ∈ + .Then ϕ(A) and ϕ(k, k) are on opposite sides of the line L (ϕ(B), ϕ(C)) for every pair of points B, C ∈ G k such that A and (k, k) are on the same side of L(B, C).Define B 1 = (k/2, −k), B 2 = (k/2, k), and

Fig. 4
Fig. 4 Illustration for Lemma 8.1 and denote by L + i the halfplane with bounding line L i that contains ϕ(k, k) for i = 1, 2, 3, and by L − i the complementary (open) halfplane.Since A and (k, k) are on the same side of each one of the lines 1

3 Fig. 9 1
Fig.9The lines L i are red the lines L * i are blue 1 states that the ϕ-image of every cell of G k−1 [−1] = G k−2 is ε-close with ε = c 1 /k.Using the results of Lemmas 11.1, 11.3, and 12.3 we apply Lemma 3.6 to show that (G k * , ϕ) is (c 2 /k)-close for the largest k * ≤ k − 2 which is divisible by 8.According to Lemma 8.1 the map ϕ is orientation preserving on G k−2 [20].So we can use Lemma 3.7 to show that the pair (G k * [20], ϕ) = (G k * +20 , ϕ) is 22δ-close and 22δ < 16.So we can move to the next step of the with (G k * +19 , ϕ); of course k * + 19 is odd and larger than k, actually k * + 19 ≥ k + 10 because k * ≥ k − 9.The last step of the recursion comes when k * + 19 ≥ n and one has to be a bit careful.At this point (G * k , ϕ) is (c 2 /k)-close, and every unit cell is δ = c 1 /k-close.An obvious modification of Lemma 8.1 shows that (G n , ϕ) is orientation preserving.We can apply Lemma 3.7 as explained in Remark 14.1 to show directly that (G n , ϕ) is 22δ-close.In this case, obviously, 22δ = O(n −1 ) and there is no need to carry out the recursion step again.The proof is finished.rearranging the inequality we get n+ m − i > 2mi − i 2 = i (2m − i), so i n + m − i < 1 2m − i implying that n + m n + m − i < 2m − i + 1 2m − i , which shows that n + m − i n + m < 2m − i 2m − i + 1.Here (n + m i)/(n + m) is the slope of L(F , C) and (2 m − i)/(2 m − i + 1) is the slope of L(F , Q).This implies that Q is below the line L(F , C) and therefore L(C, F ) separates the diagonal blocks D i and D i−1 .Similar arguments as before finish the proof namely, that the images of all the diagonal ϕ blocks ϕ(D i ) can be separated by lines parallel to L (ϕ(C), ϕ(C )).
≤ k − 2 which is divisible by 8. Lemma 3.7 shows that the pair in Sect.13.Next we apply Lemma 3.6 to show that (G k * , ϕ) is (c 2 /k)-close for the largest k * and the α • μ −1 image of the square [i ± , j ± ] (G k * +20 , ϕ) is orientation preserving and 16-close (because 22δ < 16), and (G n , ϕ) is well defined.So we can move to the next step of the recursion with (G k * +19 , ϕ).Here of course k * + 19 is odd and larger than k, actually k * ≥ k − 10.In the final step −1 )-close.Claims 12.1 and 12.2 imply that this is true for the points (αk, βk) where α and β are integers in [−8, 8].For concreteness we assume that in every statement with a O(k −1 ) estimate, the statement holds with c 3 /k where c 3 is a constant that depends only on c.In particular, ϕ(αk, βk) − (αk, βk) < c 3 /k for integers α, β ∈ [−8, 8].The proof is based again on a doubling argument (like in Lemmas 3.3 and 11.2) but this time in dimension 2.