Effacer les filtres
Effacer les filtres

Random generation of coordinate points that lie outside of defined surfaces.

2 vues (au cours des 30 derniers jours)
nanmi51
nanmi51 le 19 Fév 2018
Commenté : Rena Berman le 15 Mai 2018
I have a question regarding the generation on random xy coordinates in an already defined area. Now the area is comprised of many little sub-areas representing aggregates in the material's micro-structure. I want the randomaly generated coordinates (i.e. centroids of the air voids) to lie outside those sub-areas. The program I have so far can plot the xy coordinates of all of the nodes making up the lines which connect to establish the sub-areas. Any help would be much appreciated. Thanks.

Réponses (1)

Image Analyst
Image Analyst le 20 Fév 2018
Can you use poly2mask() to make those sub areas into a digital image? If so, then you can use randperm() and the mask to place a specified number of points into the mask regions. If that sounds good, then try it or else if you can't figure it out, give us the points for all the regions (either via source code to generate them, or via an attached .mat file) and we'll do it for you.
  2 commentaires
Image Analyst
Image Analyst le 20 Fév 2018
Can you upload a screenshot, like a PNG file? I'll check back later today - I have to leave for somewhere now.
Image Analyst
Image Analyst le 20 Fév 2018
I see. I have to go to another meeting now, but could you post the code to read in the file and create the figure? This would make it quicker and easier for me if you did it for me rather than me having to create that code. I'll look for it. later today.

Connectez-vous pour commenter.

Tags

Aucun tag saisi pour le moment.

Community Treasure Hunt

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

Start Hunting!

Translated by