# Class `Vec3`

Rudimentary 3D vector implementation with some 2D functionality.

Altered (as in functional) version of a library Vector3.

### Info:

• Author: Gordon MacPherson

## Methods

 Vec3:AsSpringVector () Returns vector in the form that Spring expects. Vec3:Cross (vector) Computes the cross product with another vector. Vec3:Distance (vector) Computes the distance between two vectors. Vec3:DotProduct (vector) Computes a dot product with another vector. Vec3:Length () Computes the length of the vector. Vec3:LengthSqr () Computes the square length of the vector. Vec3:Mul (n) Multiplies the vector by the given number in-place. Vec3:Normalize () Normalizes the vector in-place. Vec3:Rotate2D (angle) Rotates vector around Y axis by given angle in degrees in-place. Vec3:ToHeading () Convert vector in 2D heading in degrees between 0-360 Vec3:Zero () Sets the current instance to zeros.

## Methods

Vec3:AsSpringVector ()
Returns vector in the form that Spring expects.

### Returns:

{number} List of X, Y, Z coordinates
Vec3:Cross (vector)
Computes the cross product with another vector.

### Parameters:

• vector Vec3 The other vector.

### Returns:

Vec3 The cross product.
Vec3:Distance (vector)
Computes the distance between two vectors.

### Parameters:

• vector Vec3 The other vector.
Vec3:DotProduct (vector)
Computes a dot product with another vector.

### Parameters:

• vector Vec3 The other vector.
Vec3:Length ()
Computes the length of the vector.
Vec3:LengthSqr ()
Computes the square length of the vector.
Vec3:Mul (n)
Multiplies the vector by the given number in-place.

• n

### Returns:

`self`
Vec3:Normalize ()
Normalizes the vector in-place.

### Returns:

`self`
Vec3:Rotate2D (angle)
Rotates vector around Y axis by given angle in degrees in-place. A mathematically correct variant = negative angle values implies clockwise rotation.

### Parameters:

• angle number Angle in X-Z plane.

### Returns:

`self`
`self`