Clear Filters
Clear Filters

How may I parametrise a polygon?

4 views (last 30 days)
N/A
N/A on 29 Dec 2015
Answered: Image Analyst on 31 Dec 2015
Hi all, I'm not asking for a code per se but I was just wondering if anyone here would be able to help with a problem I have.
Data: I have a set of co-ordinates, i.e. 10 sets of n (x,y) points, which form the outline of a closed polygon (not a curve).
What I want to do: Is there anyway I may write an equation / techniques such that by varying certain parameter(s), I may be able to obtain the outline of any shape.
In simple terms, if I have a 4-sided polygon, the parameters could be 1) the ratio of the two lengths of the diagonal and 2) the angle in between the diagonals. By varying these two parameters, I am able to obtain any 4-sided polygon, e.g. kites, squares, rectangles, etc.
Hence, for a more complicated problem such as the one I have described, is there anyway I can go about this?
Thank you for your time !

Answers (1)

Image Analyst
Image Analyst on 31 Dec 2015
poly2mask can turn any set of coordinates into a binary image. bwboundaries() can get you the list of (x,y) coordinates along every pixel in the image. bwperim() can get you a binary image with the edge pixels set to white and black everywhere else. regionprops() can get you a whole bunch of metrics about a polygon in a binary image.

Categories

Find more on Elementary Polygons in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!