User Tools

Site Tools


wiki:vector4

Vector4

Vector4 is a global meta-table composed of 4 numbers (Its data) and some functions to manipulate these data.

Data

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

Functions

Operators

  • __unm(Vector4)
  • __add(Vector4, Vector4)
  • __sub(Vector4, Vector4)
  • __mul(Vector4, number)
  • __div(Vector4, number)
  • __tostring(Vector4)

new()

  • Description: Create an instance of Vector4 with x, y, z and w equals to zero
  • Signature: (): Vector4

new(number, number, number, number)

  • Description: Create an instance of Vector4 with the given values
  • Signature: (x: number, y: number, z: number, w: number): Vector4

One()

  • Description: Returns a (1,1,1,1) Vector4
  • Signature: (): Vector4

Zero()

  • Description: Returns a (0,0,0,0) Vector4
  • Signature: (): Vector4

Length(Vector4)

  • Description: Returns the length of the given Vector4
  • Signature: (target: Vector4): number

Normalize(Vector4)

  • Description: Returns the normalized version of the given Vector4
  • Signature: (target: Vector4): number

Dot(Vector4, Vector4)

  • Description: Returns the dot product of the two given Vector4
  • Signature: (left: Vector4, right: Vector4): number

Lerp(Vector4, Vector4, number)

  • Description: Calculate the linear interpolation between two Vector4 using the given alpha
  • Signature: (start: Vector4, end: Vector4, alpha: number): Vector4
wiki/vector4.txt · Last modified: 2019/06/05 19:17 by admin