CPolygon:Area


The Area method calculates the area enclosed by the CPolygon. The polygon does not need to be convex.

Syntax

nArea = CPolygon:Area()

where

    nArea is the area enclosed by the polygon.

Example

The following script creates a CPolygon from 2 data arrays, x, and y, and then calculates its area:

A = NewPolygon( {4,5,6,7}, {1,2,-3,5} )

-- create CPolygon A

Printf("Area = %lg", A:Area() )

-- result: Area = 2

Related Topics

PathLen

Perimeter

CPolygon class