polyshape
Create a polygon.
📝Syntax
pg = polyshape(x, y)
pg = polyshape(P)
📥Input Arguments
Parameter Description
x, y vectors of the polygon vertex coordinates.
P an N-by-2 matrix of vertices [x y].
📤Output Arguments
Parameter Description
pg a polyshape object.
📄Description

polyshape creates a polygon from its vertices. The methods area, perimeter and numsides query it, rotate and translate transform it, and plot draws it as a filled patch (accepting patch name-value properties). rotate(pg, theta) turns the polygon counterclockwise by theta degrees about the origin, or about a reference point given as a third argument; translate(pg, [dx dy]) shifts it.

💡Examples
f = figure();
pg = polyshape([0 1 1 0], [0 0 1 1]);
plot(pg, 'FaceColor', 'r');
area(pg)
🔗See Also
nsidedpolypolyarea
🕔Version History
Version Description
2.0.0 Initial version.
Edit this page on GitHub