2.1.17.1.2 ocmath_f_polygon_area


Description

In this function, divide the polygon into trapezias by both ends of polygon's borders, then for every trapezium, calculate its area by (y1+y2)*(x2-x1)/2, that is also why sometimes it will get a negative area value.

Data types supported:

double: ocmath_d_polygon_area

float: ocmath_f_polygon_area

POINT: ocmath_l_polygon_area

Syntax

float ocmath_f_polygon_area(float* pX, float* pY, uint nSize)

Parameters

pX
[input] buffer containing X data of polygon vertexes
pY
[input] buffer containing Y data of polygon vertexes
nSize
[input] size of pX, pY

Return

Polygon area.

Examples

Remark

See Also

ocmath_d_polygon_area, ocmath_l_polygon_area

Header to Include

origin.h

Reference