Quat_d (struct)

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

参考

Xfo, Euler_d, Mat33_d

/*
** Example: Quat_d
*/

// create several quaternions
Quat_d q0, q1, q2, q3, q4;
q0 = Quat_d(Vec3_d(1.0, 0.0, 0.0), 0.0);
q1.setFromEuler_d(Euler_d(PI, 0.0, 0.0));
q2.setFromDirectionAndUpvector(Vec3_d(1.0, 0.0, 0.0), Vec3_d(0.0, 1.0, 0.0));
q3.setFrom2Vectors(Vec3_d(1.0, 0.0, 0.0), Vec3_d(1.0, 1.0, 0.0));
q4.setFromAxisAndAngle(Vec3_d(0.0, 1.0, 0.0), HALF_PI);

Quat_d Quat_d Quat_d

Members

Vec3_d v  
Float64 w  

Methods

  Quat_d ( in Euler_d e )
  Quat_d ( in Float64 w, in Vec3_d v )
  Quat_d ( in Float64 x, in Float64 y, in Float64 z, in Float64 w )
  Quat_d ( in Mat33_d mat )
  Quat_d ( in Quat_d other )
  Quat_d ( in Vec3_d v, in Float64 w )
  Quat_d ()
Quat_d add ? ( in Quat_d other )
  alignWith ! ( in Quat_d other )
Boolean almostEqual ? ( in Quat_d other )
Boolean almostEqual ? ( in Quat_d other, in Float64 precision )
Quat_d clone ? ()
Quat_d conjugate ? ()
Quat_d divide ? ( in Quat_d other )
Quat_d divideFloat64 ? ( in Float64 other )
Float64 dot ? ( in Quat_d other )
Boolean equal ? ( in Quat_d 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 )
Float64 getAngle ? ()
Vec3_d getXaxis ? ()
Vec3_d getYaxis ? ()
Vec3_d getZaxis ? ()
UInt32 hash ? ()
Quat_d inverse ? ()
Float64 length ? ()
Float64 lengthSquared ? ()
Quat_d linearInterpolate ? ( in Quat_d other, in Float64 t )
  mirror ! ( in Integer axisIndex )
Quat_d multiply ? ( in Quat_d other )
Quat_d multiplyFloat64 ? ( in Float64 other )
Vec3_d rotateVector ? ( in Vec3_d 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 Float64 w, in Vec3_d v )
  set ! ( in Float64 x, in Float64 y, in Float64 z, in Float64 w )
  set ! ( in Vec3_d v, in Float64 w )
Quat_d setFrom2Vectors ! ( in Vec3_d sourceDirVec, in Vec3_d destDirVec )
Quat_d setFrom2Vectors ! ( in Vec3_d sourceDirVec, in Vec3_d destDirVec, in Boolean arbitraryIfAmbiguous )
Quat_d setFromAxisAndAngle ! ( in Vec3_d axis, in Float64 angle )
Quat_d setFromDirectionAndUpvector ! ( in Vec3_d direction, in Vec3_d upvector )
Quat_d setFromEuler_d ! ( in Euler_d e )
Quat_d setFromEuler_dAngles ! ( in Float64 eulerX, in Float64 eulerY, in Float64 eulerZ )
Quat_d setFromEuler_dAngles ! ( in Float64 eulerX, in Float64 eulerY, in Float64 eulerZ, in RotationOrder ro )
Quat_d setFromEuler_dAngles ! ( in Vec3_d angles )
Quat_d setFromEuler_dAngles ! ( in Vec3_d angles, in RotationOrder ro )
Quat_d setFromMat33_d ! ( in Mat33_d mat )
  setIdentity ! ()
Float64 setUnit ! ()
Quat_d sphericalLinearInterpolate ? ( in Quat_d q2, in Float64 t )
Quat_d subtract ? ( in Quat_d other )
Euler_d toEuler_d ? ( in RotationOrder rotationOrder )
Vec3_d toEuler_dAngles ? ( in RotationOrder order )
Vec3_d toEuler_dAngles ? ()
Mat33_d toMat33_d ? ()
Quat_d unit ? ()
Quat_d unit_safe ? ()

