Thick and thin

Mostly math with Robert

Generating Jordan, 5

There is a Jordan curve such that every piecewise-linear path from the inside to the outside intersects the curve infinitely many times. I define the wiggling precisely here in terms of courses (turn-type sequences).

Local wiggling to triples

Last time I described the local picture of a wiggled hex curve. That is, given a hex curve γ\gamma and a triangle TT with a turn of γ,\gamma, I described what f(γ)Tf(\gamma) \cap T looks like, and gave a picture of this. Our task now is to draw a hex curve wiggled several times.

Our preferred representation of a hex curve is its course, i.e. its sequence of turn-types. The local picture in a triangle always wiggles to three oriented components, yielding three courses. We want to specify triples of courses of the sort one gets by taking the courses of such unions of oriented components in a sequence of consecutively adjacent triangles.

More specifically, let us say an (intermediate) triple is a triple of courses trp=(μ,υ,κ)trp = (\mu, \upsilon, \kappa) such that for some triangles t0t_0 and tνt_\nu (possibly the same), + μ\mu beginning at t0,3At_{0,3}^A ends at t0,4A;t_{0,4}^A; + υ\upsilon beginning at t0,5At_{0,5}^A ends at tν,3F;t_{\nu,3}^F; and + κ\kappa beginning at tν,4Ft_{\nu,4}^F ends at tν,5F.t_{\nu,5}^F. Fixing t0t_0 and a bend in t0t_0 determines tν.t_\nu.

In the previous post we worked out what these triples were for f(γ)tf(\gamma) \cap t when tt contained a port turn. As in that post, we label the components of f(γ)tf(\gamma) \cap t variously Mt,M_t, Yt,Y_t, and Ct.C_t. Recall that

  • MM starts from t3At_3^A with course PSPSSSSPSPS,PSPSSSSPSPS, and thus ends at t4A;t_4^A;
  • YY starts from t5At_5^A with course PSPSPSPPSPS,PSPSPSPPSPS, and thus ends at t3F;t_3^F; and finally,
  • CC starts from t4Ft_4^F with course PSPSSPSPSPSPPPPSPSPSPSPPSPS,PSPSSPSPSPSPPPPSPSPSPSPPSPS, and thus ends at t5F.t_5^F.

We express this in Python as follows:

P_becomes = ("PSPSSSSPSPS","PSPSPSPPSPS","PSPSSPSPSPSPPPPSPSPSPSPPSPS")

Suppose we follow that port turn in a triangle tt with a starboard turn in another triangle t.t'. For the starboard turn in t,t', we get the following, mutatis mutandis:

  • MM starts from t3A{t'}_3^A with course PSPSSPSPSPSPSSSSPSPSPSPPSPS,PSPSSPSPSPSPSSSSPSPSPSPPSPS, and thus ends at t4A;{t'}_4^A;
  • YY starts from t5A{t'}_5^A with course PSPSSPSPSPS,PSPSSPSPSPS, and thus ends at t3F;{t'}_3^F; and finally,
  • CC starts from t4F{t'}_4^F with course PSPSPPPPSPS,PSPSPPPPSPS, and thus ends at t5F.{t'}_5^F.

