Please enable JavaScript to view this site.

Knowledge Base

Navigation: Scripting Language > Functions

polyarea

We've made some changes. Use 'Ctrl-F5' to clear your browser cache.
Scroll Prev Top Next More

Returns the area of a polygon. The area is positive if the vertices are defined in a counter-clockwise direction, and negative if the vertices are defined in a clockwise direction.

 

The polygon vertices are contained in a single matrix of dimension Nx2 (or 2xN), where N >= 3 is the number of vertices. The dimension 2 corresponds to the x,y positions. For example, a square of side length 1 can be described by V = [ 0,0; 1,0; 1,1; 0,1] or V = [ 0,1,1,0;0,0,1,1].

 

Supported Product: FDTD, MODE, DEVICE, INTERCONNECT

 

Syntax

Description

out = polyarea(V);

Returns the area of V. The sign of the area indicates if V is defined in a counter-clockwise (positive) or clockwise (negative) direction.

 

Example

Calculate the area of a square of side length 1:

V = [ 0,0; 1,0; 1,1; 0,1];

?polyarea(V);

result:

1

 

See Also

Functions, centroid, polyintersect, inpoly, polygrow, polyand, polyor, polydiff, polyxor

Copyright Lumerical Inc. | Privacy | Site Map