Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Quat

四元数

Hierarchy

Index

Constructors

constructor

  • newQuat(other: Quat): Quat
  • newQuat(x?: undefined | number, y?: undefined | number, z?: undefined | number, w?: undefined | number): Quat

Properties

w

w: number

w 分量。

x

x: number

x 分量。

y

y: number

y 分量。

z

z: number

z 分量。

Static IDENTITY

IDENTITY: {} = Object.freeze(new Quat())

Type declaration

Methods

clone

equals

  • equals(other: Quat, epsilon?: number): boolean
  • 判断当前四元数是否在误差范围内与指定向量相等。

    Parameters

    • other: Quat

      Comparative quaternion

    • Default value epsilon: number = EPSILON

      The error allowed. It`s should be a non-negative number.

    Returns boolean

    Returns true' when the components of the two quaternions are equal within the specified error range; otherwise, returnsfalse'.

getEulerAngles

length

  • length(): number

lengthSqr

  • lengthSqr(): number

lerp

  • lerp(to: Quat, ratio: number): this
  • 根据指定的插值比率,从当前四元数到目标四元数之间做线性插值。

    Parameters

    • to: Quat

      The target quaternion

    • ratio: number

      The interpolation coefficient. The range is [0,1].

    Returns this

set

  • set(other: Quat): Quat
  • set(x?: undefined | number, y?: undefined | number, z?: undefined | number, w?: undefined | number): Quat

slerp

  • slerp(to: Quat, ratio: number): this
  • 根据指定的插值比率,从当前四元数到目标四元数之间做球面插值。

    Parameters

    • to: Quat

      The target quaternion

    • ratio: number

      The interpolation coefficient. The range is [0,1].

    Returns this

strictEquals

  • strictEquals(other: Quat): boolean
  • 判断当前四元数是否与指定四元数相等。

    Parameters

    • other: Quat

      Comparative quaternion

    Returns boolean

    Returns true' when the components of the two quaternions are equal within the specified error range; otherwise, returnsfalse'.

toString

  • toString(): string

Static calculateW

  • calculateW<Out>(out: Out, a: Out): Out

Static clone

  • clone<Out>(a: Out): Quat

Static conjugate

  • conjugate<Out>(out: Out, a: Out): Out
  • 求共轭四元数,对单位四元数与求逆等价,但更高效

    Type parameters

    Parameters

    • out: Out
    • a: Out

    Returns Out

Static copy

  • copy<Out, QuatLike>(out: Out, a: QuatLike): Out

Static dot

  • dot<Out>(a: Out, b: Out): number

Static equals

Static fromAngleZ

  • fromAngleZ<Out>(out: Out, z: number): Out
  • 根据 2D 角度(0, 0, z)计算四元数

    Type parameters

    Parameters

    • out: Out

      Output quaternion

    • z: number

      Angle to rotate around Z axis in degrees.

    Returns Out

Static fromArray

Static fromAxes

  • fromAxes<Out, VecLike>