ScaleBy
Last updated
The ScaleBy method can be used to adjust a Polygon's points to make it larger or smaller. The ScaleBy method is relative to the current state of the polygon. This means that calling ScaleBy with any number other than 1 multiple times will continually change the polygon.
Calling ScaleBy multiple times will continually change the polygon. For example:
will double the relative value of each point. Calling the method again will double it once more.
Ignoring floating point inaccuracy, the following line of code will result in no changes to a Polygon:
Since ScaleBy modifies the points on a Polygon, the Polygon has no built-in way to preserve the original shape of the polygon. To do so, you will have to keep track of that information yourself:
ScaleBy will modify the BoundingRadius of the calling Polygon is used internally for collisions. There is no need to call OptimizeRadius after calling ScaleBy.