We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I'm trying to make a program that create art like this one
Just started it, and i'm already with some basic problems. My first thought, trying to divide and conquest was to create the lines first.
Centro c = new Centro();
void setup(){
size(400,400);
}
void draw(){
//Linhas();
c.desenhaCentro();
}
void Linhas(){
color(0,0,0);
fill(0);
/*
line(0,0, width, height);
line(0,height, width, 0);
*/
}
class Centro{
int Cx = int(random(100,300));
int Cy = int(random(100,300));
void desenhaCentro(){
line(0, 0, Cx, Cy);
line(400,0, Cx, Cy);
line(0, 400, Cx, Cy);
line(400, 400, Cx, Cy);
}
}
I tried to make a function to create the lines using the "Centro" x,y, and limited the random to 100 and 300 so it don't get much narrowed at borders. But, seeing it work, it's weird...
I wanted to use random because it would create some different art when the code is executed. My question is, there's no way to make random work and make it maintaining some king of proportion? I think that the problem is propotion. Opinions?
Answers
Making some chances, doing some math, the angle between the lines in the center should be 90º, but still trying to figure how to do it
Still trying to find a way to make the lines have a angle of 90º, any help?
I belive that i've made a better way to generate the lines.
But still dont know how to make proportional
Have you considered using a 3D renderer instead of 2D? Then you lay out your lines and squares in 3D space. For squares, you will need the vertex() function. I think this could work... and it could give you the effect that you want using a "natural" way instead of doing math projection calculations. I will allow other forum goers comment on this idea as I haven't done it myself before. By the way, the math projection calculations are not difficult. I am concerned about the width of the lines that seem to change with different perspectives.
Kf
I don't even know how to use 3D on Processing... Gonna take a look, if you have any idea, would love some help to start.
Ty Chrisir, trying to implement that code with the one i'm doing, also trying to see if i can get some random colors showing up
This is my suggestion @tsunii and you should check the reference for the next keywords:
https://processing.org/reference
Kf
Making some new changes, got something like this, still far away from perfect, i belive that i need to create some Quadrants, like 8, and make changes from there, and also i trying to put everything inside the screen, till now sometimes the drawing get out.
Still didnt figure it out how do make the rect don't leave the screen
Was thinking about that. To create one black rect occupying the screen, and use the function for that Chrisir did, instead to create they from the center, create they from 0,0 and decrease till the center or some random point
This is not the solution, but it shows a dynamic sketch: Mouse the mouse and click to set v5. Can you explain what do you want the lines to do? To originated at the center of the screen and extend to the corner of your sketch?
Kf
No library found for processing.awt.PSurfaceAWT No library found for com.sun.awt
Where i can find those library? And yes, i wanted the lines to generate at the center of the drawing, just like the art, and extent to the corne
Ok, you can remove those lines... I just wanted to remove the top bar of the sketch but you don't need to do that. I can get back to you about those libraries later and you can make another post asking about this.
So remove all lines related to AWT and run the sketch.
Kf
Ok, new update, got this.
Code it's a little messy, but i was just trying to get the logic right, now i only need to find a way to make the code run even if i increase the size, and after that, just need to make the code more beatiful.
You have a typo in line 50. Instead of 100, it should be 112. Anyways, I modified your code from line 45 to 64 like this below.
Kf
Yeah, i was making just testing with the numbers and i forgot to Ctrl+z it. Ty, i'll make the chance and when i have the oportuniy, i'll try to make more chances