Options
All
• Public
• Public/Protected
• All

# Class Vector

The main Vector class

• Vector

## Constructors

### constructor

• new Vector(x?: number, y?: number): Vector

x: number

y: number

## Accessors

### angle

• get angle(): number
• Get the angle of the instance Vector in radiants

### length

• get length(): number
• Get the length of the vector (alias for magnitude)

### magnitude

• get magnitude(): number
• Get the magnitude of the vector

### max

• get max(): number
• Get max scalar

### min

• get min(): number
• Get min scalar

## Methods

• Add a Vector or scalar to the instance

### angleTo

• Get the angle from the instance to another Vector in radians

### clone

• Get new instance of the Vector

### crossProduct

• Cross product of the instance and some Vector or Point

### divide

• Divide the instance with a Vector or scalar

### dotProduct

• Scalar product of the instance and some Vector or Point

### equals

• Checks if an Vector or Point is equal to the instance

### inverse

• Inverse the instance Vector

### multiply

• Multiply the instance with a Vector or scalar

### normalize

• Normalize the instance Vector

### set

• set(x: number, y: number): Vector
• Set the scalars of the Vector

### sub

• Subtract a Vector or scalar from the instance

### toArray

• toArray(): number[]
• Return a array with the scalars of the instance Vector

#### Returns number[]

• Add an Vector or scalar to a Vector or Point

### Static angleBetween

• Get the angle between two vectors in radiants

### Static closestPointBetween

• Calculate a Vector, that is the closest to the point, on a line between two vectors

### Static crossProduct

• Get the cross product of two Vectors or Points

### Static distance

• Get the distance between to Vectors

### Static divide

• Divide a Vector or Point with a Vector or scalar

### Static dotProduct

• Get the scalar product of two Vectors or Points

### Static equals

• Checks if two Vectors or Points are equal to each other

### Static fromArray

• fromArray(array: number[]): Vector
• Create a Vector from the first two values of a array

### Static inverse

• Inverse a vector

### Static isOnLine

• Check, if a Vector is on a line between two Vectors

### Static multiply

• Multiply a Vector or Point with a Vector or scalar

### Static normalize

• Divide a vector with his magnitude

### Static pointBetween

• Calculate a Vector, that is on a line between two points

### Static sub

• Subtract an Vector or scalar from a Vector or Point

#### Returns Vector

Generated using TypeDoc