Creating woven patterns ... beginner

I am looking to create a sketch which draws a woven pattern … that is, mimics woven cloth … so with warp and weft. I would like to do it, as a beginner coder, using pixels to draw it … but am a bit confused. I have been able to get a criss-cross pattern in x and y directions, but not to do the over-under weft thing. I imagine i need to ‘get’ the pixel color as in 'if green then each 2nd one make green (to show gong under) … hmmmmm.

Hello and welcome to the forum!

you can use get() to get the color of a pixel - see reference

Use it with 2 parameters (x,y) to get the color of ONE pixel

(there will be a certain amount of pixels where == won’t work because of anti-alising, ignore this first)

Remark

so

if (get(x,y) == green) {
   each 2nd one make green
}

make green or maybe just draw nothing at this position, then you would just leave the color already drawn at this position visible.

Remark 2

each 2nd

you could do this like :

before setup() :

boolean isFirstRow = true;

in your function:

if(isFirstRow) {
    // is true !!! 
    // draw green
    isFirstRow=false;   // toggle 
} else 
{
    //draw red or so
    isFirstRow=true;  // toggle 
}

Show your entire code to get more help

Regards, Chrisir

1 Like

Thanks Chrisir!! I will check it out!!

best,

Lee

1 Like

As a beginner you might also be interested in the WOVNS examples (designed to create patterns that you get can woven) http://www.wovns.com/tutorials/designing-computational-textiles-with-processing/. Not exactly what you were requesting, but quite interesting.

1 Like