For the complete documentation index, see llms.txt. This page is also available as Markdown.

ScaleBy

Introduction

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.

ScaleBy.png

Scaling multiple times

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:

Preserving original shape

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:

BoundingRadius

ScaleBy will modify the BoundingRadius of the calling Polygon is used internally for collisions. There is no need to call OptimizeRadius after calling ScaleBy.

Last updated

Was this helpful?