Utilities operating on Vector3 objects.

This is a mixture of the Vector3Builder and Vector3Utils classes.

Hierarchy (View Summary)

Implements

Constructors

Properties

back: { x: 0; y: 0; z: -1 } & Vector3 = ...

back

A unit vector representing the world BACK direction (0,0,-1)

down: { x: 0; y: -1; z: 0 } & Vector3 = ...

down

A unit vector representing the world DOWN direction (0,-1,0)

east: { x: 1; y: 0; z: 0 } & Vector3 = ...

east

A unit vector representing the world EAST direction (1,0,0) (same as RIGHT)

forward: { x: 0; y: 0; z: 1 } & Vector3 = ...

forward

A unit vector representing the world FORWARD direction (0,0,1)

left: { x: -1; y: 0; z: 0 } & Vector3 = ...

left

A unit vector representing the world LEFT direction (-1,0,0)

north: { x: 0; y: 0; z: 1 } & Vector3 = ...

north

A unit vector representing the world NORTH direction (0,0,1) (same as FORWARD)

one: { x: 1; y: 1; z: 1 } & Vector3 = ...

one

A unit vector representing the value of 1 in all directions (1,1,1)

right: { x: 1; y: 0; z: 0 } & Vector3 = ...

right

A unit vector representing the world RIGHT direction (1,0,0)

south: { x: 0; y: 0; z: -1 } & Vector3 = ...

south

A unit vector representing the world SOUTH direction (0,0,-1) (same as BACK)

up: { x: 0; y: 1; z: 0 } & Vector3 = ...

up

A unit vector representing the world UP direction (0,1,0)

west: { x: -1; y: 0; z: 0 } & Vector3 = ...

west

A unit vector representing the world WEST direction (-1,0,0) (same as LEFT)

x: number

X component of this vector.

y: number

Y component of this vector.

z: number

Z component of this vector.

zero: { x: 0; y: 0; z: 0 } & Vector3 = ...

zero

A unit vector representing the value of 0 in all directions (0,0,0)

add: (v1: Vector3, v2: Partial<Vector3>) => Vector3 = Vector3Utils.add

add

Add two vectors to produce a new vector

back: { x: 0; y: 0; z: -1 } & Vector3 = ...

back

A unit vector representing the world BACK direction (0,0,-1)

clamp: (
    v: Vector3,
    limits?: { max?: Partial<Vector3>; min?: Partial<Vector3> },
) => Vector3 = Vector3Utils.clamp

clamp

Clamps the components of a vector to limits to produce a new vector

cross: (a: Vector3, b: Vector3) => Vector3 = Vector3Utils.cross

cross

Calculate the cross product of two vectors. Returns a new vector.

distance: (a: Vector3, b: Vector3) => number = Vector3Utils.distance

distance

Calculate the distance between two vectors

dot: (a: Vector3, b: Vector3) => number = Vector3Utils.dot

dot

Calculate the dot product of two vectors

down: { x: 0; y: -1; z: 0 } & Vector3 = ...

down

A unit vector representing the world DOWN direction (0,-1,0)

east: { x: 1; y: 0; z: 0 } & Vector3 = ...

east

A unit vector representing the world EAST direction (1,0,0) (same as RIGHT)

equals: (v1: Vector3, v2: Vector3) => boolean = Vector3Utils.equals

equals

Check the equality of two vectors

floor: (v: Vector3) => Vector3 = Vector3Utils.floor

floor

Floor the components of a vector to produce a new vector

forward: { x: 0; y: 0; z: 1 } & Vector3 = ...

forward

A unit vector representing the world FORWARD direction (0,0,1)

left: { x: -1; y: 0; z: 0 } & Vector3 = ...

left

A unit vector representing the world LEFT direction (-1,0,0)

lerp: (a: Vector3, b: Vector3, t: number) => Vector3 = Vector3Utils.lerp

lerp

Constructs a new vector using linear interpolation on each component from two vectors.

magnitude: (v: Vector3) => number = Vector3Utils.magnitude

magnitude

The magnitude of a vector

multiply: (a: Vector3, b: Vector3) => Vector3 = Vector3Utils.multiply

multiply

Element-wise multiplication of two vectors together. Not to be confused with Vector3Utils.dot product or Vector3Utils.cross product

normalize: (v: Vector3) => Vector3 = Vector3Utils.normalize

normalize

Takes a vector 3 and normalizes it to a unit vector

north: { x: 0; y: 0; z: 1 } & Vector3 = ...

north

A unit vector representing the world NORTH direction (0,0,1) (same as FORWARD)

one: { x: 1; y: 1; z: 1 } & Vector3 = ...

one

A unit vector representing the value of 1 in all directions (1,1,1)

right: { x: 1; y: 0; z: 0 } & Vector3 = ...

right

A unit vector representing the world RIGHT direction (1,0,0)

rotateX: (v: Vector3, a: number) => Vector3 = Vector3Utils.rotateX

rotateX

Rotates the vector around the x axis counterclockwise (left hand rule)

Type declaration

rotateY: (v: Vector3, a: number) => Vector3 = Vector3Utils.rotateY

rotateY

Rotates the vector around the y axis counterclockwise (left hand rule)

Type declaration

rotateZ: (v: Vector3, a: number) => Vector3 = Vector3Utils.rotateZ

rotateZ

Rotates the vector around the z axis counterclockwise (left hand rule)

Type declaration

scale: (v1: Vector3, scale: number) => Vector3 = Vector3Utils.scale

scale

Multiple all entries in a vector by a single scalar value producing a new vector

slerp: (a: Vector3, b: Vector3, t: number) => Vector3 = Vector3Utils.slerp

slerp

Constructs a new vector using spherical linear interpolation on each component from two vectors.

south: { x: 0; y: 0; z: -1 } & Vector3 = ...

south

A unit vector representing the world SOUTH direction (0,0,-1) (same as BACK)

subtract: (v1: Vector3, v2: Partial<Vector3>) => Vector3 = Vector3Utils.subtract

subtract

Subtract two vectors to produce a new vector (v1-v2)

toString: (
    v: Vector3,
    options?: { decimals?: number; delimiter?: string },
) => string = Vector3Utils.toString

toString

Create a string representation of a vector3

Type declaration

    • (v: Vector3, options?: { decimals?: number; delimiter?: string }): string
    • toString

      Create a string representation of a vector3

      Parameters

      • v: Vector3
      • Optionaloptions: { decimals?: number; delimiter?: string }

      Returns string

up: { x: 0; y: 1; z: 0 } & Vector3 = ...

up

A unit vector representing the world UP direction (0,1,0)

west: { x: -1; y: 0; z: 0 } & Vector3 = ...

west

A unit vector representing the world WEST direction (-1,0,0) (same as LEFT)

zero: { x: 0; y: 0; z: 0 } & Vector3 = ...

zero

A unit vector representing the value of 0 in all directions (0,0,0)

Methods