Operators

Quat_d = ( Param other )

Methods in detail

Quat_d ( in Euler_d e )

Construct from euler angles


Quat_d ( in Float64 w, in Vec3_d v )

Construct from scalar and vector


Quat_d ( in Float64 x, in Float64 y, in Float64 z, in Float64 w )

Construct from scalars


Quat_d ( in Mat33_d mat )

Construct from Mat33_d


Quat_d ( in Quat_d other )

copy constructor


Quat_d ( in Vec3_d v, in Float64 w )

Construct from vector and scalar


Quat_d ()

Default constructor - set to identity


Quat_d Quat_d.add? ( in Quat_d other )

Overload method for the add operator


Quat_d.alignWith! ( in Quat_d other )

Aligns this quaternion with another one ensuring that the delta between the Quaternion values is the shortest path over the hypersphere.


Boolean Quat_d.almostEqual? ( in Quat_d other )

Returns true if this quaternion is almost equal to another one (using a default precision)


Boolean Quat_d.almostEqual? ( in Quat_d other, in Float64 precision )

Returns true if this quaternion is almost equal to another one (given a precision)


Quat_d Quat_d.clone? ()

clone method


Quat_d Quat_d.conjugate? ()

Returns the conjugate of this quaternion


Quat_d Quat_d.divide? ( in Quat_d other )

Overload method for the divide operator


Quat_d Quat_d.divideFloat64? ( in Float64 other )

Returns the division of this quaternion and a scalar


Float64 Quat_d.dot? ( in Quat_d other )

Returns the dot product of this quaternion and another one


Boolean Quat_d.equal? ( in Quat_d other )

Returns true if this quaternion is equal to another one


Quat_d.get? ( io Float32 v<> )

Getter as external float32 array


Quat_d.get? ( io Float32 v<>, in UInt32 o )

Getter as external float32 array and an offset


Quat_d.get? ( io Float32 v[] )

Getter as float32 array


Quat_d.get? ( io Float32 v[], in UInt32 o )

Getter as float32 array and an offset


Quat_d.get? ( io Float64 v<> )

Getter as external float64 array


Quat_d.get? ( io Float64 v<>, in UInt32 o )

Getter as external float64 array and an offset


Quat_d.get? ( io Float64 v[] )

Getter as float64 array


Quat_d.get? ( io Float64 v[], in UInt32 o )

Getter as float64 array and an offset


Float64 Quat_d.getAngle? ()

Returns the angle of this quaternion (in radians)


Vec3_d Quat_d.getXaxis? ()

Returns the X axis of this quaternion


Vec3_d Quat_d.getYaxis? ()

Returns the Y axis of this quaternion


Vec3_d Quat_d.getZaxis? ()

Returns the Z axis of this quaternion


UInt32 Quat_d.hash? ()

Hash for this value


Quat_d Quat_d.inverse? ()

Returns a inverse quaternion of this one


Float64 Quat_d.length? ()

Returns the length of this quaternion


Float64 Quat_d.lengthSquared? ()

Returns the squared length of this quaternion


Quat_d Quat_d.linearInterpolate? ( in Quat_d other, in Float64 t )

Interpolates two quaternions lineally (lerp) with a given blend value (0.0 to 1.0).

注釈

The interpolation of the 2 quaternions will result acceleration and deceleration. Use Quat_d.sphericalLinearInterpolate for an interpolation that does not introduce acceleration.


Quat_d.mirror! ( in Integer axisIndex )

Reflects this Quaternion according to the axis provided.

axisIndex An integer with value of 0 for the X axis, 1 for the Y axis, and 2 for the Z axis.


Quat_d Quat_d.multiply? ( in Quat_d other )

Overload method for the multiply operator


Quat_d Quat_d.multiplyFloat64? ( in Float64 other )

Returns the product of this quaternion and a scalar


Vec3_d Quat_d.rotateVector? ( in Vec3_d v )

Rotates a vector by this quaterion. Don’t forget to normalize the quaternion unless you want axial translation as well as rotation.


