CPolygon:Distance
The Distance method calculates the distance between 2 vertices of the CPolygon. The vertices are specified by ther indices.
nDistance = CPolygon:Distance( nIndex1, nIndex2 ) where |
nIndex1, nIndex2 are 2 vertex indices. The order is not important.
nDistance is the area enclosed by the polygon.
The following script creates a CPolygon from 2 arrays and calculates the distance between the last point and first point:
|
-- create CPolygon A |
|
-- result: D = 5 |