how to generate a circel which filed with regular points?

1 vue (au cours des 30 derniers jours)
Rubel Ahmed
Rubel Ahmed le 9 Jan 2020
Commenté : darova le 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

Réponse acceptée

darova
darova le 13 Jan 2020
Here is an idea:
  • Increase radius:
  • Number of points on radius:
img1.png
  3 commentaires
Rubel Ahmed
Rubel Ahmed le 14 Jan 2020
Yeap I am done, Thanks a lot
darova
darova le 14 Jan 2020
Looks great!

Connectez-vous pour commenter.

Plus de réponses (1)

Walter Roberson
Walter Roberson le 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 commentaires
Walter Roberson
Walter Roberson le 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 le 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.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Scatter Plots dans Help Center et File Exchange

Produits

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by