We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Goodmorning everybody, I was trying to use the random() function to create a visually interesting grid ( a number of crossing horizontal and vertical lines) made up of adjacent points (with space between each other) and not by using the line() function. I was trying to use only the loop "for" but I am having problems on the next step. This is the start of my code.
int verticalNumberLines=20;
int horizontalNumberLines=20;
int space=5;
size(400, 400);
background(#99ff66);
strokeWeight(2);
for (int i=0; i<width; i+=width/verticalNumberLines)
{
for (int j=0; j<height; j+=space)
{
point(i, j);
}
}
for (int j=0; j<height; j+=height/horizontalNumberLines)
{
for (int i=0; i<width; i+=space)
{
point(i, j);
}
}
this is what I have now
and this second gray and orange grid is what I am trying to do, now I am very close and I tried in different ways but I don't understand what I should change, where I should use the random function.Could someone help me, please?!
Answers
You can add a small offset to the points you are drawing
This offset could be vertical to the main direction of the line (horiz or vert) and be random(-5,5)
point(i+random(-6,6), j);
Thank you a lot! It's a lot important for me. It's not exactly the same but at least I have an answer. I am feeling better.
I think one time, you need to add +random(-3, 3) to the x-, one time to the y-value...