POLY_AREA Function
Standard Library function that returns the area of an n-sided polygon, given the vertices of the polygon.
Usage
result = POLY_AREA(x, y)
Input Parameters
x — An n-element real vector containing the x-coordinates of each vertex in the polygon.
y — An n-element real vector containing the y-coordinates of each vertex in the polygon.
Returned Value
result — The area of the polygon, returned as a floating-point value.
Keywords
None.
Discussion
POLY_AREA assumes that the input polygon has n vertices with n sides, and that the edges connect the vertices in the order [(x1, y1), (x2, y2 ), ..., (xn, yn), (x1, y1)]. The last vertex must be connected to the first.
Example 1
x = [1, 3, 2]
y = [1, 1, 4]
area = POLY_AREA(x, y)
PRINT, area
; PV-WAVE prints: 3.00000
Example 2
x = [2, 4, 4, 2]
y = [1, 1, 2, 2]
PRINT, POLY_AREA(x, y)
; PV-WAVE prints: 2.00000
See Also
Version 2017.0
Copyright © 2017, Rogue Wave Software, Inc. All Rights Reserved.