Skip to content

@vaguevoid/fiasco / math/vector / clampMagnitude

Function: clampMagnitude()

clampMagnitude(origin, target, max): object

Defined in: src/math/vector.ts:17

Parameters

origin

Vec2

xy coordinate representing the start of the vector

target

Vec2

xy coordinate representing the end of the vector

max

number

inclusive maximum magnitude of the vector

Returns

object

vector clamped to this magnitude

x

x: number

y

y: number