CPolygon:GetRect
The GetRect method returns the bounding rectangle for the CPolygon.
R = CPolygon:GetRect() where |
R is a CRect object containing the extrema of the CPolygon.
This method simply returns the current values for the bounding rectangle. It does not update the calculation of the bounding rectangle after the vertex set is changed by adding or deleting points. In that case, use CalcRect to update the bounding rectangle.
The following script creates a CPolygon from 2 arrays and returns the bounding rectangle:
|
-- create CPolygon A |
|
-- result: R = [4:7,-3:5] |
|
|
|
-- add another point |
|
-- result: R = [4:7,-3:5] |
|
|
|
-- update the bounding rectangle |
|
-- result: R = [-2:7,-3:9] |