pg = polyshape(x, y)
pg = polyshape(P)
| Parameter | Description |
|---|---|
| x, y | vectors of the polygon vertex coordinates. |
| P | an N-by-2 matrix of vertices [x y]. |
| Parameter | Description |
|---|---|
| pg | a polyshape object. |
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.
f = figure();
pg = polyshape([0 1 1 0], [0 0 1 1]);
plot(pg, 'FaceColor', 'r');
area(pg)
| Version | Description |
|---|---|
| 2.0.0 | Initial version. |