polyareaΒΆ

polyarea returns the area of a simple polygon specified by the vertices in the vectors X and Y.

rsA = polyarea(rvX, rvX)

Return Value

rsA is the area.

Parameters

rvX

rvX is a real vector.

rvY

rvY is a real vector.

Comment

The area is a postive value. The polygon will be closed if the last vertex (xN,yN) is not the same as the first vertex. The only restriction that will be placed on the polygon for this function to work is that the polygon must not be self intersecting. Note for polygons with holes. The holes are usually defined by ordering the vertices of the enclosing polygon in the opposite direction to those of the holes.

Example

xx = linspace(0, 2.0*PI, 6);
x = cos(xx);
y = sin(xx);
A = polyarea(x, y);
rvH = plot(xv,yv);
Createtitle("Area = " + strtod(A))

id-726682