Skip to main content

Class: VectorMath

Methods

IsZeroVector()

static IsZeroVector(val): boolean

Parameters

val: IVector3

Returns

boolean


SliceLine()

static SliceLine(start, end, sliceLength?): IVector3[]

Slices a line into a set of points based on the specified slice length.

Parameters

start: IVector3

The starting point of the line.

end: IVector3

The ending point of the line.

sliceLength?: number

The length of each slice. Defaults to 20.

Returns

IVector3[]

An array of points that represent the sliced line.


Vector2Distance()

static Vector2Distance(a, b): number

Calculates the distance between two 3D vectors.

Parameters

a: IVector3

The first vector.

b: IVector3

The second vector.

Returns

number

The distance between the two vectors.


Vector3Add()

static Vector3Add(start, end): {x: number;y: number;z: number; }

Adds two 3D vectors together.

Parameters

start: IVector3

The starting vector.

end: IVector3

The ending vector.

Returns

{x: number;y: number;z: number; }

The sum of the two vectors.

x

x: number

y

y: number

z

z: number


Vector3Distance()

static Vector3Distance(a, b): number

Calculates the distance between two 3D vectors.

Parameters

a: IVector3

The first vector.

b: IVector3

The second vector.

Returns

number

The distance between the two vectors.


Vector3Lerp()

static Vector3Lerp(start, end, amount): {x: number;y: number;z: number; }

Calculates the linear interpolation between two 3D vectors.

Parameters

start: IVector3

The starting vector.

end: IVector3

The ending vector.

amount: number

The amount of interpolation between the two vectors, where 0 indicates start and 1 indicates end.

Returns

{x: number;y: number;z: number; }

The interpolated vector.

x

x: number

y

y: number

z

z: number


Vector3Normalize()

static Vector3Normalize(vector): {x: number;y: number;z: number; }

Calculates the normalized version of a 3D vector.

Parameters

vector: IVector3

The vector to normalize.

Returns

{x: number;y: number;z: number; }

The normalized vector.

x

x: number

y

y: number

z

z: number


Vector3RotationBetween()

static Vector3RotationBetween(posA, posB): number

Parameters

posA: IVector3

posB: IVector3

Returns

number


Vector3Scale()

static Vector3Scale(vector, scalar): {x: number;y: number;z: number; }

Calculates the scaled version of a 3D vector.

Parameters

vector: IVector3

The vector to scale.

scalar: number

The scalar value to multiply with.

Returns

{x: number;y: number;z: number; }

The scaled vector.

x

x: number

y

y: number

z

z: number


Vector3Sub()

static Vector3Sub(start, end): {x: number;y: number;z: number; }

Calculates the difference between two 3D vectors.

Parameters

start: IVector3

The starting vector.

end: IVector3

The ending vector.

Returns

{x: number;y: number;z: number; }

The difference between the two vectors.

x

x: number

y

y: number

z

z: number