Hilo3d API - v2.0.0
    Preparing search index...

    Class Vector4

    四维向量

    Hierarchy (View Summary)

    Index
    • Creates a new empty vec4

      Parameters

      • x: number = 0

        X component

      • y: number = 0

        Y component

      • z: number = 0

        Z component

      • w: number = 0

        W component

      Returns Vector4

    className: string = 'Vector4'

    类名

    elements: vec4
    isVector4: boolean = true
    • Calculates the euclidian distance between two vec4's

      Parameters

      • a: Vector4
      • Optionalb: Vector4

        如果不传,计算 this 和 a 的结果

      Returns number

      distance between a and b

    • Returns whether or not the vectors have approximately the same elements in the same position.

      Parameters

      • a: Vector4
      • Optionalb: Vector4

        如果不传,计算 this 和 a 的结果

      Returns boolean

      True if the vectors are equal, false otherwise.

    • Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===)

      Parameters

      • a: Vector4
      • Optionalb: Vector4

        如果不传,计算 this 和 a 的结果

      Returns boolean

      True if the vectors are equal, false otherwise.

    • Math.floor the components of this

      Returns this

      this

    • 从数组赋值

      Parameters

      • array: ArrayLike<number>

        数组

      • offset: number = 0

        数组偏移值

      Returns this

    • Calculates the length of this

      Returns number

      length of this

    • Performs a linear interpolation between two vec4's

      Parameters

      • v: Vector4
      • t: number

        interpolation amount between the two vectors

      Returns this

      this

    • Generates a random vector with the given scale

      Parameters

      • Optionalscale: number

        Length of the resulting vector. If ommitted, a unit vector will be returned

      Returns this

      this

    • Math.round the components of this

      Returns this

      this

    • Scales this by a scalar number

      Parameters

      • scale: number

        amount to scale the vector by

      Returns this

      this

    • Adds two vec4's after scaling the second vector by a scalar value

      Parameters

      • scale: number

        the amount to scale the second vector by before adding

      • a: Vector4
      • Optionalb: Vector4

        如果不传,计算 this 和 a 的结果

      Returns this

      this

    • Set the components of a vec4 to the given values

      Parameters

      • x: number

        X component

      • y: number

        Y component

      • z: number

        Z component

      • w: number

        W component

      Returns this

      this

    • Calculates the squared euclidian distance between two vec4's

      Parameters

      • a: Vector4
      • Optionalb: Vector4

        如果不传,计算 this 和 a 的结果

      Returns number

      squared distance between a and b

    • Calculates the squared length of this

      Returns number

      squared length of this