@minecraft/math
    Preparing search index...

    Class VectorXZUtils

    Utilities operating on VectorXZ objects. All methods are static and do not modify the input objects.

    Index

    Constructors

    Methods

    • add

      Add two vectors to produce a new vector

      Parameters

      • v1: VectorXZ
      • v2: Partial<VectorXZ>

      Returns VectorXZ

    • clamp

      Clamps the components of a vector to limits to produce a new vector

      Parameters

      • v: VectorXZ
      • Optionallimits: { max?: Partial<VectorXZ>; min?: Partial<VectorXZ> }

      Returns VectorXZ

    • distance

      Calculate the distance between two vectors

      Parameters

      • a: VectorXZ
      • b: VectorXZ

      Returns number

    • dot

      Calculate the dot product of two vectors

      Parameters

      • a: VectorXZ
      • b: VectorXZ

      Returns number

    • equals

      Check the equality of two vectors

      Parameters

      • v1: VectorXZ
      • v2: VectorXZ

      Returns boolean

    • floor

      Floor the components of a vector to produce a new vector

      Parameters

      • v: VectorXZ

      Returns VectorXZ

    • fromString

      Gets a VectorXZ from the string representation produced by VectorXZUtils.toString. If any numeric value is not a number or the format is invalid, undefined is returned.

      Parameters

      • str: string

        The string to parse

      • Optionaldelimiter: string

        The delimiter used to separate the components. Defaults to the same as the default for VectorXZUtils.toString

      Returns undefined | VectorXZ

    • lerp

      Constructs a new vector using linear interpolation on each component from two vectors.

      Parameters

      • a: VectorXZ
      • b: VectorXZ
      • t: number

      Returns VectorXZ

    • magnitude

      The magnitude of a vector

      Parameters

      • v: VectorXZ

      Returns number

    • multiply

      Element-wise multiplication of two vectors together. Not to be confused with VectorXZUtils.dot product

      Parameters

      • a: VectorXZ
      • b: VectorXZ

      Returns VectorXZ

    • normalize

      Takes a vector 3 and normalizes it to a unit vector

      Parameters

      • v: VectorXZ

      Returns VectorXZ

    • scale

      Multiple all entries in a vector by a single scalar value producing a new vector

      Parameters

      • v1: VectorXZ
      • scale: number

      Returns VectorXZ

    • slerp

      Constructs a new vector using spherical linear interpolation on each component from two vectors.

      Parameters

      • a: VectorXZ
      • b: VectorXZ
      • t: number

      Returns VectorXZ

    • subtract

      Subtract two vectors to produce a new vector (v1-v2)

      Parameters

      • v1: VectorXZ
      • v2: Partial<VectorXZ>

      Returns VectorXZ

    • toString

      Create a string representation of a vectorxz

      Parameters

      • v: VectorXZ
      • Optionaloptions: { decimals?: number; delimiter?: string }

      Returns string