(The ordering of triangles along the given sides of tt' are also from port to starboard.) We can express this likewise in Python as follows:

S_becomes = ("PSPSSPSPSPSPSSSSPSPSPSPPSPS","PSPSSPSPSPS","PSPSPPPPSPS")

(The reader may check that if PbP_b is the former triple shown and SbS_b the latter, then these triples are related by flip(Pb)=Sb,flip(P_b) = S_b, where the function flipflip reverses each string in the triple, swaps PP with SS and vice versa, and reverses the triple, as in the following code.)

def flip(trp):
    lst = list(trp)
    lst = [list(reversed(path)) for path in lst]
    swap = lambda tok: "P" if tok == "S" else "S"
    lst = [[swap(tok) for tok in path] for path in lst]
    return tuple(reversed(lst))

Thus the following statements hold: + MtM_t intersects no components of f(γ)t;f(\gamma) \cap t'; + CtC_{t'} intersects no components of f(γ)t;f(\gamma) \cap t; + YtY_t ends at t3F;t_3^F; + MtM_{t'} begins at t3A{t'}_3^A and ends at t4A;{t'}_4^A; + CtC_t begins at t4Ft_4^F and ends at t5F;t_5^F; and finally, + YtY_{t'} begins at t5A.{t'}_5^A.

Joining triples

The union of all these components in the union ttt \cup t' therefore again has three oriented components. Two components have not been fitted together with others. The first is the MM component of f(γ)t.f(\gamma) \cap t. The latter is the CC component of f(γ)t.f(\gamma) \cap t'. Finally, the middle component is composed of the four other components. Considering the components as oriented arcs, and labelling them M,Y,CM,Y,C in tt and M,Y,CM',Y',C' in tt' in that order, we have that f(γ)(tt)f(\gamma) \cap (t \cup t') is also the union of three oriented components, to wit M,Y*M*C*Y,CM, Y\ast M' \ast C \ast Y', C' in that order.

The same incidence relations hold, with different courses, when following port with port, starboard with port, or starboard with starboard. Port to starboard and starboard to starboard are depicted in the following figure.

Joining the components together.

Thus, if trp=(M,Y,C)trp = (M, Y, C) and trp=(M,Y,C)trp' = (M', Y', C') are two intermediate triples, we define their join trp*trptrp \ast trp' to be (M,Y*M*C*Y,C).(M, Y\ast M' \ast C \ast Y', C').

def join(trp0, trp1):
    (m, y, c) = trp0
    (mp,yp,cp) = trp1
    return (m, y+mp+c+yp, cp)

Wiggling a course

Let Tok={P,S}.Tok = \{P,S\}. Let Tok*Tok^\ast be the set of courses. Following the above, we define the function wgl:TokTok*×Tok*×Tok*wgl: Tok \to Tok^\ast \times Tok^\ast \times Tok^\ast as follows:

wgl(P)=(PSPSSSSPSPS,PSPSPSPPSPS,PSPSSPSPSPSPPPPSPSPSPSPPSPS),\begin{multline} wgl(P) = (PSPSSSSPSPS, PSPSPSPPSPS, \\ PSPSSPSPSPSPPPPSPSPSPSPPSPS), \end{multline}

wgl(S)=(PSPSSPSPSPSPSSSSPSPSPSPPSPS,PSPSSPSPSPS,PSPSPPPPSPS),\begin{multline} wgl(S) = (PSPSSPSPSPSPSSSSPSPSPSPPSPS, \\ PSPSSPSPSPS, PSPSPPPPSPS), \end{multline}

so that wgl(S)=flip(wgl(P)).wgl(S) = flip(wgl(P)). Then, given a course Γ=k0k1kn1\Gamma = k_0 k_1 \cdots k_{n-1} (with kiTokk_i \in Tok), we define wiggle(Γ)=wgl(k0)*wgl(k1)**wgl(kn1).wiggle(\Gamma) = wgl(k_0) \ast wgl(k_1) \ast \cdots \ast wgl(k_{n-1}). (This is well-defined since wglwgl is associative.)

With this definition we have almost determined the course of f(γ)f(\gamma) given the course Γ\Gamma of γ.\gamma. The above gives us that f(γ)f(\gamma) is the union of three hex curves whose three courses are those in the triple wiggle(Γ).wiggle(\Gamma). It remains to determine how to join these courses. Now, wiggle(Γ)wiggle(\Gamma) is a triple (MM,YY,CC)(MM, YY, CC) beginning in some triangle tt and ending in some triangle T.T. Assuming Γ\Gamma is the course of a closed hex curve, likewise wiggle(Γ)wiggle(\Gamma) is too. Thus the aft side of tt and the fore side of TT coincide. So tiAt_i^A and TiFT_i^F coincide along these sides for i{3,4,5}.i \in \{3,4,5\}. Now, YYYY ends at T3FT_3^F and MMMM begins at t3A;t_3^A; MMMM ends at t4At_4^A and CCCC begins at T4F;T_4^F; and finally CCCC ends at T5FT_5^F and YYYY begins at t5A.t_5^A. Thus the complete course of f(γ)f(\gamma) is YY*MM*CC.YY\ast MM\ast CC.

def wiggle(tokens):
    trps = map(lambda tok: P_becomes if tok == 'P' else S_becomes, tokens)
    tot = trps.__next__()
    for trp in trps:
        tot = join(tot,trp)
    (MM,YY,CC) = tot
    return YY + MM + CC