Yes , definitely , now It is working perfectly, there was my mistake surely
Good news then. A small favor, repost your working code if you please. Iād like to be sure I have the latest to work with. Thanks.
Of course. This is my trying rotate and translate, that duplicate the constellation
float u = 0;
float v = 0;
size(1000,1000);
background(255);
strokeCap(ROUND);
//first pattern
stroke(255,0,255);
for (int x = 0; x < 1000; x += 30) {
for (int y = 0; y < 1000; y += 30) {
u = u + 0.1;
v = v + 0.11;
float n = noise(u) * 500;
float m = noise(v) * 500;
strokeWeight(random(3,5));
translate(600,600);
rotate(PI/2.0);
point(n, m);
}
}
And this is me trying setLocation , that is something that I donāt manage to run
void setup(){
float u = 0;
float v = 0;
size(1000,1000);
background(255);
strokeCap(ROUND);
surface.setResizable(true);
surface.setSize(300, 200);
surface.setLocation(300,300);
}
//first pattern
void draw() {
stroke(255,0,255);
for (int x = 0; x < 1000; x += 30) {
for (int y = 0; y < 1000; y += 30) {
u = u + 0.1;
v = v + 0.11;
float n = noise(u) * 500;
float m = noise(v) * 500;
strokeWeight(random(3,5));
point(n, m);
}
}
}
Thanks. Evidently, setLocation() doesnāt work the way I expected it to so there has to be another workaround.
If I chance noise function from 500 to width I think that rotate and translate does not work the same way
loat u = 0;
float v = 0;
size(1000,1000);
background(255);
strokeCap(ROUND);
//first pattern
stroke(255,0,255);
for (int x = 0; x < 1000; x += 30) {
for (int y = 0; y < 1000; y += 30) {
u = u + 0.1;
v = v + 0.11;
float n = noise(u) * width;
float m = noise(v) * width;
strokeWeight(random(3,5));
translate(900,900);
rotate(PI/3.0);
point(n, m);
}
}
This is as close as I can get for now. I changed a few variables, added a couple of functions and tweaked things a bit. You might experiment more with the noise() function and see if you can get your dot distribution to your liking. Mapping x,y from u,v isnāt perfect and could be improved but the base code is sound. It takes a bit longer to run due to the extra random() functions I added. Havenāt spent anymore time on setLocation() but Iāll see if I have time later.
float u = 0;
float v = 0;
float x1, x2, x3, x4;
float y1, y2, y3, y4;
void setup() {
size(1000,1000);
background(255);
strokeCap(ROUND);
x1 = 300;
y1 = 500;
x2 = 800;
y2 = 600;
x3 = 700;
y3 = 900;
x4 = 400;
y4 = 800;
quad (x1,y1, x2,y2, x3,y3, x4,y4);
}
void draw() {
stroke(255,0,255);
float noiseScale = 0.1;
for (int x = 0; x < 500; x += 30) {
for (int y = 0; y < 500; y += 30) {
noiseDetail(4);
u = u + 1.0 * noiseScale;
v = v + 1.0 * noiseScale;
float n = noise(u,v) * random(x1,height);
float m = noise(u,v) * random(y1,width);
if (((( n > x1)) && (( m > y1))) && ((( n < x2)) && (( m > y2))) \
&& ((( n < x3)) && (( m < y3))) && ((( n > x4)) && (( m > y4)))) {
strokeWeight(random(3,5));
point(n, m-150);
}
else
;
}
}
}
Thank you so much for your effort, I really apreciate it. This is a good solution, but void draw makes an animation instead a static image and the result is a little different than centered constellation from the beginning. By the way, I think that I found something for sizes with noise , with @Mikey83 's help.
float u = 0;
float v = 0;
float w = 0;
size(1000,1000);
background(255);
strokeCap(ROUND);
//first pattern
stroke(255,0,255);
for (int x = 0; x < 1000; x += 30) {
for (int y = 0; y < 1000; y += 30) {
u = u + 0.1;
v = v + 0.11;
w = w + 0.1;
float n = noise(u) * width;
float m = noise(v) * width;
float l = noise(x/100.0, y/100.0)*10;
strokeWeight(l);
point(n, m);
}
}
Now I see that rotate and translate could work if I type them before the loop
float u = 0;
float v = 0;
size(1000,1000);
background(255);
strokeCap(ROUND);
//first pattern
stroke(255,0,255);
translate(200,200);
rotate(PI/8);
for (int x = 0; x < 1000; x += 30) {
for (int y = 0; y < 1000; y += 30) {
u = u + 0.1;
v = v + 0.11;
float n = noise(u) * 500;
float m = noise(v) * 500;
strokeWeight(random(3,5));
point(n, m);
}
}
Thanks for the mention mate, also dont forget, you can always remap any value to any other value with the map() function, can be used instead of multiplying the variable l by 10
Thatās strange. After the code runs to completion it can be saved as a static image. Glad Mikey brought map() up, hadnāt thought of it. Well, glad to help and youāre well on your way. I wonāt be on much this week as my wife and I have a lot of commitments. Iāll check in on your progress and see if I can get setLocation() worked out. Cheers.
Hi again, reading through what you have been trying to do, the surface.setLocation() changes the location of the window itself nothing on the canvas im pretty sure, also, if you want to change the position of the points, add a offset value to the point itself, so
point(n+someValue, m+someValue);
hope that helps