Clear Filters
Clear Filters

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

2 views (last 30 days)
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.

Answers (1)

Image Analyst
Image Analyst on 20 Feb 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 Comments
Image Analyst
Image Analyst on 20 Feb 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 on 20 Feb 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.

Sign in to comment.

Tags

No tags entered yet.

Community Treasure Hunt

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

Start Hunting!