Vector4

Hierarchy

  • Vector4

Index

Constructors

constructor

  • new Vector4(x: number, y: number, z: number, w: number): Vector4
  • Creates a Vector4 object from the given floats.

    Parameters

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

    Returns Vector4

Properties

w

w: number

x

x: number

y

y: number

z

z: number

Methods

add

  • Returns a new Vector4 as the result of the addition of the current Vector4 and the given one.

    Parameters

    Returns Vector4

addInPlace

  • Adds the given vector to the current Vector4. Returns the updated Vector4.

    Parameters

    Returns Vector4

addToRef

  • Updates the given vector "result" with the result of the addition of the current Vector4 and the given one. Returns the current Vector4.

    Parameters

    Returns Vector4

asArray

  • asArray(): number[]
  • Returns a new array populated with 4 elements : the Vector4 coordinates.

    Returns number[]

clone

  • Returns a new Vector4 copied from the current one.

    Returns Vector4

copyFrom

  • Updates the current Vector4 with the given one coordinates. Returns the updated Vector4.

    Parameters

    Returns Vector4

copyFromFloats

  • copyFromFloats(x: number, y: number, z: number, w: number): Vector4
  • Updates the current Vector4 coordinates with the given floats. Returns the updated Vector4.

    Parameters

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

    Returns Vector4

divide

  • Returns a new Vector4 set with the division result of the current Vector4 by the given one.

    Parameters

    Returns Vector4

divideInPlace

  • Divides the current Vector3 coordinates by the given ones.

    Parameters

    Returns Vector4

    the updated Vector3.

divideToRef

  • Updates the given vector "result" with the division result of the current Vector4 by the given one. Returns the current Vector4.

    Parameters

    Returns Vector4

equals

  • equals(otherVector: Vector4): boolean
  • Boolean : True if the current Vector4 coordinates are stricly equal to the given ones.

    Parameters

    Returns boolean

equalsToFloats

  • equalsToFloats(x: number, y: number, z: number, w: number): boolean
  • Boolean : True if the given floats are strictly equal to the current Vector4 coordinates.

    Parameters

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

    Returns boolean

equalsWithEpsilon

  • equalsWithEpsilon(otherVector: Vector4, epsilon?: number): boolean
  • Boolean : True if the current Vector4 coordinates are each beneath the distance "epsilon" from the given vector ones.

    Parameters

    • otherVector: Vector4
    • Optional epsilon: number

    Returns boolean

floor

  • Gets a new Vector4 from current Vector4 floored values

    Returns Vector4

    a new Vector4

fract

  • Gets a new Vector4 from current Vector3 floored values

    Returns Vector4

    a new Vector4

getClassName

  • getClassName(): string
  • Returns the string "Vector4".

    Returns string

getHashCode

  • getHashCode(): number
  • Returns the Vector4 hash code.

    Returns number

length

  • length(): number
  • Returns the Vector4 length (float).

    Returns number

lengthSquared

  • lengthSquared(): number
  • Returns the Vector4 squared length (float).

    Returns number

maximizeInPlace

  • Updates the Vector4 coordinates with the maximum values between its own and the given vector ones

    Parameters

    • other: Vector4

      defines the second operand

    Returns Vector4

    the current updated Vector4

minimizeInPlace

  • Updates the Vector4 coordinates with the minimum values between its own and the given vector ones

    Parameters

    • other: Vector4

      defines the second operand

    Returns Vector4

    the current updated Vector4

multiply

  • Returns a new Vector4 set with the multiplication result of the current Vector4 and the given one.

    Parameters

    Returns Vector4

multiplyByFloats

  • multiplyByFloats(x: number, y: number, z: number, w: number): Vector4
  • Returns a new Vector4 set with the multiplication result of the given floats and the current Vector4 coordinates.

    Parameters

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

    Returns Vector4

multiplyInPlace

  • Multiplies in place the current Vector4 by the given one. Returns the updated Vector4.

    Parameters

    Returns Vector4

multiplyToRef

  • Updates the given vector "result" with the multiplication result of the current Vector4 and the given one. Returns the current Vector4.

    Parameters

    Returns Vector4

negate

  • Returns a new Vector4 set with the current Vector4 negated coordinates.

    Returns Vector4

normalize

  • Normalizes in place the Vector4. Returns the updated Vector4.

    Returns Vector4

scale

  • Returns a new Vector4 set with the current Vector4 coordinates multiplied by scale (float).

    Parameters

    • scale: number

    Returns Vector4

scaleAndAddToRef

  • Scale the current Vector4 values by a factor and add the result to a given Vector4

    Parameters

    • scale: number

      defines the scale factor

    • result: Vector4

      defines the Vector4 object where to store the result

    Returns Vector4

    the unmodified current Vector4

