I'm trying to do something like this for higher orders.
What I've done is using a code available on internet to generate the Sierpinski points, and then TriangleCenter to obtain the medium points but in a manual way. For l=4, for example, this become very tedious to do manually
sierpinski[{a_, b_, c_}] :=
With[{ab = (a + b)/2, bc = (b + c)/2,
ca = (a + c)/2}, {{a, ab, ca}, {ab, b, bc}, {ca, bc, c}}];
pts = {{0, 0}, {1, 0}, {1/2, Sqrt[3]/2}} // N;
l = 2;
d = Nest[Join @@ sierpinski /@ # &, {pts},
l];
SGg = DeleteDuplicates[Sort[Flatten[d, 1]]];
(*L=1*)
(*MEDIUM={TriangleCenter[{SGg[[1]],SGg[[2]],SGg[[3]]},"Centroid"],\
TriangleCenter[{SGg[[3]],SGg[[5]],SGg[[6]]},"Centroid"],\
TriangleCenter[{SGg[[2]],SGg[[4]],SGg[[5]]},"Centroid"]};*)
(*L=2*)
MEDIUM = {TriangleCenter[{SGg[[1]], SGg[[2]], SGg[[3]]}, "Centroid"],
TriangleCenter[{SGg[[3]], SGg[[5]], SGg[[7]]}, "Centroid"],
TriangleCenter[{SGg[[7]], SGg[[10]], SGg[[12]]}, "Centroid"],
TriangleCenter[{SGg[[14]], SGg[[15]], SGg[[12]]}, "Centroid"],
TriangleCenter[{SGg[[2]], SGg[[4]], SGg[[5]]}, "Centroid"],
TriangleCenter[{SGg[[10]], SGg[[13]], SGg[[14]]}, "Centroid"],
TriangleCenter[{SGg[[4]], SGg[[6]], SGg[[8]]}, "Centroid"],
TriangleCenter[{SGg[[8]], SGg[[11]], SGg[[13]]}, "Centroid"],
TriangleCenter[{SGg[[6]], SGg[[9]], SGg[[11]]}, "Centroid"]};
SG = Union[SGg, MEDIUM];
How could I optimize this?
TriangleCenter[SGg[[{3,5,7}]], "Centroid"]
$\endgroup$TriangleCenter[SGg[[#]], "Centroid"] &/@{{1,2,3},{3,5,7}}
etc. $\endgroup$