Langlet Transforms of 2X2 Block Replacement L-Systems
Total Page:16
File Type:pdf, Size:1020Kb
Langlet Transforms of 2x2 Block Replacement L- Systems Stuart Smith [email protected]
Introduction This paper illustrates the application of Gérard Langlet’s Helix transform [1][2][3] to a collection of interesting L-system patterns created by Mark Dow [4]. The results may suggest possible uses for the transform, which at this point is not widely known or understood. This paper is intended to provide readers with the tools necessary to experiment with Langlet’s ideas themselves. In order to generate and manipulate images like those presented here, it will be necessary to have Matlab as well as the following: http://www.cs.uml.edu/~stu/Langlet Toolkit.zip http://www.cs.uml.edu/~stu/Langlet Toolkit Manual.doc http://www.cs.uml.edu/~stu/L_system_tiling_1-7-14.zip The Langlet Toolkit contains Matlab functions that implement all of the operations discussed in Langlet’s papers on his computational system, and the L_system_tiling package contains Dow’s powerful block replacement image generation and analysis programs. To use all of the features of this package it will also be necessary to have the Matlab Image Processing Toolbox; however, this toolbox is not necessary for the work described here.1
The Helix Transform As presented here, the Helix transform is a tool to decompose a complex binary image into a set of “elementary” binary images, in much the same manner as the Fourier and Walsh-Hadamard transforms do with real images. But unlike these transforms, the Helix transform is not orthogonal; however, it is its own inverse.
The Helix transform can be computed in several different ways. Langlet described the original version in [1], and subsequently published others. The Langlet Toolkit contains functions to compute one- and two-dimensional Helix transforms. All of these are described in the Langlet Toolkit Manual, and, of course, one can study the Matlab code to see how the transforms are computed.
Helical Transforms of 2x2 Block Replacement L-Systems Dow’s 2x2 block replacement L-systems are classified here according to a somewhat arbitrary ordering based on the complexity of the replacement rules required to produce their Helix transforms. Other orderings, such as one based on the visual similarity of the transforms, could be used. The names used to designate each of the original patterns are taken from [4].
1 For use without the Image Processing Toolbox, set the following variables in L_system_tiling to 0: bShowResults, bDrawSymmGraph, bAverageAfterReplacement, bNormalizePattern, and bNormalizeAverage. The images below are presented in pairs. In each pair, Dow’s pattern is on the left, Langlet’s Helix transform of the pattern is on the right. All of the images are 128x128 pixels. Below each pair of figures are Matlab statements that use Dow’s Matlab L_system_tiling package to generate an instance of the original system (“X”) and its Helix transform (“Xh”), respectively. logN is the base-2 logarithm of the length of the side of the square image matrices. The array arguments are the bitmaps for the block replacement rules. The original images and their Helix transforms are all binary, that is, they have only two colors, conventionally taken to be black and white; however, to generate a Helix transform image by 2x2 block replacement, it is often necessary to use a set of blocks involving as many as four different colors. In such cases, all non-black pixels are replaced with white pixels in the final transformed image. Xh can also be obtained by directly applying the 2D Helix transform, i.e., Xh = hel2( X ).
I. Systems That Require No Sign-bit Correction Or Odd/Even logN Correction The Sierpinski Right Triangle,Diagonal Line, and Edge Line systems are the only ones whose Helix transforms can be generated from just two block replacement rules: one all- zeroes rule and one two-color rule. The two-color rule of the original system is the Helix transform of the two-color rule of the Helix transform, and vice versa.
Sierpinski Right Triangle System The Sierpinski Right Triangle is Langlet’s G matrix, whose transform is I (i.e., the identity matrix).
X = L_system_tiling( 'SRTS', logN, 2, 1, 0, '', 1, [0 0; 0 0], [1 1; 1 0] ); Xh = L_system_tiling( 'SRTSh', logN, 2, 1, 0, '', 1, [0 0; 0 0], [1 0; 0 1] );
Diagonal Line System The transform is the Sierpinski Right Triangle (i.e., Langlet’s G matrix).
X = L_system_tiling( 'DLS', logN, 2, 1, 0, '', 1, [0 0; 0 0], [1 0; 0 1] ); Xh = L_system_tiling( 'DLSh', logN, 2, 1, 0, '', 1, [0 0; 0 0], [1 1; 1 0] ); Edge Line System The original pattern is a complete stripe of all 1’s in the leftmost column. The transform is a complete stripe of all 1’s in the top row.
X = L_system_tiling( 'ELS', logN, 2, 1, 0, '', 1, [0 0; 0 0], [1 0; 1 0] ); Xh = L_system_tiling( 'ELSh', logN, 2, 1, 0, '', 1, [0 0; 0 0], [1 1; 0 0] );
The next more complex group, the Helix transforms of the Corner Periodic, Checkerboard, and Stripes systems, requires three block replacement rules: two all-zeroes rules and one three-color rule.
Corner Periodic System The transform has a small reversed “L” of 1’s at (1,0), (1,1), and (0,1).
X = L_system_tiling( 'CPS', logN, 2, 1, 0, '', 0, [1 1; 1 0], [1 1; 1 0] ); Xh = L_system_tiling( 'CPSh', logN, 3, 1, 0, '', 1, [0 0; 0 0], [1 0; 0 2], [0 0; 0 0] );
Checkerboard System The transform has a small upside-down “L” of 1’s at (0,1), (0,0) and (1,0).
X = L_system_tiling( 'CS', logN, 2, 1, 0, '', 0, [1 0; 0 1], [1 0; 0 1] ); Xh = L_system_tiling( 'CSh', logN, 3, 1, 0, '', 1, [0 0; 0 0], [1 2; 2 0], [0 0; 0 0] );
Stripes System The transform has 1’s only at (0,0) and (0,1).
X = L_system_tiling( 'SS', logN, 2, 1, 0, '', 0, [1 1; 0 0], [1 1; 0 0] ); Xh = L_system_tiling( 'SSh', logN, 3, 1, 0, '', 1, [0 0; 0 0], [1 0; 2 0], [0 0; 0 0] );
The next group, the Helix transforms of the Thue-Morse Line and the Thue-Morse systems, requires three block replacement rules: one all-zeroes rule, one three-color rule, and one two-color rule.
Thue-Morse Line System The transform has 1’s only in the first row.
X = L_system_tiling( 'TMLS', logN, 2, 1, 0, '', 1, [0 1; 0 1], [1 0; 1 0] ); Xh = L_system_tiling( 'TMLSh', logN, 3, 1, 0, '', 1, [0 0; 0 0], [1 2; 0 0], [2 0; 0 0]);
Thue-Morse System The transform has 1’s only at positions 0, 1, 2, 4, … in each row and column.
X = L_system_tiling( 'TMS', logN, 2, 1, 0, '', 1, [0 1; 1 0], [1 0; 0 1] ); Xh = L_system_tiling( 'TMSh', logN, 3, 1, 0, '', 1, [0 0; 0 0], [1 2; 2 0], [2 0; 0 0] );
The final group in this category, the Helix transforms of the Diagonal Corner Swap and Corner Diagonal Swap systems, requires four block replacement rules: one all-zeros rule, two three-color rules, and one two-color rule.
Diagonal Corner Swap System
X = L_system_tiling( 'DCSS', logN, 2, 1, 0, '', 0, [1 0; 0 1], [1 1; 1 0] ); Xh = L_system_tiling( 'DCSSh', logN, 4, 1, 0, '', 1, [0 0; 0 0], [3 2; 2 0], [0 2; 2 2], [3 0; 0 2] );
Corner Diagonal Swap System
X = L_system_tiling( 'CDSS', logN, 2, 1, 0, '', 0, [1 1; 1 0], [1 0; 0 1] ); Xh = L_system_tiling( 'CDSSh', logN, 4, 1, 0, '', 1, [0 0; 0 0], [3 0; 0 2], [0 2; 2 2], [3 2; 2 0] );
II. Systems That Require Only A Fixed Sign-bit Correction The Helix transforms obtained by block replacement in this group must be “corrected” by setting the “sign bit” (i.e., the pixel in the upper left corner) to 1. All of the Helix transforms in this group require three block replacement rules.
Hadamard Matrix System The transform has a 1 at (0,0) in addition to the powers-of-2 positions.
X = L_system_tiling( 'HMS', logN, 2, 1, 0, '', 0, [0 0; 0 1], [1 1; 1 0] ); Xh = L_system_tiling( 'HMSh', logN, 3, 1, 0, '', 1, [0 0; 0 0], [1 0; 0 2], [2 0; 0 0] ); Xh( 1 , 1 ) = 0 ;
Corner Rotate System X = L_system_tiling( 'CRS', logN, 2, 1, 0, '', 0, [0 0; 0 1], [1 0; 0 0] ); Xh = L_system_tiling( 'CRSh', logN, 3, 1, 0, '', 1, [0 0; 0 0], [1 0; 0 2], [2 2; 2 0]); Xh( 1 , 1 ) = 0 ;
Corner Diagonal System
X = L_system_tiling( 'CDS', logN, 2, 1, 0, '', 0, [0 0; 0 1], [0 1; 1 0] ); Xh = L_system_tiling( 'CDSh', logN, 3, 1, 0, '', 1, [0 0; 0 0], [1 0; 0 2], [0 2; 2 2] ); Xh( 1 , 1 ) = 0 ;
Diagonal Corner System
X = L_system_tiling( 'DCS', logN, 2, 1, 0, '', 0, [0 1; 1 0], [0 0; 0 1] ); Xh = L_system_tiling( 'DCSh', logN, 3, 1, 0, '', 1, [0 0; 0 0], [1 2; 2 0], [0 2; 2 2] ); Xh( 1 , 1 ) = 0 ; Corner Cross System The transform is the complement of the Diagonal Corner Cross Swap system’s.
X = L_system_tiling( 'CCS', logN, 2, 1, 0, '', 0, [0 0; 0 1], [1 0; 0 1] ); Xh = L_system_tiling( 'CCSh', logN, 3, 1, 0, '', 1, [0 0; 0 0], [1 0; 0 2], [2 2; 2 2] ); Xh( 1 , 1 ) = 0 ;
Diagonal Corner Cross Swap System The transform is the complement of the Corner Cross system’s.
X = L_system_tiling( 'DCCSS', logN, 2, 1, 0, '', 0, [0 1; 1 0], [1 1; 1 0] ); Xh = L_system_tiling( 'DCCSSh', logN, 3, 1, 0, '', 1, [0 0; 0 0], [1 2; 2 0], [2 2; 2 2] ); Xh( 1 , 1 ) = 0 ;
Corner Rotate Inverse System
X = L_system_tiling( 'CRIS', logN, 2, 1, 0, '', 0, [0 0; 1 0], [1 0; 1 1] ); Xh = L_system_tiling( 'CRISh', logN, 3, 1, 0, '', 1, [0 0; 0 0], [1 0; 2 2], [2 2; 2 0] ); Xh( 1 , 1 ) = 0 ; Corner Bar Edge System
X = L_system_tiling( 'CBES', logN, 2, 1, 0, '', 0, [0 0; 0 1], [1 0; 1 0] ); Xh = L_system_tiling( 'CBESh', logN, 3, 1, 0, '', 1, [0 0; 0 0], [1 0; 0 2], [2 2; 0 2] ); Xh( 1 , 1 ) = 0 ;
Bar Bar Cross System
X = L_system_tiling( 'BBCS', logN, 2, 1, 0, '', 0, [0 1; 0 1], [0 0; 1 1] ); Xh = L_system_tiling( 'BBCSh', logN, 3, 1, 0, '', 1, [0 0; 0 0], [1 2; 0 0], [0 2; 2 0] ); Xh( 1 , 1 ) = 0 ;
Corner Mirror Swap System
X = L_system_tiling( 'CMSS', logN, 2, 1, 0, '', 0, [0 1; 1 1], [1 0; 1 1] ); Xh = L_system_tiling( 'CMSSh', logN, 3, 1, 0, '', 1, [0 0; 0 0], [1 2; 2 2], [2 0; 2 0] ); Xh( 1 , 1 ) = 0 ; Corner Mirror Inverse System
X = L_system_tiling( 'CMIS', logN, 2, 1, 0, '', 0, [0 0; 0 1], [1 1; 0 1] ); Xh = L_system_tiling( 'CMISh', logN, 3, 1, 0, '', 1, [0 0; 0 0], [1 0; 0 2], [2 0; 2 0] ); Xh( 1 , 1 ) = 0 ;
Bar Corner Center Swap System The transform is the complemented transpose of the Corner Bar Center system’s.
X = L_system_tiling( 'BCCSS', logN, 2, 1, 0, '', 0, [0 1; 0 1], [1 1; 0 1] ); Xh = L_system_tiling( 'BCCSSh', logN, 3, 1, 0, '', 1, [0 0; 0 0], [1 2; 0 0], [2 2; 2 2] ); Xh( 1 , 1 ) = 0 ;
Corner Bar Center System The transform is the complemented transpose of the Bar Corner Center Swap system’s.
X = L_system_tiling( 'CBCS', logN, 2, 1, 0, '', 0, [0 1; 0 0], [1 1; 0 0] ); Xh = L_system_tiling( 'CBCSh', logN, 3, 1, 0, '', 1, [0 0; 0 0], [1 2; 0 2], [2 2; 2 2] ); Xh( 1 , 1 ) = 0 ; Bar Diagonal System
X = L_system_tiling( 'BDS', logN, 2, 1, 0, '', 0, [0 1; 0 1], [1 0; 0 1] ); Xh = L_system_tiling( 'BDSh', logN, 3, 1, 0, '', 1, [0 0; 0 0], [1 2; 0 0], [2 0; 2 0] ); Xh( 1 , 1 ) = 0 ;
III. Systems That Require Sign-bit Correction Depending on logN The sign bit of the Helix transform for each of the systems in this group must be corrected depending on whether the base-2 logarithm of the length of the side of the system is odd or even: Xh( 1 , 1 ) = mod( logN , 2 ) All of the Helix transforms in this group require four block replacement rules.
Four Corners System
X = L_system_tiling( 'FCS', logN, 2, 1, 0, '', 0, [1 1; 1 1], [0 0; 0 1] ); Xh = L_system_tiling( 'FCSh', logN, 4, 1, 0, '', 1, [0 0; 0 0], [3 0; 0 0], [2 0; 0 2], [1 0; 0 2] ); Xh( 1 , 1 ) = mod( logN , 2 ) ;
Four Diagonal System
X = L_system_tiling( 'FDS', logN, 2, 1, 0, '', 0, [1 1; 1 1], [0 1; 1 0] ); Xh = L_system_tiling( 'FDSh', logN, 4, 1, 0, '', 1, [0 0; 0 0], [2 0; 0 0], [1 3; 3 0], [3 3; 3 0] ); Xh( 1 , 1 ) = mod( logN , 2 ) ; Period-Doubling Diagonal System
X = L_system_tiling( 'PDDS', logN, 2, 1, 0, '', 0, [1 0; 0 1], [0 0; 0 0] ); Xh = L_system_tiling( 'PDDSh', logN, 4, 1, 0, '', 1, [0 0; 0 0], [3 2; 2 0], [2 2; 2 0], [1 0; 0 0] ); Xh( 1 , 1 ) = mod( logN , 2 ) ;
Corner Rotate Swap System
X = L_system_tiling( 'CRSS', logN, 2, 1, 0, '', 0, [1 1; 1 0], [0 1; 1 1] ); Xh = L_system_tiling( 'CRSSh', logN, 4, 1, 0, '', 1, [0 0; 0 0], [3 0; 0 2], [2 2; 2 0], [1 2; 2 2] ); Xh( 1 , 1 ) = mod( logN , 2 ) ;
Corner Repeat System The transform is the complement of the Four Period Doubling system’s.
X = L_system_tiling( 'CRS', logN, 2, 1, 0, '', 0, [1 0; 0 0], [0 0; 0 0] ); Xh = L_system_tiling( 'CRSh', logN, 4, 1, 0, '', 1, [0 0; 0 0], [2 3; 3 3], [1 0; 0 0], [3 3; 3 3] ); Xh( 1 , 1 ) = mod( logN , 2 ) ; Four Period Doubling System The transform is the complement of the Corner Repeat system’s.
X = L_system_tiling( 'FPDS', logN, 2, 1, 0, '', 0, [1 1; 1 1], [0 1; 1 1] ); Xh = L_system_tiling( 'FPDSh', logN, 4, 1, 0, '', 1, [0 0; 0 0], [2 0; 0 0], [1 3; 3 3], [3 3; 3 3] ); Xh( 1 , 1 ) = mod( logN , 2 ) ;
Diagonal Corner Cross System The transform is the complement of the Corner Cross Swap system’s.
X = L_system_tiling( 'DCCS', logN, 2, 1, 0, '', 0, [1 0; 0 1], [0 0; 0 1] ); Xh = L_system_tiling( 'DCCSh', logN, 4, 1, 0, '', 1, [0 0; 0 0], [2 3; 3 0], [1 0; 0 3], [3 3; 3 3] ); Xh( 1 , 1 ) = mod( logN , 2 ) ;
Corner Cross Swap System The transform is the complement of the Diagonal Corner Cross system’s.
X = L_system_tiling( 'CCSS', logN, 2, 1, 0, '', 0, [1 1; 1 0], [0 1; 1 0] ); Xh = L_system_tiling( 'CCSSh', logN, 4, 1, 0, '', 1, [0 0; 0 0], [2 0; 0 3], [1 3; 3 0], [3 3; 3 3] ); Xh( 1 , 1 ) = mod( logN , 2 ) ;
Bar Corner Edge System
X = L_system_tiling( 'BCES', logN, 2, 1, 0, '', 0, [1 0; 1 0], [0 1; 0 0] ); Xh = L_system_tiling( 'BCESh', logN, 4, 1, 0, '', 1, [0 0; 0 0], [3 2; 0 0], [2 0; 0 2], [1 2; 0 2] ); Xh( 1 , 1 ) = mod( logN , 2 ) ;
Bar Corner Center System The transform is the complemented transpose of the Corner Bar Center Swap’s.
Corner Bar Center Swap System The transform is the complemented transpose of the Bar Corner Center system’s.
X = L_system_tiling( 'CBCSS', logN, 2, 1, 0, '', 0, [1 0; 1 1], [0 0; 1 1] ); Xh = L_system_tiling( 'CBCSSh', logN, 4, 1, 0, '', 1, [0 0; 0 0], [2 3; 0 3], [1 0; 3 0], [3 3; 3 3] ); Xh( 1 , 1 ) = mod( logN , 2 ) ; Corner Bar Edge Swap System
X = L_system_tiling( 'CBESS', logN, 2, 1, 0, '', 0, [1 1; 1 0], [0 1; 0 1] ); Xh = L_system_tiling( 'CBESSh', logN, 4, 1, 0, '', 1, [0 0; 0 0], [3 0; 0 2], [2 2; 0 2], [1 2; 0 0] ); Xh( 1 , 1 ) = mod( logN , 2 ) ;
Period-Doubling Line System
X = L_system_tiling( 'PDLS', logN, 2, 1, 0, '', 0, [1 0; 1 0], [0 0; 0 0] ); Xh = L_system_tiling( 'PDLSh', logN, 4, 1, 0, '', 1, [0 0; 0 0], [3 2; 0 0], [2 2; 0 0], [1 0; 0 0] ); Xh( 1 , 1 ) = mod( logN , 2 ) ; Double Period-Doubling Line System
X = L_system_tiling( 'DPDLS', logN, 2, 1, 0, '', 0, [1 1; 1 1], [0 1; 0 1] ); Xh = L_system_tiling( 'DPDLSh', logN, 4, 1, 0, '', 1, [0 0; 0 0], [3 0; 0 0], [2 2; 0 0], [1 2; 0 0] ); Xh( 1 , 1 ) = mod( logN , 2 ) ; Corner Mirror Inverse Swap System
X = L_system_tiling( 'CMISS', logN, 2, 1, 0, '', 0, [1 1; 1 0], [0 0; 1 0] ); Xh = L_system_tiling( 'CMISSh', logN, 4, 1, 0, '', 1, [0 0; 0 0], [3 0; 0 2], [2 0; 2 0], [1 0; 2 2] ); Xh( 1 , 1 ) = mod( logN , 2 ) ;
Diagonal Bar System
X = L_system_tiling( 'DBS', logN, 2, 1, 0, '', 0, [1 0; 0 1], [0 1; 0 1] ); Xh = L_system_tiling( 'DBSh', logN, 4, 1, 0, '', 1, [0 0; 0 0], [3 2; 2 0], [2 0; 2 0], [1 2; 0 0] ); Xh( 1 , 1 ) = mod( logN , 2 ) ;
Corner Symmetric Swap System
X = L_system_tiling( 'CSSS', logN ,2, 1, 0, '', 0, [1 0; 1 1], [0 0; 1 0] ); Xh = L_system_tiling( 'CSSSh', logN, 4, 1, 0, '', 1, [0 0; 0 0], [3 2; 0 2], [2 2; 2 0], [1 0; 2 2] ); Xh( 1 , 1 ) = mod( logN , 2 ) ; IV. Systems That Require No Sign-bit Correction But That Require logN To Be Odd Sierpinski Right Triangle Swap System
X = L_system_tiling( 'SRTSS', logN, 2, 1, 0, '', 0, [1 1; 1 0], [0 0; 0 0] ); Xh = L_system_tiling( 'SRTSSh', logN, 4, 1, 0, '', 1, [0 0; 0 0], [3 0; 0 2], [2 0; 0 2], [1 0; 0 0] );
Hadamard Matrix Swap System The transform has a 1 at (0,0) when the length of the side of the matrix is an even power of 2. When the length is an odd power of 2, the complementary pattern is produced.
X = L_system_tiling( 'HMSS', logN, 2, 1, 0, '', 0, [1 1; 1 0], [0 0; 0 1] ); Xh = L_system_tiling( 'HMSSh', logN, 3, 1, 0, '', 1, [0 0; 0 0], [1 0; 0 2], [2 0; 0 0] ); References
[1] Gérard Langlet. Towards the Ultimate APL-TOE. ACM SIGAPL Quote Quad, 23:1, July 1992.
[2] Gérard Langlet. The Axiom Waltz - or When 1+1 make Zero. VECTOR, 11:3.
[3] Gérard Langlet. Paritons and Cognitons: Towards a New Theory of Information. VECTOR, 19:3.
[4] Mark Dow. http://lcni.uoregon.edu/~dow/Geek_art/Simple_recursive_systems/2-D/2x2_2s/2x2_2- symbol_L-systems.html