Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Vector4

Serializable THREE.js Vector4

Hierarchy

  • Vector4
    • Vector4

Index

Constructors

constructor

  • new Vector4(x?: number, y?: number, z?: number, w?: number): Vector4
  • Parameters

    • Optional x: number
    • Optional y: number
    • Optional z: number
    • Optional w: number

    Returns Vector4

Properties

height

height: number

Readonly isVector4

isVector4: true

w

w: number

width

width: number

x

x: number

y

y: number

z

z: number

Methods

add

  • Adds v to this vector.

    Parameters

    • v: Vector4

    Returns Vector4

addScalar

  • addScalar(scalar: number): Vector4
  • Parameters

    • scalar: number

    Returns Vector4

addScaledVector

  • addScaledVector(v: Vector4, s: number): Vector4
  • Parameters

    • v: Vector4
    • s: number

    Returns Vector4

addVectors

  • addVectors(a: Vector4, b: Vector4): Vector4
  • Sets this vector to a + b.

    Parameters

    • a: Vector4
    • b: Vector4

    Returns Vector4

applyMatrix4

  • applyMatrix4(m: Matrix4): Vector4
  • Parameters

    • m: Matrix4

    Returns Vector4

ceil

  • Returns Vector4

clamp

  • clamp(min: Vector4, max: Vector4): Vector4
  • Parameters

    • min: Vector4
    • max: Vector4

    Returns Vector4

clampScalar

  • clampScalar(min: number, max: number): Vector4
  • Parameters

    • min: number
    • max: number

    Returns Vector4

clone

copy

  • Copies value of v to this vector.

    Parameters

    • v: Vector4

    Returns Vector4

divideScalar

  • Divides this vector by scalar s. Set vector to ( 0, 0, 0 ) if s == 0.

    Parameters

    • s: number

    Returns Vector4

dot

  • dot(v: Vector4): number
  • Computes dot product of this vector and v.

    Parameters

    • v: Vector4

    Returns number

equals

  • equals(v: Vector4): boolean
  • Checks for strict equality of this vector and v.

    Parameters

    • v: Vector4

    Returns boolean

floor

  • Returns Vector4

fromArray

  • fromArray(array: number[] | ArrayLike<number>, offset?: number): Vector4
  • Sets this vector's x, y, z and w value from the provided array or array-like.

    Parameters

    • array: number[] | ArrayLike<number>

      the source array or array-like.

    • Optional offset: number

      (optional) offset into the array. Default is 0.

    Returns Vector4

fromBufferAttribute

  • fromBufferAttribute(attribute: BufferAttribute, index: number): Vector4
  • Parameters

    • attribute: BufferAttribute
    • index: number

    Returns Vector4

getComponent

  • getComponent(index: number): number
  • Parameters

    • index: number

    Returns number

length

  • length(): number
  • Computes length of this vector.

    Returns number

lengthSq

  • lengthSq(): number
  • Computes squared length of this vector.

    Returns number

lerp

  • lerp(v: Vector4, alpha: number): Vector4
  • Linearly interpolate between this vector and v with alpha factor.

    Parameters

    • v: Vector4
    • alpha: number

    Returns Vector4

lerpVectors

  • lerpVectors(v1: Vector4, v2: Vector4, alpha: number): Vector4
  • Parameters

    • v1: Vector4
    • v2: Vector4
    • alpha: number

    Returns Vector4

manhattanLength

  • manhattanLength(): number
  • Computes the Manhattan length of this vector.

    see Wikipedia: Taxicab Geometry

    Returns number

max

  • Parameters

    • v: Vector4

    Returns Vector4

min

  • Parameters

    • v: Vector4

    Returns Vector4

multiply

  • Parameters

    • v: Vector4

    Returns Vector4

multiplyScalar

  • multiplyScalar(s: number): Vector4
  • Multiplies this vector by scalar s.

    Parameters

    • s: number

    Returns Vector4

negate

  • Inverts this vector.

    Returns Vector4

normalize

  • Normalizes this vector.

    Returns Vector4

random

  • Sets this vector's x, y, z and w from Math.random

    Returns Vector4

round

  • Returns Vector4

roundToZero

  • Returns Vector4

set

  • set(x: number, y: number, z: number, w: number): Vector4
  • Sets value of this vector.

    Parameters

    • x: number
    • y: number
    • z: number
    • w: number

    Returns Vector4

setAxisAngleFromQuaternion

  • setAxisAngleFromQuaternion(q: Quaternion): Vector4

setAxisAngleFromRotationMatrix

  • setAxisAngleFromRotationMatrix(m: Matrix4): Vector4

setComponent

  • setComponent(index: number, value: number): Vector4
  • Parameters

    • index: number
    • value: number

    Returns Vector4

setLength

  • setLength(length: number): Vector4
  • Normalizes this vector and multiplies it by l.

    Parameters

    • length: number

    Returns Vector4

setScalar

  • setScalar(scalar: number): Vector4
  • Sets all values of this vector.

    Parameters

    • scalar: number

    Returns Vector4

setW

  • Sets w component of this vector.

    Parameters

    • w: number

    Returns Vector4

setX

  • Sets X component of this vector.

    Parameters

    • x: number

    Returns Vector4

setY

  • Sets Y component of this vector.

    Parameters

    • y: number

    Returns Vector4

setZ

  • Sets Z component of this vector.

    Parameters

    • z: number

    Returns Vector4

sub

  • Subtracts v from this vector.

    Parameters

    • v: Vector4

    Returns Vector4

subScalar

  • Parameters

    • s: number

    Returns Vector4

subVectors

  • subVectors(a: Vector4, b: Vector4): Vector4
  • Sets this vector to a - b.

    Parameters

    • a: Vector4
    • b: Vector4

    Returns Vector4

toArray

  • toArray(array?: number[], offset?: number): number[]
  • toArray(array?: Vector4Tuple, offset?: 0): Vector4Tuple
  • toArray(array: ArrayLike<number>, offset?: number): ArrayLike<number>
  • Returns an array [x, y, z, w], or copies x, y, z and w into the provided array.

    Parameters

    • Optional array: number[]

      (optional) array to store the vector to. If this is not provided, a new array will be created.

    • Optional offset: number

      (optional) optional offset into the array.

    Returns number[]

    The created or provided array.

  • Parameters

    • Optional array: Vector4Tuple
    • Optional offset: 0

    Returns Vector4Tuple

  • Copies x, y, z and w into the provided array-like.

    Parameters

    • array: ArrayLike<number>

      array-like to store the vector to.

    • Optional offset: number

      (optional) optional offset into the array-like.

    Returns ArrayLike<number>

    The provided array-like.

Static fromArray

  • fromArray(array: number[]): Vector4