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

    Class Vector3

    三维向量

    Hierarchy (View Summary)

    Index
    • Creates a new empty vec3

      Parameters

      • x: number = 0

        X component

      • y: number = 0

        Y component

      • z: number = 0

        Z component

      Returns Vector3

    className: string = 'Vector3'

    类名

    elements: vec3
    isVector3: boolean = true
    • Calculates the euclidian distance between two vec3's

      Parameters

      • a: Vector3
      • Optionalb: Vector3

        如果不传,计算 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: Vector3
      • Optionalb: Vector3

        如果不传,计算 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: Vector3
      • Optionalb: Vector3

        如果不传,计算 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

      this

    • Calculates the length of this

      Returns number

      length of this

    • Performs a linear interpolation between two vec3's

      Parameters

      • v: Vector3
      • 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

    • Rotate this 3D vector around the x-axis

      Parameters

      • origin: Vector3

        The origin of the rotation

      • rotation: number

        The angle of rotation

      Returns this

      this

    • Rotate this 3D vector around the y-axis

      Parameters

      • origin: Vector3

        The origin of the rotation

      • rotation: number

        The angle of rotation

      Returns this

      this

    • Rotate this 3D vector around the z-axis

      Parameters

      • origin: Vector3

        The origin of the rotation

      • rotation: number

        The angle of rotation

      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 vec3's after scaling the second vector by a scalar value

      Parameters

      • scale: number

        the amount to scale the second vector by before adding

      • a: Vector3
      • Optionalb: Vector3

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

      Returns this

      this

    • Set the components of a vec3 to the given values

      Parameters

      • x: number

        X component

      • y: number

        Y component

      • z: number

        Z component

      Returns this

      this

    • Calculates the squared euclidian distance between two vec3's

      Parameters

      • a: Vector3
      • Optionalb: Vector3

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

      Returns number

      squared distance between a and b

    • Calculates the squared length of this

      Returns number

      squared length of this

    • Transforms the vec3 direction with a mat4

      Parameters

      • m: Matrix4

        matrix to transform with

      Returns this

      this