Edit
Since TernaryListPlot
is new in 13.1 version,for old version,we use ternary[{p1_, p2_, p3_}] = {p1 + 1/2 p2, Sqrt[3]/2 p2};
to translate the ternary-coordinate to normal Cartesian coordinate and do the same thing.
Clear[n, m1, m2, m3, pts1, pts2, pts3, ternary];
(* for all versions *)
n = 19;
m1[k_][{x_, y_, z_}] = {x, y + k, n - (x + y + k)};
m2[k_][{x_, y_, z_}] = {x + k, y, n - (x + k + y)};
m3[k_][{x_, y_, z_}] = {n - (y + k + z), y + k, z};
pts1 = ComposeList[{m1[6], m3[-3], m1[7], m3[-5], m2[1], m3[7],
m1[-7], m3[2], m1[9], m3[-4], m2[1], m3[6], m1[-17], m3[-1]},
m2[1]@{0, 0, 1}];
pts2 = ComposeList[{m1[1], m3[1], m2[-1], m3[-2]}, pts1[[8]]];
pts3 = ComposeList[{m1[8], m3[1], m1[-9], m2[1]}, pts2[[3]]];
{pts1, pts2, pts3} = {pts1/n, pts2/n, pts3/n};
ternary[{p1_, p2_, p3_}] = {p1 + 1/2 p2, Sqrt[3]/2 p2};
Graphics[{EdgeForm[{AbsoluteThickness[2], White}], Red,
Polygon /@ Map[ternary, {pts1, pts2, pts3}, {2}], Yellow,
Polygon /@ Map[ternary@RotateLeft[#, 1] &, {pts1, pts2, pts3}, {2}],
Green, Polygon /@
Map[ternary@RotateLeft[#, 2] &, {pts1, pts2, pts3}, {2}]}]
Original
We use TernaryListPlot
and define three transformations m1,m2,m3
to move the point parallel to the three edges respectively.
Clear[n, m1, m2, m3, pts1, pts2, pts3];
n = 19;
m1[k_][{x_, y_, z_}] = {x, y + k, n - (x + y + k)};
m2[k_][{x_, y_, z_}] = {x + k, y, n - (x + k + y)};
m3[k_][{x_, y_, z_}] = {n - (y + k + z), y + k, z};
pts1 = ComposeList[{m1[6], m3[-3], m1[7], m3[-5], m2[1], m3[7],
m1[-7], m3[2], m1[9], m3[-4], m2[1], m3[6], m1[-17], m3[-1]},
m2[1]@{0, 0, 1}];
pts2 = ComposeList[{m1[1], m3[1], m2[-1], m3[-2]}, pts1[[8]]];
pts3 = ComposeList[{m1[8], m3[1], m1[-9], m2[1]}, pts2[[3]]];
(* TernaryListPlot[{pts1, pts2, pts3}, Joined -> True] *)
TernaryListPlot[{pts1, pts2, pts3}, Frame -> False, PlotStyle -> None,
GridLines -> {Subdivide[0, 1, n]}, GridLinesStyle -> Gray,
Prolog -> {EdgeForm[{Thick, White}], Red,
Polygon /@ {pts1, pts2, pts3}, Yellow,
Polygon /@ Map[RotateLeft, {pts1, pts2, pts3}, {2}], Green,
Polygon /@ Map[RotateLeft[#, 2] &, {pts1, pts2, pts3}, {2}]}]
TernaryListPlot[{}, Frame -> False,
Epilog -> {EdgeForm[{Thick, White}], Darker@Green, Polygon[pts1],
Polygon@pts2, Polygon@pts3, Polygon[RotateLeft /@ pts1],
Polygon[RotateLeft /@ pts2], Polygon[RotateLeft /@ pts3],
Polygon[RotateLeft /@ pts1], Polygon[RotateLeft /@ pts2],
Polygon[RotateLeft /@ pts3], Polygon[RotateLeft[#, 2] & /@ pts1],
Polygon[RotateLeft[#, 2] & /@ pts2],
Polygon[RotateLeft[#, 2] & /@ pts3]}] /.
Line[pts_] :> {White, Line[pts]}
Appendix
I also test AnglePath
,but it seems it is not easy to find the rotation center.
n = 19;
Graphics[
Line[AnglePath[{{6/n, π/3}, {3/n, -2 π/3}, {7/n,
2 π/3}, {5/n, -2 π/3}, {1/n, π/3}, {7/n,
2 π/3}, {7/n,
2 π/3}, {2/n, -2 π/3}, {9/n, -π/3}, {4/
n, -2 π/3}, {1/n, π/3}, {6/n, 2 π/3}, {17/n,
2 π/3}, {1/n, π/3}}]]]