Constructors
constructor
- new Vector2(x: number, y: number): Vector2
-
Properties
type
type: string = "vec2"
Accessors
Length
- get Length(): number
-
Returns number
Methods
add
- add(v: number | Vector2Type): Vector2
-
distance
- distance(v: Vector2Type): number
-
Returns number
distanceSquared
- distanceSquared(v: Vector2Type): number
-
Returns number
divide
- divide(v: number | Vector2Type): Vector2
-
dotProduct
- dotProduct(v: Vector2Type): number
-
Returns number
multiply
- multiply(v: number | Vector2Type): Vector2
-
replace
- replace(v: Vector2Type): void
-
Returns void
toArray
- toArray(): [number, number]
-
Returns [number, number]
Static
add
- add(v1: Vector2Type, v2: number | Vector2Type): Vector2
-
Parameters
-
v1: Vector2Type
-
v2: number | Vector2Type
Static
divide
- divide(v1: Vector2Type, v2: number | Vector2Type): Vector2
-
Parameters
-
v1: Vector2Type
-
v2: number | Vector2Type
Static
dotProduct
- dotProduct(v1: Vector2Type, v2: Vector2Type): number
-
Parameters
-
v1: Vector2Type
-
v2: Vector2Type
Returns number
Static
fromArray
- fromArray(primitive: number[] | [number, number]): Vector2
-
Parameters
-
primitive: number[] | [number, number]
Static
fromArrays
- fromArrays(primitives: [number, number][] | number[][]): Vector2[]
-
Parameters
-
primitives: [number, number][] | number[][]
Static
multiply
- multiply(v1: Vector2Type, v2: number | Vector2Type): Vector2
-
Parameters
-
v1: Vector2Type
-
v2: number | Vector2Type
Static
subtract
- subtract(v1: Vector2Type, v2: number | Vector2Type): Vector2
-
Parameters
-
v1: Vector2Type
-
v2: number | Vector2Type
The distance between two Vectors.
Returns
Distance between this and another vector.