Constructors
constructor
-
Parameters
Properties
Protected ctor
Accessors
x
- get x(): number
- set x(x: number): any
-
Returns number
-
Parameters
Returns any
y
- get y(): number
- set y(y: number): any
-
Returns number
-
Parameters
Returns any
Methods
abs
-
Returns this
add
-
Parameters
Returns this
clone
-
cross
-
Parameters
Returns number
distance
-
Parameters
Returns number
divS
-
Parameters
Returns this
divV
-
Parameters
Returns this
divideByScalar
- divideByScalar(n: number): this
-
Parameters
Returns this
divideByVector
-
Parameters
Returns this
dot
-
Parameters
Returns number
equals
-
Parameters
Returns boolean
getX
-
Returns number
getY
-
Returns number
length
-
Returns number
lengthSq
-
Returns number
magnitude
-
Returns number
mulS
-
Parameters
Returns this
mulV
-
Parameters
Returns this
multiplyByScalar
- multiplyByScalar(n: number): this
-
Parameters
Returns this
multiplyByVector
-
Parameters
Returns this
normalise
-
Returns this
normalize
-
Returns this
reverse
-
Returns this
rotate
- rotate(rads: number): this
-
Parameters
Returns this
round
-
Parameters
-
Default value n: number = 2
Returns this
setAxes
- setAxes(x: number, y: number): this
-
Parameters
Returns this
setX
-
Parameters
Returns this
setY
-
Parameters
Returns this
subtract
-
Parameters
Returns this
toArray
-
Returns number[]
toObject
-
Returns object
toString
- toString(round?: boolean): string
-
Parameters
-
Default value round: boolean = false
Returns string
unit
-
Returns this
zero
-
Returns this
The class that all other vector representations are derived from.
Contains the core implementation for all methods that will be exposed by vector instances.
Example of creating a custom implementation:
import { AbstractVector } from "./AbstractVector" export class MyCustomVector extends AbstractVector { constructor (x: number, y: number) { super(CustomVectorType) } }