MATLAB Answers

how to generate a circel which filed with regular points?

3 views (last 30 days)
Rubel Ahmed
Rubel Ahmed on 9 Jan 2020
Commented: darova on 14 Jan 2020
Hi all,
I want to generate a circel which filled with regular points say 1000 points inside the circel. The point to another will be constant. How can I generate this? Thanks in advance.
Capture.PNG

  0 Comments

Sign in to comment.

Accepted Answer

darova
darova on 13 Jan 2020
Here is an idea:
  • Increase radius:
  • Number of points on radius:
img1.png

More Answers (1)

Walter Roberson
Walter Roberson on 9 Jan 2020
The distance from one particles to another will be constant.
In order to get that, you need to construct a hexagon packing in a circle: https://math.stackexchange.com/questions/1283085/hexagon-packing-in-a-circle and put the particles at the vertices. That will put each point at the same distance relative to the three closest points around it (except at the edge.) This is the densest possible packing.
Perhaps for your purposes it would be good enough to construct a square mesh.
Do not place the points randomly: you will not be able to satisfy the rule that the distance from one particle to another is constant.

  6 Comments

Show 3 older comments
Rubel Ahmed
Rubel Ahmed on 13 Jan 2020
Thanks a lot. Is there any way to do cuploes of redioues at a time rater than individula radiuses?
Walter Roberson
Walter Roberson on 13 Jan 2020
You could use the Parallel Processing Toolbox to compute the points along different radii in parallel, and then bring the computed points all back together into the main thread for plotting. However this is very likely to be slower than doing it all in one thread.
Walter Roberson
Walter Roberson on 13 Jan 2020
The algorithm that I described earlier for placing the points has a flaw: it does not place the points at constant radial distance apart from each other as you required. Placing an integer number of points at constant distance along circles can only be done at very carefully selected radii, except that the task is made easier if the constant distance is a simple fraction of Pi.
The algorithm I described earlier does not use constant distance: at each radius it modifies the constant distance slightly to get the closest approximation of the distance that permits an exact integer number of points to be placed.
The number of points that are appropriate for each radius will differ, and the appropriate number would be the same for two radii only if the two radii differ by less than 1/(2*pi) approximately.
The calculation of linspace(0,2*pi,N+1) is difficult to vectorize for multiple N values.
It would be possible to use the same N value for multiple radii even though they "should" have different N values, but if you do so then you have the problem that the "constant distance" requirement gets more and more violated.
What might be worth doing is calculating all of the points for each radii in a loop, storing the results in a cell array, then cell2mat() to create a single list of x and single list of y coordinates, and scatter() with that -- thus reducing down to a single scatter object instead of one per radius.

Sign in to comment.

Sign in to answer this question.


Translated by