# Vector

Vector

## Functions

Function Name Usage Description Notes
New `Vector Vector.New(number x, number y, number z)` Construct a new Vector with the given x, y and z components, where z is generally up.
Normalize `Vector vec:Normalize()` Return a normalized Vector (where the length is 1.0)
Length `number vec:Length()` Return the length of the given Vector.
SquaredLength `number vec:SquaredLength()` Return the square of the length of the given Vector.
Distance `number Vector.Distance(Vector vec1, Vector vec2)` Return the distance between two Vector values.
SquaredDistance `number Vector.SquaredDistance(Vector vec1, Vector vec2)` Return the square of the distance of two Vector values.
Cross `Vector Vector.Cross(Vector vec1, Vector vec2)` Return the cross product of two Vector values.
Dot `number Vector.Dot(Vector vec1, Vector vec2)` Return the dot product of two Vector values.
Lerp `Vector Vector.Lerp(Vector vec1, Vector vec2, number alpha)` Linearly interpolate between vec1 and vec2 by the fraction alpha, where alpha is normally in the range [0,1]
Abs `Vector vec:Abs()` Return a Vector constructed from the absolute (ie positive or zero) x, y and z components of the given Vector.
Ceil `Vector vec:Ceil()` Returns a Vector constructed from the ceiling (ie next integer value) x, y and z components of the given Vector.
Floor `Vector vec:Floor()` Returns a Vector constructed from the floor (ie integer value below) x, y and z components of the given Vector.

## Parameters

Parameter Name Usage Description Notes
x `float x` X component of 3D vector
y `float y` Y component of 3D vector
z `float z` Z component of 3D vector

## Constants

Constant Name Usage Description Notes
Zero `Vector Vector.Zero` Zero vector (0, 0, 0)

## Overrides

Override Name Usage Description Notes
new_index `vector.var = object value`
addition `operator +` Add two Vector values together and return a new Vector of the result
subtraction `operator -` Subtract two Vector values and return a new Vector of the result
unary_minus `unary_minus` Negate a Vector value and return the result
multiplication `operator *`
division `operator /`
to_string `string tostring(Vector var)` Convert to a string