scaleInPlace

  • scaleInPlace(scale: number): Vector4
  • Multiplies the current Vector4 coordinates by scale (float). Returns the updated Vector4.

    Parameters

    • scale: number

    Returns Vector4

scaleToRef

  • Sets the given vector "result" with the current Vector4 coordinates multiplied by scale (float). Returns the current Vector4.

    Parameters

    Returns Vector4

set

  • set(x: number, y: number, z: number, w: number): Vector4
  • Updates the current Vector4 coordinates with the given floats. Returns the updated Vector4.

    Parameters

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

    Returns Vector4

subtract

  • Returns a new Vector4 with the result of the subtraction of the given vector from the current Vector4.

    Parameters

    Returns Vector4

subtractFromFloats

  • subtractFromFloats(x: number, y: number, z: number, w: number): Vector4
  • Returns a new Vector4 set with the result of the subtraction of the given floats from the current Vector4 coordinates.

    Parameters

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

    Returns Vector4

subtractFromFloatsToRef

  • subtractFromFloatsToRef(x: number, y: number, z: number, w: number, result: Vector4): Vector4
  • Sets the given vector "result" set with the result of the subtraction of the given floats from the current Vector4 coordinates. Returns the current Vector4.

    Parameters

    • x: number
    • y: number
    • z: number
    • w: number
    • result: Vector4

    Returns Vector4

subtractInPlace

  • Subtract in place the given vector from the current Vector4. Returns the updated Vector4.

    Parameters

    Returns Vector4

subtractToRef

  • Sets the given vector "result" with the result of the subtraction of the given vector from the current Vector4. Returns the current Vector4.

    Parameters

    Returns Vector4

toArray

  • Populates the given array from the given index with the Vector4 coordinates. Returns the Vector4.

    Parameters

    Returns Vector4

toString

  • toString(): string
  • Returns the string with the Vector4 coordinates.

    Returns string

toVector3

  • Returns a new Vector3 from the Vector4 (x, y, z) coordinates.

    Returns Vector3

Static Center

  • Returns a new Vector4 located at the center between the vectors "value1" and "value2".

    Parameters

    Returns Vector4

Static Distance

  • Returns the distance (float) between the vectors "value1" and "value2".

    Parameters

    Returns number

Static DistanceSquared

  • Returns the squared distance (float) between the vectors "value1" and "value2".

    Parameters

    Returns number

Static FromArray

  • FromArray(array: ArrayLike<number>, offset?: number): Vector4
  • Returns a new Vector4 set from the starting index of the given array.

    Parameters

    • array: ArrayLike<number>
    • Optional offset: number

    Returns Vector4

Static FromArrayToRef

  • FromArrayToRef(array: ArrayLike<number>, offset: number, result: Vector4): void
  • Updates the given vector "result" from the starting index of the given array.

    Parameters

    • array: ArrayLike<number>
    • offset: number
    • result: Vector4

    Returns void

Static FromFloatArrayToRef

  • FromFloatArrayToRef(array: Float32Array, offset: number, result: Vector4): void
  • Updates the given vector "result" from the starting index of the given Float32Array.

    Parameters

    • array: Float32Array
    • offset: number
    • result: Vector4

    Returns void

Static FromFloatsToRef

  • FromFloatsToRef(x: number, y: number, z: number, w: number, result: Vector4): void
  • Updates the given vector "result" coordinates from the given floats.

    Parameters

    • x: number
    • y: number
    • z: number
    • w: number
    • result: Vector4

    Returns void

Static Maximize

Static Minimize

Static Normalize

  • Returns a new normalized Vector4 from the given one.

    Parameters

    Returns Vector4

Static NormalizeToRef

  • Updates the given vector "result" from the normalization of the given one.

    Parameters

    Returns void

Static One

  • Returns a new Vector4 set to (1.0, 1.0, 1.0, 1.0)

    Returns Vector4

Static TransformNormal

  • Returns a new Vector4 set with the result of the normal transformation by the given matrix of the given vector. This methods computes transformed normalized direction vectors only.

    Parameters

    Returns Vector4

Static TransformNormalFromFloatsToRef

  • TransformNormalFromFloatsToRef(x: number, y: number, z: number, w: number, transformation: Matrix, result: Vector4): void
  • Sets the given vector "result" with the result of the normal transformation by the given matrix of the given floats (x, y, z, w). This methods computes transformed normalized direction vectors only.

    Parameters

    • x: number
    • y: number
    • z: number
    • w: number
    • transformation: Matrix
    • result: Vector4

    Returns void

Static TransformNormalToRef

  • Sets the given vector "result" with the result of the normal transformation by the given matrix of the given vector. This methods computes transformed normalized direction vectors only.

    Parameters

    Returns void

Static Zero

  • Returns a new Vector4 set to (0.0, 0.0, 0.0, 0.0)

    Returns Vector4

Generated using TypeDoc