en su función draw() SOLO dibujará cuadrados si su posición esta dentro de un círculo con posición central de radio 100 pixels:
Dos métodos:
Mi duda es ¿como generar la posición aleatoria del cuadrado en el círculo de 100 pixels?
2 Likes
Hello,
and welcome to the processing forum! Great to have you here.
To find a random position use cos and sin and make a random angle and a random radius for it.
see https://www.processing.org/tutorials/trig
Chrisir
1 Like
Okay chriseir hoy can write how yo put the ramdom rect un that ellipse
1 Like
rect(x,y,
12,12);
calculate x and y with cos and sin like explained in the link
I am sorry, we are not allowed to help with homework. It would be considered cheating you know.
We can help you but show your attempt.
Remark
At the moment I speak about : Generar la posición de forma aleatoria pero ya dentro del circulo permitido, not the first way.
For the first way: make a for loop (see reference: https://www.processing.org/reference/)
and generate x,y randomly (see random()). Check the distance to your center with the function dist() (see reference: https://www.processing.org/reference/).
If the dist is smaller than 100, draw the rect.
Chrisir
1 Like