Quat.kl

Types

Quat (struct)

The Quat represents a 3D rotation as a quaternion. Quaternions are used within the Xfo type. A Quat can be converted to and from Mat33 as well as Euler types.

参考

Xfo, Euler, Mat33

/*
** Example: Quat
*/

// create several quaternions
Quat q0, q1, q2, q3, q4;
q0 = Quat(Vec3(1.0, 0.0, 0.0), 0.0);
q1.setFromEuler(Euler(PI, 0.0, 0.0));
q2.setFromDirectionAndUpvector(Vec3(1.0, 0.0, 0.0), Vec3(0.0, 1.0, 0.0));
q3.setFrom2Vectors(Vec3(1.0, 0.0, 0.0), Vec3(1.0, 1.0, 0.0));
q4.setFromAxisAndAngle(Vec3(0.0, 1.0, 0.0), HALF_PI);

Members

Vec3 v  
Scalar w  

Methods

  Quat ( in Euler e )
  Quat ( in Mat33 mat )
  Quat ( in Quat other )
  Quat ( in Scalar w, in Vec3 v )
  Quat ( in Scalar x, in Scalar y, in Scalar z, in Scalar w )
  Quat ( in Vec3 v, in Scalar w )
  Quat ()
Quat add ? ( in Quat other )
  alignWith ! ( in Quat other )
Boolean almostEqual ? ( in Quat other )
Boolean almostEqual ? ( in Quat other, in Scalar precision )
Quat clone ? ()
Quat conjugate ? ()
Quat divide ? ( in Quat other )
Quat divideScalar ? ( in Scalar other )
Scalar dot ? ( in Quat other )
Boolean equal ? ( in Quat other )
  get ? ( io Float32 v<> )
  get ? ( io Float32 v<>, in UInt32 o )
  get ? ( io Float32 v[] )
  get ? ( io Float32 v[], in UInt32 o )
  get ? ( io Float64 v<> )
  get ? ( io Float64 v<>, in UInt32 o )
  get ? ( io Float64 v[] )
  get ? ( io Float64 v[], in UInt32 o )
Scalar getAngle ? ()
Vec3 getXaxis ? ()
Vec3 getYaxis ? ()
Vec3 getZaxis ? ()
UInt32 hash ? ()
Quat inverse ? ()
Scalar length ? ()
Scalar lengthSquared ? ()
Quat linearInterpolate ? ( in Quat other, in Scalar t )
  mirror ! ( in Integer axisIndex )
Quat multiply ? ( in Quat other )
Quat multiplyScalar ? ( in Scalar other )
Vec3 rotateVector ? ( in Vec3 v )
  set ! ( in Float32 v<> )
  set ! ( in Float32 v<>, in UInt32 o )
  set ! ( in Float64 v<> )
  set ! ( in Float64 v<>, in UInt32 o )
  set ! ( in Scalar w, in Vec3 v )
  set ! ( in Scalar x, in Scalar y, in Scalar z, in Scalar w )
  set ! ( in Vec3 v, in Scalar w )
Quat setFrom2Vectors ! ( in Vec3 sourceDirVec, in Vec3 destDirVec )
Quat setFrom2Vectors ! ( in Vec3 sourceDirVec, in Vec3 destDirVec, in Boolean arbitraryIfAmbiguous )
Quat setFromAxisAndAngle ! ( in Vec3 axis, in Scalar angle )
Quat setFromDirectionAndUpvector ! ( in Vec3 direction, in Vec3 upvector )
Quat setFromEuler ! ( in Euler e )
Quat setFromEulerAngles ! ( in Scalar eulerX, in Scalar eulerY, in Scalar eulerZ )
Quat setFromEulerAngles ! ( in Scalar eulerX, in Scalar eulerY, in Scalar eulerZ, in RotationOrder ro )
Quat setFromEulerAngles ! ( in Vec3 angles )
Quat setFromEulerAngles ! ( in Vec3 angles, in RotationOrder ro )
Quat setFromMat33 ! ( in Mat33 mat )
  setIdentity ! ()
Scalar setUnit ! ()
Quat sphericalLinearInterpolate ? ( in Quat q2, in Scalar t )
Quat subtract ? ( in Quat other )
Euler toEuler ? ( in RotationOrder rotationOrder )
Vec3 toEulerAngles ? ( in RotationOrder order )
Vec3 toEulerAngles ? ()
Mat33 toMat33 ? ()
Quat unit ? ()
Quat unit_safe ? ()

Operators

Quat = ( Param other )

Functions

mathRandomQuat

Quat mathRandomQuat ( in Size seed, in Size index, in Float32 min, in Float32 max )