CPolygon:Shift


The Shift method shifts the CPolygon by applying an offset to each of its vertices.

Syntax

CPolygon:Shift( nShiftX, nShiftY )

where

    nShiftX, nShiftY are the offsets for the x and y directions.

Example

The following script creates a CPolygon from 2 arrays and applies a shift of (3.5, -2.1):

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

-- create CPolygon A

Printf("x,y = %lg, %lg", A:GetPt(3) )

-- result: x,y = 6, -3

A:Shift( 3.5, -2.1 )

-- scale the polygon

Printf("x,y = %lg, %lg", A:GetPt(3) )

-- result: x,y = 9.5, -5.1

Related Topics

Rotate

Scale

Skew

CPolygon class