# vector

Interact with mathematical objects.

## Functions:

### Initialization

The constructor `vector(float x, float y, float z)`

initializes a vector with the specified `x`

, `y`

, and `z`

.

### Equal

Returns true if the current vector is equal to another vector.

### Zero

Returns true if all values of the vector are zero.

### Scale

Scales the vector by a given factor and returns a new vector with the scaled values, without modifying the original vector.

### Length

Calculates and returns the length (magnitude) of the vector.

### Length 2D

Calculates and returns the 2D length (magnitude) of the vector, using only the `x`

and `y`

components.

### Square Length

Calculates and returns the squared length (magnitude) of the vector, which is the sum of the squares of its components.

### Square Length 2D

Calculates and returns the squared length of the vector in 2D space, using only the `x`

and `y`

components.

### Dot

Calculates and returns the dot product of the current vector with another vector.

### Cross

Computes and returns the cross product of the current vector with another vector.

### Distance

Calculates and returns the distance between the current vector and another vector.

### Unpack

Returns the vector's components (e.g., `x`

, `y`

, `z`

)

### Normalize

Normalizes the vector (scales it to a unit length) and returns the result. If the vector has zero length, it returns the original vector unchanged.

Last updated