Draws meaningless symmetrical dot pattern.

This is my creative coding artwork that draws symmetrical dot patterns. The code was written in Processing.

I played making an animation using the '% (modulo)' formula. And I found that the pattern is so sensitive to the value in the formula. So I couldn't make smooth changing animation.



Then I tried to make still images of the interesting pattern.

A symmetrical dot pattern in the rectangle.

The patterns in the rectangle above looked too ordinal for me. So I tweaked it in polar coordinate.

A symmetrical dot pattern in polar cordinates.


And I combined these! It looks a little bit interesting, isn't it?
A symmetrical dot pattern.


The pattern calculating formula is like this. And I don't know the meaning of these, as usual.

float s = ((abs(x * x) + abs(y * x)) % seed) / seed;
float t = ((x * y + y) % seed) / seed;






An example code of Processing.

This code does not display any images on the screen but generates image files in frames directory.
Please feel free to use this example code. To see other works based on my code is my pleasure. And my honor.


/**
 * More News From Nowhere.
 * draws a symmetrical dot pattern.
 *
 * @author @deconbatch
 * @version 0.1
 * @license GPL Version 3 http://www.gnu.org/licenses/
 * Processing 3.5.3
 * 2021.04.18
 */

void setup() {
  size(980, 980);
  colorMode(HSB, 360.0, 100.0, 100.0, 100.0);
  rectMode(CENTER);
  smooth();
  noLoop();
}

void draw() {

  int   imgMax  = 3;
  int   divNum  = 30;
  float hueBase = random(360.0);

  for (int imgCnt = 0; imgCnt < imgMax; imgCnt++) {

    int divSiz = 7;
    int ptnSiz = divSiz * divNum;
    hueBase += 90.0;
    
    // draw background
    blendMode(BLEND);
    drawBackground(ptnSiz, hueBase);
    
    // draw foreground
    blendMode(SUBTRACT);
    float hueDiv = 30.0; // for diagonally across color
    for (float x = 0.282; x < 1.0; x += 0.436) { // delicate location with an accurate measurement!
      hueBase += 360.0 - hueDiv;
      for (float y = 0.282; y < 1.0; y += 0.436) {
        hueBase += hueDiv;
        pushMatrix();
        translate(width * x, height * y);
        drawPattern(ptnSiz, divSiz, hueBase);
        popMatrix();
      }
      hueDiv *= -1.0;
    }

    // draw casing
    pushMatrix();
    translate(width * 0.5, height * 0.5);
    blendMode(BLEND);
    casing();
    popMatrix();

    saveFrame("frames/" + String.format("%04d", imgCnt + 1) + ".png");

  }
  exit();
}

/**
 * drawBackground : draws dot background
 */
private void drawBackground(int _ptnSiz, float _hue) {

  int div = floor(min(width, height) * 0.005);
  
  background(0.0, 0.0, 94.0, 100.0);
  fill((_hue + 315.0) % 360.0, 40.0, 80.0, 100.0);
  noStroke();
  for (int x = 0; x < width; x += div) {
    for (int y = 0; y < height; y += div) {
      if ((x + y) % (div * 2) == 0) {
        ellipse(x, y, div, div);
      }
    }
  }

  fill(0.0, 0.0, 94.0, 100.0);
  rect(width * 0.5, height * 0.5, _ptnSiz * 4.15, _ptnSiz * 4.15);

}

/**
 * drawPattern : draw symmetrical pattern
 */
private void drawPattern(int _ptnSiz, float _divSiz, float _hue) {

  float seed = random(1.0, 2.0);

  noStroke();
  for (int x = -_ptnSiz; x <= _ptnSiz; x += _divSiz) {
    for (int y = -_ptnSiz; y <= _ptnSiz; y += _divSiz) {
      float s = ((abs(x * x) + abs(y * x)) % seed) / seed;
      float t = ((x * y + y) % seed) / seed;

			float theta = PI * s;
			float radius = _ptnSiz * t;

      // circle
			float rX = radius * cos(theta);
			float rY = radius * sin(theta);
      float rS = _divSiz / 5.0 + abs(PI * t);
      fill((_hue + s * 90.0) % 360.0, 40.0, 40.0, 100.0);
      ellipse(rX, rY, rS, rS);
      ellipse(-rX, rY, rS, rS);
      ellipse(rY, rX, rS, rS);
      ellipse(rY, -rX, rS, rS);

      // rectangle
      float eS = rS * 1.75;
      fill((_hue + 60.0) % 360.0, 60.0, 30.0, 100.0);
      ellipse(x, y, eS, eS);
      ellipse(-x, y, eS, eS);
      ellipse(y, x, eS, eS);
      ellipse(y, -x, eS, eS);

    }
  }
}

/**
 * casing : draw fancy casing
 */
private void casing() {

  float w = min(width, height) * 0.05;
  
  fill(0.0, 0.0, 0.0, 0.0);
  strokeWeight(w + 4.0);
  stroke(0.0, 0.0, 0.0, 100.0);
  rect(0.0, 0.0, width, height);
  strokeWeight(w);
  stroke(0.0, 0.0, 100.0, 100.0);
  rect(0.0, 0.0, width, height);
}


/*
Copyright (C) 2021- deconbatch

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>
*/