In this video, she mentions that these patterns are 2-colorable (or at least conjectures that) I want to make a knitting pattern out of these, and while I have managed to figure out the lines defining the regions with careful dashing and line placements, I don't know how to color the map besides just making it and then into paint with the bucket tool. Is there any sort of map coloring function that I could use to avoid having to do it manually?
An example input and output to this hypothetical function are below. The thinner, more dashed lines should be ignored for the purposes of the map coloring.
Edit: On request, the code used to generate this:
UnitSize = 15 ;
VerticalON[loc_, hmesslen_] := {
AbsoluteDashing[2], Line[{
Offset[{UnitSize*loc, 0}, {0, 0}],
Offset[{UnitSize*loc, UnitSize*(hmesslen)}, {0, 0}]
}],
AbsoluteThickness[2], AbsoluteDashing[UnitSize], Line[{
Offset[{UnitSize*loc, 0}, {0, 0}],
Offset[{UnitSize*loc, UnitSize*(hmesslen)}, {0, 0}]
}]
}
VerticalOFF[loc_, hmesslen_] := {
AbsoluteDashing[2], Line[{
Offset[{UnitSize*loc, 0}, {0, 0}],
Offset[{UnitSize*loc, UnitSize*(hmesslen)}, {0, 0}]
}],
AbsoluteThickness[2], AbsoluteDashing[UnitSize], Line[{
Offset[{UnitSize*loc, UnitSize}, {0, 0}],
Offset[{UnitSize*loc, UnitSize*(hmesslen)}, {0, 0}]
}]
}
HorizON[loc_, vmesslen_] := {
AbsoluteDashing[2], Line[{
Offset[{0, UnitSize*loc}, {0, 0}],
Offset[{UnitSize*(vmesslen), UnitSize*loc}, {0, 0}]
}],
AbsoluteThickness[2], AbsoluteDashing[UnitSize], Line[{
Offset[{0, UnitSize*loc}, {0, 0}],
Offset[{UnitSize*(vmesslen), UnitSize*loc}, {0, 0}]
}]
}
HorizOFF[loc_, vmesslen_] := {
AbsoluteDashing[2], Line[{
Offset[{0, UnitSize*loc}, {0, 0}],
Offset[{UnitSize*(vmesslen), UnitSize*loc}, {0, 0}]
}],
AbsoluteThickness[2], AbsoluteDashing[UnitSize], Line[{
Offset[{UnitSize, UnitSize*loc}, {0, 0}],
Offset[{UnitSize*(vmesslen), UnitSize*loc}, {0, 0}]
}]
}
ToBinary[mess_] := Flatten[IntegerDigits[ToCharacterCode[mess], 2, 8]]
Hitomezashi[hmess_, vmess_] := Graphics[{
FaceForm[], EdgeForm[AbsoluteThickness[3]],
Rectangle[{0, 0},
Offset[{UnitSize*Length[ToBinary[hmess]],
UnitSize*Length[ToBinary[vmess]]}, {0, 0}]],
Table[
If[
ToBinary[hmess][[i]] == 1,
VerticalON[
i - 1,
Length[ToBinary[vmess]]
],
VerticalOFF[
i - 1,
Length[ToBinary[vmess]]
]],
{i, 1, Length[ToBinary[hmess]]}]
,
Table[
If[
ToBinary[vmess][[i]] == 1,
HorizON[
i - 1,
Length[ToBinary[hmess]]
],
HorizOFF[
i - 1,
Length[ToBinary[hmess]]]],
{i, 1, Length[ToBinary[vmess]]}]
}, PlotRange -> Full,
ImageSize -> {UnitSize*(Length[ToBinary[vmess]] + 1/4),
UnitSize*(Length[ToBinary[hmess]] + 1/4)}]
(*Messages defining bottom and up the side*)
bottom = "ACE";
side = "ACE";
(*Knitting Gauge to estimate final size*)
VertGauge = Quantity[6, IndependentUnit["Rows"]/("Inches")];
HoriGauge = Quantity[5, IndependentUnit["Stitches"]/("Inches")];
(*Calculations*)
Stitches =
Quantity[Length[ToBinary[bottom]], IndependentUnit["Stitches"]];
Rows = Quantity[Length[ToBinary[side]], IndependentUnit["Rows"]];
StringForm["Design is `1`/`2` wide, and `3`/`4` long", Stitches,
N[ Stitches/HoriGauge], Rows, N[Rows/VertGauge]]
(*Design Chart*)
Hitomezashi[bottom, side]