Truchet tilings are a nice-and-easy piece of mathematical art based on a square tile bearing a pattern that does not have rotational symmetry. My favorite version is the one based on quarter-circles:
Old code (ca. version 4) I had for making these tilings used to be quite long (due to the need to make explicit polygons, and then rotating and translating them all over the plane), but the current crop of new functionality (like ) inspired me to see if I can make a simpler version. The result is nicely compact:
With[{n=20(*numberoftiles*),​​h=1/8(*widthofannulus*)},Graphics[{ColorData[97,3],GeometricTransformation[{Annulus[{-1/2,1/2},{1/2-h,1/2+h},{-Pi/2,0}],Annulus[{1/2,-1/2},{1/2-h,1/2+h},{Pi/2,Pi}]},Map[{RotationMatrix[RandomInteger[]Pi/2],#}&,Flatten[CoordinateBoundsArray[{{0,n},{0,n}},1,Center],1]]]}]]
Slightly more recently, I also put up code for the 3D version of the Truchet tile in the chatroom for Mathematica Stack Exchange. This time, the tiling is based on a cube with quarter-sections of tori:
The code for this one is not as simple, because I needed to use
BSplineCurve
to make quarter-circles in 3D (using a representation due to Piegl and Tiller), which were subsequently converted to torus sections using
Tube
. Nevertheless, the code is still of reasonable length, and the result is quite striking:
With[{n=5(*numberoftiles*),​​r=1/8(*tuberadiusoftori*)},cell=With[{bsopts=Sequence[SplineDegree->2,SplineKnots->{0,0,0,1,1,1},SplineWeights->{1,1/Sqrt[2],1}]},{CapForm[None],Tube[BSplineCurve[#,bsopts],r]&/@{{{-1/2,0,0},{0,0,0},{0,-1/2,0}},{{0,0,1/2},{0,0,0},{0,1/2,0}},{{0,0,-1/2},{0,0,0},{1/2,0,0}}}}];​​Graphics3D[{Directive[Specularity[0.4,12],ColorData[97,3]],GeometricTransformation[cell,{RotationMatrix[RandomChoice[Range[0,3]Pi/2],RandomChoice[IdentityMatrix[3]]],#}&/@Flatten[CoordinateBoundsArray[ConstantArray[{0,n},3],1,Center],2]]},Boxed->False,Lighting->"Neutral"]]

CITE THIS NOTEBOOK

On random Truchet tilings​
by J. M.​
Wolfram Community, STAFF PICKS, June 30, 2022
​https://community.wolfram.com/groups/-/m/t/2560978