

![0_image_0.png](0_image_0.png)

The first ingredient of the algorithm is a detection of complete turns. We define turnm(*i, j, k*) iff i + j + k ∈
{−1, 0, 1}, if both i and j are odd
{0}, otherwise This definition determines complete turns in the following sense:
Proposition 2 1. turnm(i, j, k) iff ∃α ∈ [i]m, β ∈ [j]m, γ ∈ [k]m . α+β +γ = 0 2. turnm(i, j, k)*implies that for any choice of one of the three angles in its interval,*
a suitable choice for the other two exists such that all three add up to 0.

Recall that angles are normalized into ] − *π, π*].

Proof. We prove the first statement by a case distinction. Case 1: both i and j are even.

This means that [i]m = {2π i 4m } and [j]m = {2π j 4m }. Hence,
∃α ∈ [i]m, β ∈ [j]m, γ ∈ [k]m . α + β + γ = 0 iff ∃γ ∈ [k]m . 2π i+j 4m + γ = 0 iff i + j + k = 0 iff turnm(*i, j, k*)
Case 2: i is odd and j is even. This means that [i]m =]2π i−1 4m , 2π i+1 4m [ and [j]m =
{2π j 4m }. Hence,
∃α ∈ [i]m, β ∈ [j]m, γ ∈ [k]m . α + β + γ = 0 iff ∃γ ∈ [k]m . − 2π j 4m − γ ∈]2π i−1 4m , 2π i+1 4m [
iff ∃γ ∈ [k]m . γ ∈]2π
−i−j−1 4m , 2π
−i−j+1 4m [
iff ∃γ ∈ [k]m . γ ∈ [−i − j]m iff k = −i − j iff turnm(*i, j, k*)
Case 3: i is even and j is odd: analogous to case 2.