enter image description here

Sample Periodic Pattern

I want to implement a periodic pattern which satisfies below equations:

W(x + q0N0, y) = W(x, y); q0, N0 >1

W(x, y + q1N1) = W(x, y); q1, N1 > 1

where N0 and N1 determine the periodicity of repetitions and q0 and q1 a repetition number on the horizontal and vertical directions. Generation from pseudorandom values {−1, 1} produces a rectangular, binary valued pattern.

  • I don't really understand the equations (or what the question is). But it reminds me of one of my hobby projects. Here I create patterns by combining binary sequences. L is the length of the sequence, O is the offset from one line to the next, I is the index of the combination. Click "Randomize" to see examples.
    – Wolff
    May 19, 2019 at 12:23
  • @Wolff Thanks for the answer. Can I get the code of your project? May 19, 2019 at 13:26
  • This is just a comment, not an answer. You can spy on my code (like on any other site) using developer tools and look at the sources. It's MIT licensed. I can't post an explanation as an answer since I don't think that it would answer your question.
    – Wolff
    May 19, 2019 at 13:53

1 Answer 1


Seemingly a homework, maybe one which is written to cause a little uncomfort for those who have skipped the elementaries.

If the result must be a pattern generating code which is programmed with certain tools and use certain algorithms to make the starting pattern, the things are different. I generate only a pattern.

W(x,y) obviously is the color content of one dot in coordinates (x,y). Thus you can select freely (or obeying those limitations that you have got but not revealed) what you have in a rectangle which starts from corner (0,0) and is N0 pixels wide and N1 pixels high. The opposite corner for (0,0) has pixel coordinates (N0-1, N1-1)

In Photoshop you make an image which is exactly = starting rectangle, put into it noise, a sample of another image, filter it or populate it otherwise obeying those rules which you have got but not revealed.

An example: N0=60,N1=34, the content = random text, random part of a random photo, color noise.

enter image description here

Then you select all and define it to be a custom pattern (Edit > Define Pattern). Make another image and fill it with that pattern. Use pattern brush and fill your image with a single stroke

A 3000px wide image is filled with the pattern brush. It was one fast sweep forth and back because the brush was 2000 px wide.

enter image description here

The result has shifted edges i.e. the original (0,0) corner isn't exactly at (0,0) in the filled image. That doesn't harm, the periodicity equations are still satisfied.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.