@studiokeywi/banjo - v0.0.1
    Preparing search index...

    Module math/v2

    2D vector math utilities

    studioKeywi

    Type Aliases

    Vector2

    2-dimensional Vector object

    Functions

    add

    Adds two vectors together by adding their respective components

    angleBetween

    Calculates the angle (in radians) between two provided vectors

    distance

    Calculates the distance between two provided vectors by calculating the effective hypotenuse between them

    distanceSq

    Calculates the squared distance between two provided vectors by calculating the effective hypotenuse between them

    dot

    Calculates the dot product of two provided vectors, which is a value representing the similarity of the two

    down

    Unit vector (0, 1)

    downLeft

    Unit vector (-1, 1)

    downRight

    Unit vector (1, 1)

    hash

    Hashes a given vector's coordinates using a negative-integer friendly version of the Szudzik pairing function

    left

    Unit vector (-1, 0)

    length

    Calculates the magnitude of the vector provided by calculating its effective hypotenuse

    lengthSq

    Calculates the squared magnitude of the vector provided by calculating its effective hypotenuse

    lerpVectors

    Calculates a linear interpolation between two vectors based on some "transition point" t. Will clamp the value of t to [0, 1]

    lerpVectorsUnclamped

    Calculates a linear interpolation between two vectors based on some "transition point" t

    normalize

    Calculates the equivalent of a vector whose magnitude is 1

    normProject

    Calculates the projection of one normalized vector against another

    normReflect

    Calculates the reflection of one normalized vector against an axis

    one

    Unit vector (1, 1)

    origin

    Unit vector (0, 0)

    perpendicular

    Calculates a perpendicular vector. Equivalent to the vector rotated 90 degrees counter-clockwise

    project

    Calculates the projection of one vector against another

    reflect

    Calculates the reflection of one vector against an axis

    reverse

    Calculates the reverse of a vector. Equivalent to the vector rotated 180 degrees counter-clockwise

    Unit vector (1, 0)

    rotate

    Calculates the rotation of a vector by a given angle (in radians)

    scale

    Calculates the scaled version of a vector

    subtract

    Subtracts two vectors together by subtracting their respective components

    up

    Unit vector (0, -1)

    upLeft

    Unit vector (-1, -1)

    upRight

    Unit vector (1, -1)

    vector2

    Create a new vector set with values of [0, 0]

    zero

    Unit vector (0, 0)