Quat_d.set! ( in Float32 v<> )

Setter from (standard/external) float32 array


Quat_d.set! ( in Float32 v<>, in UInt32 o )

Setter from (standard/external) float32 array and an offset


Quat_d.set! ( in Float64 v<> )

Setter from (standard/external) float64 array


Quat_d.set! ( in Float64 v<>, in UInt32 o )

Setter from (standard/external) float64 array and an offset


Quat_d.set! ( in Float64 w, in Vec3_d v )

Setter from scalar and vector


Quat_d.set! ( in Float64 x, in Float64 y, in Float64 z, in Float64 w )

Sets each component with a single scalar value.


Quat_d.set! ( in Vec3_d v, in Float64 w )

Setter from vector and scalar


Quat_d Quat_d.setFrom2Vectors! ( in Vec3_d sourceDirVec, in Vec3_d destDirVec )

Overload for previous setFrom2Vectors method, avoid arbitrary rotations.


Quat_d Quat_d.setFrom2Vectors! ( in Vec3_d sourceDirVec, in Vec3_d destDirVec, in Boolean arbitraryIfAmbiguous )

Set the quaternion to the rotation required to rotate the source vector to the destination vector Function taken from the ‘Game Programming Gems’ article ‘The Shortest Arc Quaternion’ by Stan Melax Both vectors must be units.


Quat_d Quat_d.setFromAxisAndAngle! ( in Vec3_d axis, in Float64 angle )

Set this quat to a rotation defined by an axis and an angle (in radians)


Quat_d Quat_d.setFromDirectionAndUpvector! ( in Vec3_d direction, in Vec3_d upvector )

Set the quat to represent the direction as the Z axis and the upvector pointing along the XY plane.


Quat_d Quat_d.setFromEuler_d! ( in Euler_d e )

Set this quat from a euler rotation


Quat_d Quat_d.setFromEuler_dAngles! ( in Float64 eulerX, in Float64 eulerY, in Float64 eulerZ )

Set this quat to a given angles vector (in radians) using the default XYZ rotation order


Quat_d Quat_d.setFromEuler_dAngles! ( in Float64 eulerX, in Float64 eulerY, in Float64 eulerZ, in RotationOrder ro )

Set this quat to a given angles vector (in radians) and a rotation order


Quat_d Quat_d.setFromEuler_dAngles! ( in Vec3_d angles )

Set this quat to a given angles vector (in radians) using the default XYZ rotation order


Quat_d Quat_d.setFromEuler_dAngles! ( in Vec3_d angles, in RotationOrder ro )

Set this quat to a given angles vector (in radians) and a rotation order


Quat_d Quat_d.setFromMat33_d! ( in Mat33_d mat )

Set this quat to the rotation described by a 3x3 rotation matrix


Quat_d.setIdentity! ()

Set this quat to the identity


Float64 Quat_d.setUnit! ()

Sets this quaternion to a unit quaternion and returns the previous length


Quat_d Quat_d.sphericalLinearInterpolate? ( in Quat_d q2, in Float64 t )

interpolates two quaternions spherically (slerp) given a scalar blend value (0.0 to 1.0).

注釈

this and q2 should be unit Quaternions


Quat_d Quat_d.subtract? ( in Quat_d other )

Overload method for the subtract operator


Euler_d Quat_d.toEuler_d? ( in RotationOrder rotationOrder )

Returns this quaternion as a Euler_d rotation giving a rotation order


Vec3_d Quat_d.toEuler_dAngles? ( in RotationOrder order )

Returns this quaternion as a Euler_d angles using the rotationorder XYZ


Vec3_d Quat_d.toEuler_dAngles? ()

Returns this quaternion as a Euler_d angles using the rotationorder XYZ


Mat33_d Quat_d.toMat33_d? ()

Returns this quaternion as a 3x3 rotation matrix


Quat_d Quat_d.unit? ()

Returns a unit quaternion of this one


Quat_d Quat_d.unit_safe? ()

Returns a unit quaternion of this one, no error reported if cannot be made unit

Operators in detail

Quat_d = ( Param other )

Adds another quaternion to this one