CPolygon:new
The new method creates and returns a new CPolygon object.
P = CPolygon:new() P = CPolygon:new( CPolygonOld ) P = CPolygon:new( arrayX, arrayY ) where
|
The following script illustrates using various forms of CPolygon:new.
|
|
|
-- create a CPolygon A |
|
-- result: [0,0] = 0 |
|
|
|
-- copy CPolygon A to a new CPolygon B |
|
-- specify the center values |
|
-- result: [2.5,-2.1] = 0 |
|
|
|
-- create some x and y data |
|
-- create a CPolygon C from arrays |
|
-- calculate the center of mass |
|
-- result: [5.5,-1.25] = 4 |