Forums > Jitter

How to fill a matrix with a checkerboard pattern?

March 6, 2014 | 9:13 am

Does anyone know a nice elegant way to fill a matrix with a checkerboard pattern?

Let’s say for example that the two colours will be cyan and magenta. Also, each square will be just one cell of the matrix.

I could use uzi and counter to loop through all the odd cells and then all the even cells, but I’m guessing there’s a more efficient way.



Nat
March 6, 2014 | 11:47 am

jit.bfg, check the help, third tab "checker"
Would that do ?


March 6, 2014 | 3:04 pm

Yes, I did see that shortly after I posted! I will experiment… I need to find the right settings so that the pattern matches up perfectly to the resolution of the matrix – one square per cell/pixel.


March 6, 2014 | 3:09 pm

You could also investigate using [jit.expr] with the cell arguments


March 7, 2014 | 8:44 am

I’d say, just do it once with uzi and you’re done with it in a few microseconds never to worry about it again.
<code>

– Pasted Max Patch, click to expand. –

</code>


March 7, 2014 | 4:40 pm

A simple and efficient technique would be to use jit.gen along with [cell] [%] and [<] objects.


March 7, 2014 | 8:42 pm

Yes, gen is great for cellwise stuff.
<code>

– Pasted Max Patch, click to expand. –

</code>


Viewing 7 posts - 1 through 7 (of 7 total)