Message Boards Message Boards

GROUPS:

Specify the size of points and square in RandomPoint?

Posted 4 months ago
394 Views
|
3 Replies
|
1 Total Likes
|

The following two lines generate almost exactly what I want:

pts = RandomPoint[Rectangle[], 250]
Graphics[{ImageSize->Small,PointSize[Tiny], Point[pts]}]

However, I want to be able to specify specific sizes for the points (i.e. diameter of 1.5 microns on a square that is 1000 um x 1000 um). Is there a way to do set these parameters?

If not, is there a good function in Python that would allow me to randomly plot circles of specific diameters on squares of specified size?

3 Replies

You can give PointSize[r] where the radius r is relative to the width of the whole picture. Otherwise you can use Disk[{x,y},r] where r is in the radius in the internal coordinates of the plot. These two methods behave differently, for example, when the AspectRatio is not Automatic.

Posted 4 months ago

PointSize[r] will work for my purpose.

Is there a parameter to ensure that a circle cannot overlap with another circle? For instance, can I set a minimum distance that it must be from it's nearest circle?

Might modify one of the methods from here to find fixed radius nonoverlapping random disks.

Alternatively, generate more than needed and use Nearest to determine when neighbors come too close to each point, discarding the neighborts when that happens.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract