CPolygon:Perimeter


The Perimeter method calculates the path length along the vertices of the CPolygon, then back to index 1. If the polygon is convex, this equals the true perimeter of the polygon. The polygon does not need to be convex.

Syntax

nPerimeter = CPolygon:Perimeter()

where

    nPerimeter is the path length from index 1 to Count and back to index 1.

Example

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

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

-- create CPolygon A

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

-- result: Perimeter = 19.5755

Related Topics

Area

PathLen

CPolygon class