# BBMOD_Vec2

constructor

``new BBMOD_Vec2([_x[, _y]])``

A 2D vector.

## Arguments

Name Type Description
_x `Real` The first component of the vector. Defaults to 0.
_y `Real/Undefined` The second component of the vector. Defaults to `_x`.

## Properties

Name Description
X The first component of the vector.
Y The second component of the vector.

## Methods

Name Description
Abs Creates a new vector where each component is equal to the absolute value of the original component.
Ceil Applies function `ceil` to each component of the vector and returns the result as a new vector.
Clamp Clamps each component of the vector between corresponding components of `_min` and `_max` and returns the result as a new vector.
ClampLength Clamps the length of the vector between `_min` and `_max` and returns the result as a new vector.
Clone Creates a clone of the vector.
Copy Copies components of the vector to the `_dest` vector.
Dot Computes the dot product of this vector and vector `_v`.
Equals Checks whether this vectors equals to vector `_v`.
Floor Applies function `floor` to each component of the vector and returns the result as a new vector.
Frac Applies function `frac` to each component of the vector and returns the result as a new vector.
FromArray Loads vector components from an array.
FromBarycentric Computes the vector components using a formula `_v1 + _f * (_v2 - _v1) + _g * (_v3 - _v1)`.
FromBuffer Loads vector components from a buffer.
Get Retrieves vector component at given index (0 is X, 1 is Y, etc.).
Length Computes the length of the vector.
LengthSqr Computes a squared length of the vector.
Lerp Linearly interpolates between vector `_v` by the given amount.
MaxComponent Computes the greatest component of the vector.
Maximize Creates a new vector where each component is the maximum component from this vector and vector `_v`.
MinComponent Computes the smallest component of the vector.
Minimize Creates a new vector where each component is the minimum component from this vector and vector `_v`.
Mul Multiplies the vector with vector `_v` and returns the result as a new vector.
Normalize Normalizes the vector and returns the result as a new vector.
Reflect Reflects the vector from vector `_v` and returns the result as a new vector.
Round Applies function `round` to each component of the vector and returns the result as a new vector.
Scale Scales each component of the vector by `_s` and returns the result as a new vector.
Set Sets vector components in-place.
SetIndex Sets vector component in-place.
Sub Subtracts vector `_v` from this vector and returns the result as a new vector.
ToArray Writes the components of the vector into the target array.
ToBuffer Writes the components of the vector into the buffer.
Transform Transforms vector `(X, Y, 0.0, 1.0)` by a matrix and returns the result as a new vector.