First of all, Mr Into 100 random point
Matlab code
% in 200 * 200 matrix randomly generated 100 trees
N=200;
A=[' ones (100, 1); the zeros (39900, 1));
A=reshape (a (randperm (40000), 200200);
Z=zeros (n, n);
% to generate images
Imh=image (cat) (3, a, z, z);
Set (imh, 'erasemode', 'none');
And then there is the problem of how the 100 points evenly distributed
I want to have to is to use the D8 chessboard distance algorithm to work out the distance between the various points before setting the space of each point (9 * 9 small matrix)
T=bwdist (a, "chessboard");
% D8 algorithms calculate the distanceLooking for T equal to zero point and then save the zero point of x, y
[x, y)=(T==0);
And use an algorithm to into each point to reject
If you have any other small matrix at rejection to small matrix edge
Then I found when I started moving point, repeat some question is a bit difficult,
If the following triangle matrix mobile as rules
Center as an example the first move after the lower point, when I take the center of the lower point coordinates has been changed and I coordinate is D8 algorithm generating matrix coordinate calculate
Still not achieve them reject
Finally can realize uniform distribution, himself a small white just this kind of contact and matlab algorithm, I algorithm is rather weak show just a little big trouble!
(question: matlab matrix randomly generated in 200 * 200 100 points (can be any points) to make it evenly distributed on the matrix,)