Tuesday, December 12, 2017

Rotational Symmetry of Order 4

Making Patterns with Rotational Symmetry of Order 4 Using a n by n Grid of Random Shaded Squares

(1) n is even

(n = 12)

gnuplot script:

n = 12
m = n/2
max(x,y) = x>y?x:y
a = 0.875
f(t) = a*0.5*cos(2*pi*t) / max(abs(cos(2*pi*t)), abs(sin(2*pi*t)))
g(t) = a*0.5*sin(2*pi*t) / max(abs(cos(2*pi*t)), abs(sin(2*pi*t)))
funX(i,t) = f(t) + 0.5 + i
funY(j,t) = g(t) + 0.5 + j
set xrange [-m-1:m+1]
set yrange [-m-1:m+1]
unset key
unset tics
unset border
set margins 0,0,0,0
set size ratio -1
set samples 1000
set parametric
set trange [0:1]
Color = "#00cc00"
set style fill solid noborder
set terminal wxt 0 size 600,600 position 0,0 title "n = ".n
seed = ceil(2147483646*rand(time(0)))
random_test = rand((time(0),seed))
set multiplot
do for [i=0:m-1]{
    do for [j=0:m-1]{
        b = rand(0)>0.5?1:0
        if (!b) {continue}
        plot funX(i,t),  funY(j,t) w filledc closed lw 1 lc rgb Color, \
            -funY(j,t),  funX(i,t) w filledc closed lw 1 lc rgb Color, \
            -funX(i,t), -funY(j,t) w filledc closed lw 1 lc rgb Color, \
             funY(j,t), -funX(i,t) w filledc closed lw 1 lc rgb Color
    }
}
unset multiplot


(2) n is odd

(n = 11)

gnuplot script:

n = 11
m = (n+1)/2.
max(x,y) = x>y?x:y
a = 0.875
f(t) = a*0.5*cos(2*pi*t) / max(abs(cos(2*pi*t)), abs(sin(2*pi*t)))
g(t) = a*0.5*sin(2*pi*t) / max(abs(cos(2*pi*t)), abs(sin(2*pi*t)))
funX(i,t) = f(t) + i
funY(j,t) = g(t) + j
set xrange [-n/2.-1:n/2.+1]
set yrange [-n/2.-1:n/2.+1]
unset key
unset tics
unset border
set margins 0,0,0,0
set size ratio -1
set samples 1000
set parametric
set trange [0:1]
Color = "#00cc00"
set style fill solid noborder
set terminal wxt 0 size 600,600 position 0,0 title "n = ".n
seed = ceil(2147483646*rand(time(0)))
random_test = rand((time(0),seed))
set multiplot
b = rand(0)>0.5?1:0
if (b) {plot f(t), g(t) w filledc closed lw 1 lc rgb Color}
do for [i=1:m-1]{
    do for [j=0:m-1]{
        b = rand(0)>0.5?1:0
        if (!b) {continue}
        plot funX(i,t),  funY(j,t) w filledc closed lw 1 lc rgb Color, \
            -funY(j,t),  funX(i,t) w filledc closed lw 1 lc rgb Color, \
            -funX(i,t), -funY(j,t) w filledc closed lw 1 lc rgb Color, \
             funY(j,t), -funX(i,t) w filledc closed lw 1 lc rgb Color
    }
}
unset multiplot


(3) n is even (Non-Reflectional Symmetry)

(n = 12)

gnuplot script:

n = 12
m = n/2
max(x,y) = x>y?x:y
f(t) = 0.5*cos(2*pi*t) / max(abs(cos(2*pi*t)), abs(sin(2*pi*t)))
g(t) = 0.5*sin(2*pi*t) / max(abs(cos(2*pi*t)), abs(sin(2*pi*t)))
funX(i,t) = f(t) + 0.5 + i
funY(j,t) = g(t) + 0.5 + j
set xrange [-m-1:m+1]
set yrange [-m-1:m+1]
unset key
unset tics
unset border
set margins 0,0,0,0
set size ratio -1
set samples 1000
set parametric
set trange [0:1]
Color = "#00cc00"
set terminal wxt 0 size 600,600 position 0,0 title "n = ".n
seed = ceil(2147483646*rand(time(0)))
random_test = rand((time(0),seed))
set multiplot
do for [i=0:m-1]{
    do for [j=0:i]{
        b = rand(0)>0.5?1:0
        if (b) {
           plot funX(i,t),  funY(j,t) w filledc closed lw 1 lc rgb Color, \
               -funY(j,t),  funX(i,t) w filledc closed lw 1 lc rgb Color, \
               -funX(i,t), -funY(j,t) w filledc closed lw 1 lc rgb Color, \
                funY(j,t), -funX(i,t) w filledc closed lw 1 lc rgb Color
        }
        if (j==i) {continue}
        if (!b) {
           plot funX(j,t),  funY(i,t) w filledc closed lw 1 lc rgb Color, \
               -funY(i,t),  funX(j,t) w filledc closed lw 1 lc rgb Color, \
               -funX(j,t), -funY(i,t) w filledc closed lw 1 lc rgb Color, \
                funY(i,t), -funX(j,t) w filledc closed lw 1 lc rgb Color
        }
    }
}
unset multiplot


(4) n is odd (Non-Reflectional Symmetry)

(n = 11)

gnuplot script:

n = 11
m = (n+1)/2.
max(x,y) = x>y?x:y
f(t) = 0.5*cos(2*pi*t) / max(abs(cos(2*pi*t)), abs(sin(2*pi*t)))
g(t) = 0.5*sin(2*pi*t) / max(abs(cos(2*pi*t)), abs(sin(2*pi*t)))
funX(i,t) = f(t) + i
funY(j,t) = g(t) + j
set xrange [-n/2.-1:n/2.+1]
set yrange [-n/2.-1:n/2.+1]
unset key
unset tics
unset border
set margins 0,0,0,0
set size ratio -1
set samples 1000
set parametric
set trange [0:1]
Color = "#00cc00"
set terminal wxt 0 size 600,600 position 0,0 title "n = ".n
seed = ceil(2147483646*rand(time(0)))
random_test = rand((time(0),seed))
set multiplot
do for [i=0:m-1]{
    do for [j=0:i]{
        b = rand(0)>0.5?1:0
        if (b) {
           plot funX(i,t),  funY(j,t) w filledc closed lw 1 lc rgb Color, \
               -funY(j,t),  funX(i,t) w filledc closed lw 1 lc rgb Color, \
               -funX(i,t), -funY(j,t) w filledc closed lw 1 lc rgb Color, \
                funY(j,t), -funX(i,t) w filledc closed lw 1 lc rgb Color
        }
        if (j==0 || j==i) {continue}
        if (!b) {
           plot funX(j,t),  funY(i,t) w filledc closed lw 1 lc rgb Color, \
               -funY(i,t),  funX(j,t) w filledc closed lw 1 lc rgb Color, \
               -funX(j,t), -funY(i,t) w filledc closed lw 1 lc rgb Color, \
                funY(i,t), -funX(j,t) w filledc closed lw 1 lc rgb Color
        }
    }
}
unset multiplot


Graph files:


( Mathematical softwares used: Graph, gnuplot )