Options
All
  • Public
  • Public/Protected
  • All
Menu

Vector4 class created for EulerAngle class conversion to Quaternion

Hierarchy

  • Vector4

Index

Constructors

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

    Parameters

    • Optional x: number

      x value of the vector

    • Optional y: number

      y value of the vector

    • Optional z: number

      z value of the vector

    • Optional w: number

      w value of the vector

    Returns Vector4

Properties

w: number

w value of the vector

x: number

x value of the vector

y: number

y value of the vector

z: number

z value of the vector

Accessors

Methods

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

    Parameters

    Returns Vector4

    the resulting vector

  • Adds the given vector to the current Vector4.

    Parameters

    Returns Vector4

    the updated Vector4.

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

    Type Parameters

    Parameters

    Returns T

    result input

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

    Returns number[]

    the resulting array

  • Returns a new Vector4 copied from the current one.

    Returns Vector4

    the new cloned vector

  • Updates the current Vector4 with the given one coordinates.

    Parameters

    Returns Vector4

    the updated Vector4.

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

    Parameters

    • x: number

      float to copy from

    • y: number

      float to copy from

    • z: number

      float to copy from

    • w: number

      float to copy from

    Returns Vector4

    the updated Vector4.

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

    Parameters

    Returns Vector4

    resulting new vector

  • Divides the current Vector3 coordinates by the given ones.

    Parameters

    Returns Vector4

    the updated Vector3.

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

    Type Parameters

    Parameters

    Returns T

    result input

  • Boolean : True if the current Vector4 coordinates are stricly equal to the given ones.

    Parameters

    Returns boolean

    true if they are equal

  • 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

      x value to compare against

    • y: number

      y value to compare against

    • z: number

      z value to compare against

    • w: number

      w value to compare against

    Returns boolean

    true if equal

  • Boolean : True if the current Vector4 coordinates are each beneath the distance "epsilon" from the given vector ones.

    Parameters

    Returns boolean

    true if they are equal

  • Gets a new Vector4 from current Vector4 floored values

    Returns Vector4

    a new Vector4

  • Gets a new Vector4 from current Vector4 fractional values

    Returns Vector4

    a new Vector4

  • Update the current vector from an array

    Parameters

    • array: FloatArray

      defines the destination array

    • Optional index: number

      defines the offset in the destination array

    Returns Vector4

    the current Vector3

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

    Returns string

    "Vector4"

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

    Returns number

    a unique hash code

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

    Returns number

    the length

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

    Returns number

    the length squared

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

    Parameters

    Returns Vector4

    the current updated Vector4

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

    Parameters

    Returns Vector4

    the current updated Vector4

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

    Parameters

    Returns Vector4

    resulting new vector

  • 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

      x value multiply with

    • y: number

      y value multiply with

    • z: number

      z value multiply with

    • w: number

      w value multiply with

    Returns Vector4

    resulting new vector

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

    Parameters

    • otherVector: Vector4

      vector to multiple with

    Returns Vector4

    the updated Vector4.

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

    Type Parameters

    Parameters

    Returns T

    result input

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

    Returns Vector4

    a new vector with the negated values

  • Negate this vector in place

    Returns Vector4

    this

  • negateToRef<T>(result: T): T
  • Negate the current Vector4 and stores the result in the given vector "result" coordinates

    Type Parameters

    Parameters

    • result: T

      defines the Vector3 object where to store the result

    Returns T

    the result

  • Normalizes in place the Vector4.

    Returns Vector4

    the updated Vector4.

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

    Parameters

    • scale: number

      the number to scale with

    Returns Vector4

    a new vector with the result

  • scaleAndAddToRef<T>(scale: number, result: T): T
  • Scale the current Vector4 values by a factor and add the result to a given Vector4

    Type Parameters

    Parameters

    • scale: number

      defines the scale factor

    • result: T

      defines the Vector4 object where to store the result

    Returns T

    result input

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

    Parameters

    • scale: number

      the number to scale with

    Returns Vector4

    the updated Vector4.

  • scaleToRef<T>(scale: number, result: T): T
  • Sets the given vector "result" with the current Vector4 coordinates multiplied by scale (float).

    Type Parameters

    Parameters

    • scale: number

      the number to scale with

    • result: T

      a vector to store the result in

    Returns T

    result input

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

    Parameters

    • x: number

      float to set from

    • y: number

      float to set from

    • z: number

      float to set from

    • w: number

      float to set from

    Returns Vector4

    the updated Vector4.

  • Copies the given float to the current Vector3 coordinates

    Parameters

    • v: number

      defines the x, y, z and w coordinates of the operand

    Returns Vector4

    the current updated Vector3

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

    Parameters

    Returns Vector4

    the new vector with the result

  • 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

      value to subtract

    • y: number

      value to subtract

    • z: number

      value to subtract

    • w: number

      value to subtract

    Returns Vector4

    new vector containing the result

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

    Type Parameters

    Parameters

    • x: number

      value to subtract

    • y: number

      value to subtract

    • z: number

      value to subtract

    • w: number

      value to subtract

    • result: T

      the vector to store the result in

    Returns T

    result input

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

    Parameters

    Returns Vector4

    the updated Vector4.

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

    Type Parameters

    Parameters

    Returns T

    result input

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

    Parameters

    • array: FloatArray

      array to populate

    • Optional index: number

      index of the array to start at (default: 0)

    Returns Vector4

    the Vector4.

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

    Returns string

    a string containing all the vector values

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

    Returns Vector3

    this converted to a new vector3

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

    Parameters

    Returns Vector4

    the center between the two vectors

  • Gets the center of the vectors "value1" and "value2" and stores the result in the vector "ref"

    Type Parameters

    Parameters

    Returns T

    ref

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

    Parameters

    Returns number

    the distance between the two vectors

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

    Parameters

    Returns number

    the distance between the two vectors squared

  • Returns a new Vector4 set from the starting index of the given array.

    Parameters

    • array: DeepImmutableObject<ArrayLike<number>>

      the array to pull values from

    • Optional offset: number

      the offset into the array to start at

    Returns Vector4

    the new vector

  • Updates the given vector "result" from the starting index of the given array.

    Type Parameters

    Parameters

    • array: DeepImmutableObject<ArrayLike<number>>

      the array to pull values from

    • offset: number

      the offset into the array to start at

    • result: T

      the vector to store the result in

    Returns T

    result input

  • Updates the given vector "result" from the starting index of the given Float32Array.

    Type Parameters

    Parameters

    • array: DeepImmutableObject<Float32Array>

      the array to pull values from

    • offset: number

      the offset into the array to start at

    • result: T

      the vector to store the result in

    Returns T

    result input

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

    Type Parameters

    Parameters

    • x: number

      float to set from

    • y: number

      float to set from

    • z: number

      float to set from

    • w: number

      float to set from

    • result: T

      the vector to the floats in

    Returns T

    result input

  • Creates a new Vector4 from a Vector3

    Parameters

    • source: Vector3

      defines the source data

    • Optional w: number

      defines the 4th component (default is 0)

    Returns Vector4

    a new Vector4

  • Returns a vector with the maximum values from the left and right vectors

    Type Parameters

    Parameters

    Returns T

    a new vector with the maximum of the left and right vector values

  • Returns a vector with the minimum values from the left and right vectors

    Type Parameters

    Parameters

    Returns T

    a new vector with the minimum of the left and right vector values

  • Returns a new normalized Vector4 from the given one.

    Parameters

    Returns Vector4

    the vector

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

    Type Parameters

    Parameters

    Returns T

    result input

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

    Returns Vector4

    the new vector

  • Random(min?: number, max?: number): Vector4
  • Returns a new Vector4 with random values between min and max

    Parameters

    • Optional min: number

      the minimum random value

    • Optional max: number

      the maximum random value

    Returns Vector4

    a Vector4 with random values between min and max

  • Returns a new Vector4 set with the result of the transformation by the given matrix of the given vector. This method computes tranformed coordinates only, not transformed direction vectors (ie. it takes translation in account) The difference with Vector3.TransformCoordinates is that the w component is not used to divide the other coordinates but is returned in the w coordinate instead

    Parameters

    Returns Vector4

    the transformed Vector4

  • TransformCoordinatesFromFloatsToRef<T>(x: number, y: number, z: number, transformation: DeepImmutableObject<Matrix>, result: T): T
  • Sets the given vector "result" coordinates with the result of the transformation by the given matrix of the given floats (x, y, z) This method computes tranformed coordinates only, not transformed direction vectors The difference with Vector3.TransformCoordinatesFromFloatsToRef is that the w component is not used to divide the other coordinates but is returned in the w coordinate instead

    Type Parameters

    Parameters

    • x: number

      define the x coordinate of the source vector

    • y: number

      define the y coordinate of the source vector

    • z: number

      define the z coordinate of the source vector

    • transformation: DeepImmutableObject<Matrix>

      defines the transformation matrix

    • result: T

      defines the Vector4 where to store the result

    Returns T

    result input

  • Sets the given vector "result" coordinates with the result of the transformation by the given matrix of the given vector This method computes tranformed coordinates only, not transformed direction vectors (ie. it takes translation in account) The difference with Vector3.TransformCoordinatesToRef is that the w component is not used to divide the other coordinates but is returned in the w coordinate instead

    Type Parameters

    Parameters

    Returns T

    result input

  • 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.

    Type Parameters

    Parameters

    Returns T

    the new vector

  • TransformNormalFromFloatsToRef<T>(x: number, y: number, z: number, w: number, transformation: DeepImmutableObject<Matrix>, result: T): T
  • 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.

    Type Parameters

    Parameters

    • x: number

      value to transform

    • y: number

      value to transform

    • z: number

      value to transform

    • w: number

      value to transform

    • transformation: DeepImmutableObject<Matrix>

      the transformation matrix to apply

    • result: T

      the vector to store the results in

    Returns T

    result input

  • 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.

    Type Parameters

    Parameters

    Returns T

    result input

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

    Returns Vector4

    the new vector

Legend

  • Constructor
  • Property
  • Method
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Property
  • Method
  • Static method

Settings

Theme