[Core] Add scalar versions of Vector* min/max/clamp/snap(ped)

Convenience for a number of cases operating on single values
This commit is contained in:
A Thousand Ships
2024-03-03 14:37:52 +01:00
parent f91db3dc58
commit 308dbb8c63
73 changed files with 588 additions and 105 deletions

View File

@ -64,6 +64,14 @@
Returns a new vector with all components clamped between the components of [param min] and [param max], by running [method @GlobalScope.clamp] on each component.
</description>
</method>
<method name="clampi" qualifiers="const">
<return type="Vector2i" />
<param index="0" name="min" type="int" />
<param index="1" name="max" type="int" />
<description>
Returns a new vector with all components clamped between [param min] and [param max], by running [method @GlobalScope.clamp] on each component.
</description>
</method>
<method name="distance_squared_to" qualifiers="const">
<return type="int" />
<param index="0" name="to" type="Vector2i" />
@ -117,6 +125,13 @@
Returns a new vector with each component snapped to the closest multiple of the corresponding component in [param step].
</description>
</method>
<method name="snappedi" qualifiers="const">
<return type="Vector2i" />
<param index="0" name="step" type="int" />
<description>
Returns a new vector with each component snapped to the closest multiple of [param step].
</description>
</method>
</methods>
<members>
<member name="x" type="int" setter="" getter="" default="0">