Options
All
  • Public
  • Public/Protected
  • All
Menu

This class represents a fourdimensional real Vector for use in Graphictransformations. Some operations ignore the fourth component.

export

Hierarchy

  • Vector4

Index

Constructors

constructor

  • new Vector4(x: number, y: number, z: number, w: number): Vector4
  • Creates an instance of Vector4 with given coordinates.

    memberof

    Vector4

    Parameters

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

    Returns Vector4

Properties

w

w: number

The w coordinate

memberof

Vector4

x

x: number

The x coordinate

memberof

Vector4

y

y: number

The y coordinate

memberof

Vector4

z

z: number

The z coordinate

memberof

Vector4

Methods

add

  • Returns a new Vector calculated by adding the given vector v to the current one.

    memberof

    Vector4

    Parameters

    Returns Vector4

cross

  • Cross product Calculates the cross product using the first three components

    Parameters

    Returns Vector4

    The result of the cross product as new Vector

distance

  • Calculates the distance between this vector another one given as parameter.

    memberof

    Vector4

    Parameters

    Returns number

dot

  • Dot product

    Parameters

    Returns number

    The result of the dot product

length

  • length(): number
  • Returns the length of the current vector. Only uses xyz and excludes w.

    memberof

    Vector4

    Returns number

multiply

  • Returns a new vector with the coordinates multiplied by the parameter s. Only the xyz dimensions are multiplied.

    memberof

    Vector4

    Parameters

    • s: number

    Returns Vector4

normalised

  • Returns the normalised vector.

    Returns Vector4

substract

  • Returns a new Vector calculated by subtracting the given vector v from the current one.

    memberof

    Vector4

    Parameters

    Returns Vector4

toVec3

  • Creates a threedimensional vector with the corresponding x,y,z-values, omits the w value.

    Returns Vector3

transform

  • Calculates a new Vector by multiplying a Matrix with the current vector.

    If x is the current vector and mat is A the resulting vector t is:

    Ax = t

    memberof

    Vector4

    Parameters

    Returns Vector4

Static Zero

  • Returns a new instance with all components set to zero.

    static
    memberof

    Vector4

    Returns Vector4

Generated using TypeDoc