CPolygon:Skew
The Skew method skews the CPolygon by applying cross-scaling factors relative to the center. Scale factors of 1.0 apply no scaling.
CPolygon:Skew( nScaleX, nScaleY ) where |
nScale is the multiplication factor to be applied in both directions.
nScaleX, nScaleY are the multiplication factors for the x and y directions.
This method transforms a rectangle into a parallelogram by applying a skew transformation to each vertex point. Let (xc,yc) be the center of the CPolygon. Then for scale factors nScaleX and nScaleY, the new vertex coordinates are calculated using the following equations:
x' = x - xc
y' = y - yc
x = xc + x' + nScaleX * y'
y = yc + y' + nScaleY * x'
The following script creates a CPolygon from 2 arrays and applies a skew factors of 1.5 and 2.5:
|
-- create CPolygon A |
|
-- result: x,y = 6, -3 |
|
-- skew the polygon |
|
-- result: x,y = -.375, -2.75 |