How to generate points/ellipse within a circle area

Hello! I’m trying to generate ellipses within an ellipse, or a circular area.
for example:

for (let i=0; i< 100; i++){
ellipse (random(width), random(height), 10)
}
noLoop();

Is there a way to generate these random circles within an ellipse instead of the canvas? I’ve looked at drawing circles along a circle, but I want it to be within it too. I’ve also looked at circle packing, but I don’t think it needs to be that complicated, I just need to generate points within a circle

Let me know, thank you!

1 Like

Hello!

You can check the distance to the middle of the circle. Only draw the random point when the distance is <radius.

  • Use if(...) and dist() - see reference.

The other way is to use cos and sin to calculate a position inside the circle.

  • See website, tutorials, trigonometry please. Together with a random radius and random angle (0…TWO_PI).

Warmest regards

Chrisir

2 Likes

Hello,

Resources < Click here to expand !

I encourage you to review the resources available here:

:)

1 Like

thank you both so much! yeah that makes so much sense, will try it out :slight_smile:

1 Like

21 posts were split to a new topic: [SOLVED] Drawing circles inside a circle (generative dandelion)