Options
All
• Public
• Public/Protected
• All

# Class Vec

Vec provides static function for vector operations. It's not yet optimized but good enough to use.

• Vec

## Methods

### Static abs

• Set `a` to its absolute value in each dimension

#### Returns PtLike

vector `a`

• Add b to vector `a`

#### Returns PtLike

vector `a`

### Static ceil

• Set `a` to its ceiling value in each dimension

#### Returns PtLike

vector `a`

### Static cross

• 3D Cross product of `a` and `b`

### Static cross2D

• 2D cross product of `a` and `b`

### Static divide

• Divide `a` over `b`

#### Returns PtLike

vector `a`

### Static dot

• Dot product of `a` and `b`

### Static floor

• Set `a` to its floor value in each dimension

#### Returns PtLike

vector `a`

### Static magnitude

• magnitude(a: PtLike): number
• Magnitude of `a`

### Static map

• Given a mapping function, update `a`'s value in each dimension

#### Parameters

• ##### fn: function
• (n: number, index: number, arr: any): number

#### Returns PtLike

vector `a`

### Static max

• Find the max value within a vector's dimensions

#### Returns object

an object with `value` and `index` that specifies the max value and its corresponding dimension.

### Static min

• Find the min value within a vector's dimensions

#### Returns object

an object with `value` and `index` that specifies the min value and its corresponding dimension.

### Static multiply

• Multiply `b` with vector `a`

#### Returns PtLike

vector `a`

### Static round

• Set `a` to its rounded value in each dimension

#### Returns PtLike

vector `a`

### Static subtract

• Subtract `b` from vector `a`

#### Returns PtLike

vector `a`

### Static sum

• Sum all the dimensions' values

### Static unit

• Unit vector of `a`. If magnitude of `a` is already known, pass it in the second paramter to optimize calculation.

#### Returns PtLike

Generated using TypeDoc