Message Boards Message Boards

10
|
13311 Views
|
2 Replies
|
13 Total Likes
View groups...
Share
Share this post:

Glyph Frieze Patterns

Posted 8 years ago

Frieze patterns overlap art and math. The design of the base tile in a frieze pattern is artistic, while its repetition can be defined mathematically. This makes frieze patterns a good candidate for exploration with the Wolfram Language.

The bit of code below creates random frieze patterns from font glyphs. I chose sixteen asymmetric glyphs. Others would work, but they should be asymmetric to avoid double symmetries. Here is what the code does:

  • randomly select one of the glyphs
  • create a random dark color
  • randomly rotate the glyph by 45° angles
  • crop any excess background
  • tile it according to one of the seven frieze patterns

There are 896 possible patterns, not counting the color variations. The results are often startling. Here are a few:

[screen shot] [screen shot] [screen shot] [screen shot]

This suited my need as a small part of a larger project, a sort of school-house trivia game called Chicken Scratch. The questions must have a fair amount of randomness so the students reason rather than memorizing answers. For this question, the game presents the frieze pattern and the players choose from the names of four geometric definitions.

The Wolfram Demonstrations Project does have a half-dozen or so demonstrations for exploring frieze patterns. This is the first I've seen that uses glyphs for the base tile design. Though I could turn this into a demonstration, I need to focus on Chicken Scratch. Feel free to use this code however you want.

color1 = RGBColor[Table[RandomReal[.6], 3]];
symbol = RandomChoice[{9873, 9730, 38, 9816, 163, 9758, 8730, 8950, 
    11001, 10729, 10771, 9736, 10000, 9799, 9732, 8623}];
stamp = ImageCrop[
   ImageRotate[
    Rasterize[
     Graphics[{color1, 
       Style[Text[FromCharacterCode[symbol]], 200]}]], (
    RandomInteger[7] \[Pi])/8, Background -> White]];
width = ImageDimensions[stamp][[1]];
frieze = Switch[RandomInteger[{1, 7}],
   1, ImageAssemble[Table[stamp, 12]],
   2,
   top = ImageAssemble[Table[stamp, 12]];
   bot = ImageAssemble[Flatten[{
       ImageRotate[ImageCrop[stamp, {width/2, Full}, Right], \[Pi]],
       Table[ImageRotate[stamp, \[Pi]], 11],
       ImageRotate[
        ImageCrop[stamp, {width/2, Full}, Left], \[Pi]]}]];
   imgLst = ConformImages[{top, bot}];
   ImageAssemble[{{imgLst[[1]]}, {imgLst[[2]]}}],
   3,
   top = ImageAssemble[Table[stamp, 12]];
   bot = ImageAssemble[Flatten[{
       ImageReflect[ImageCrop[stamp, {width/2, Full}, Left]],
       Table[ImageReflect[stamp], 11],
       ImageReflect[ImageCrop[stamp, {width/2, Full}, Right]]}]];
   imgLst = ConformImages[{top, bot}];
   ImageAssemble[{{imgLst[[1]]}, {imgLst[[2]]}}],
   4, ImageAssemble[
    Riffle[Table[stamp, 6], Table[ImageReflect[stamp, Left], 6]]],
   5, ImageAssemble[{Table[stamp, 12], 
     Table[ImageReflect[stamp], 12]}],
   6, ImageAssemble[{Riffle[Table[stamp, 6], 
      Table[ImageReflect[stamp, Left], 6]], 
     Riffle[Table[ImageReflect[stamp, Left], 6], Table[stamp, 6]]}],
   7, ImageAssemble[{Riffle[Table[stamp, 6], 
      Table[ImageReflect[stamp, Left], 6]], 
     Riffle[Table[stamp, 6], Table[ImageReflect[stamp, Left], 6]]}]];
pic = Image[frieze, ImageSize -> {{800}, {100}}]

You may have noticed that my code relies on procedural programming constructs like switch and if. I have only been using the Wolfram Language for about a year. I'm grateful that the Wolfram Language allows me to use procedural techniques while I learn how to write more elegant function-based code.

Oh, there is a possibility that some of the glyphs won't work on your system because they rely on what fonts you have on your machine. If that's the case, replace the character codes with ones that you do have.

POSTED BY: Mark Greenberg
2 Replies

enter image description here - Congratulations! This post is now a Staff Pick! Thank you for your wonderful contributions. Please, keep them coming!

POSTED BY: EDITORIAL BOARD

Those are really nice looking!

These actually remind me of this: Behind the Scenes at the National Museum of Mathematics Meta-Logo

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract