Class Vector3

Describes a 3D-vector.

Hierarchy

  • Vector3

Constructors

  • Constructor of Vector3.

    Parameters

    • x: number = 0

      The x component of the vector, default 0

    • y: number = 0

      The y component of the vector, default 0

    • z: number = 0

      The z component of the vector, default 0

    Returns Vector3

Properties

_onValueChanged: (() => void) = null

Type declaration

    • (): void
    • Internal

      Returns void

_x: number
_y: number
_z: number
_one: Vector3 = ...
_zero: Vector3 = ...

Accessors

Methods

  • Calculate the length of this vector.

    Returns

    The length of this vector

    Returns number

  • Calculate the squared length of this vector.

    Returns

    The squared length of this vector

    Returns number

  • Scale this vector by the given value.

    Returns

    This vector

    Parameters

    • s: number

      The amount by which to scale the vector

    Returns Vector3

  • Set the value of this vector.

    Returns

    This vector

    Parameters

    • x: number

      The x component of the vector

    • y: number

      The y component of the vector

    • z: number

      The z component of the vector

    Returns Vector3

  • Set the value of this vector by an array.

    Returns

    This vector

    Parameters

    • array: ArrayLike<number>

      The array

    • offset: number = 0

      The start offset of the array

    Returns Vector3

  • Clone the value of this vector to an array.

    Parameters

    • out: Float32Array | Float64Array | number[]

      The array

    • outOffset: number = 0

      The start offset of the array

    Returns void

  • This vector performs a coordinate transformation using the given 4x4 matrix.

    Remarks

    A coordinate transform performs the transformation with the assumption that the w component is one. The four dimensional vector obtained from the transformation operation has each component in the vector divided by the w component. This forces the w-component to be one and therefore makes the vector homogeneous. The homogeneous vector is often preferred when working with coordinates as the w component can safely be ignored.

    Returns

    This vector

    Parameters

    Returns Vector3

  • This vector performs a normal transformation using the given 4x4 matrix.

    Remarks

    A normal transform performs the transformation with the assumption that the w component is zero. This causes the fourth row and fourth column of the matrix to be unused. The end result is a vector that is not translated, but all other transformation properties apply. This is often preferred for normal vectors as normals purely represent direction rather than location because normal vectors should not be translated.

    Returns

    This vector

    Parameters

    Returns Vector3

  • Determines the squared distance of two vectors.

    Returns

    The squared distance of two vectors

    Parameters

    Returns number

  • Determines the dot product of two vectors.

    Returns

    The dot product of two vectors

    Parameters

    • left: Vector3

      The first vector to dot

    • right: Vector3

      The second vector to dot

    Returns number

  • Determines whether the specified vectors are equals.

    Returns

    True if the specified vectors are equals, false otherwise

    Parameters

    • left: Vector3

      The first vector to compare

    • right: Vector3

      The second vector to compare

    Returns boolean

  • Performs a linear interpolation between two vectors.

    Parameters

    • start: Vector3

      The first vector

    • end: Vector3

      The second vector

    • t: number

      The blend amount where 0 returns start and 1 end

    • out: Vector3

      The result of linear blending between two vectors

    Returns void

  • Calculate a vector containing the largest components of the specified vectors.

    Parameters

    • left: Vector3

      The first vector

    • right: Vector3

      The second vector

    • out: Vector3

      The vector containing the largest components of the specified vectors

    Returns void

  • Calculate a vector containing the smallest components of the specified vectors.

    Parameters

    • left: Vector3

      The first vector

    • right: Vector3

      The second vector

    • out: Vector3

      The vector containing the smallest components of the specified vectors

    Returns void

  • Scale a vector by the given value.

    Parameters

    • a: Vector3

      The vector to scale

    • s: number

      The amount by which to scale the vector

    • out: Vector3

      The scaled vector

    Returns void

  • Performs a coordinate transformation using the given 4x4 matrix.

    Remarks

    A coordinate transform performs the transformation with the assumption that the w component is one. The four dimensional vector obtained from the transformation operation has each component in the vector divided by the w component. This forces the w-component to be one and therefore makes the vector homogeneous. The homogeneous vector is often preferred when working with coordinates as the w component can safely be ignored.

    Parameters

    • v: Vector3

      The coordinate vector to transform

    • m: Matrix4

      The transform matrix

    • out: Vector3

      The transformed coordinates

    Returns void

  • Performs a normal transformation using the given 4x4 matrix.

    Remarks

    A normal transform performs the transformation with the assumption that the w component is zero. This causes the fourth row and fourth column of the matrix to be unused. The end result is a vector that is not translated, but all other transformation properties apply. This is often preferred for normal vectors as normals purely represent direction rather than location because normal vectors should not be translated.

    Parameters

    • v: Vector3

      The normal vector to transform

    • m: Matrix4

      The transform matrix

    • out: Vector3

      The transformed normal

    Returns void

Generated using TypeDoc