DzQuat

A quaternion rotation class.

Inherits :

Constructors

DAZ Script
DzQuat ()
DzQuat ( String quat )
DzQuat ( DzQuat quat )
DzQuat ( DzMatrix3 mtx )
DzQuat ( DzMatrix4 mtx )
DzQuat ( DzRotationOrder order, DzVec3 angles )
DzQuat ( DzVec3 axis, Number radians )
DzQuat ( Number x, Number y, Number z, Number w, Boolean normalize=true )

Methods

DAZ Script
Booleanequals ( DzQuat quat, Number tolerance=1e-05 )
NumbergetAngleOfRotation ()
DzVec3getAxisOfRotation ()
DzVec3getValue ( Number axis1, Number axis2, Number axis3 )
DzVec3getXAxis ()
DzVec3getYAxis ()
DzVec3getZAxis ()
DzQuatidentity ()
DzQuatinverse ()
voidinvert ()
BooleanisIdentity ()
voidmakeClosest ( DzQuat quat )
voidmakeIdentity ()
DzQuatmultiply ( DzQuat quat )
DzVec3multVec ( DzVec3 vec )
voidnormalize ()
voidscaleAngle ( Number val )
voidsetValue ( Number axis, Number radians )
voidsetValue ( Number axis1, Number axis2, Number axis3, DzVec3 angles )
voidsetValue ( DzVec3 axis, Number radians )
voidsetValue ( Number x, Number y, Number z, Number w, Boolean normalize=true )
DzQuatslerp ( DzQuat rot0, DzQuat rot1, Number t )
StringtoString ()

Detailed Description

Properties

Holds the w component of this quaternion.

Holds the x component of this quaternion.

Holds the y component of this quaternion.

Holds the z component of this quaternion.

Constructors

DzQuat()

Default Constructor. Creates an identity quaternion.

DzQuat( String quat )

Creates a quaternion by parsing a string.

Parameter(s):

• quat - A string representation of the quaternion in the form "[ x, y, z, w ]"

DzQuat( DzQuat quat )

Copy Constructor.

DzQuat( DzMatrix3 mtx )

Initialize with a rotation matrix.

DzQuat( DzMatrix4 mtx )

Initialize with a rotation matrix.

DzQuat( DzRotationOrder order, DzVec3 angles )

Initialize with an Euler angle rotation.

DzQuat( DzVec3 axis, Number radians )

Initialize with a rotation around an axis of the given angle (in radians).

DzQuat( Number x, Number y, Number z, Number w, Boolean normalize=true )

Initialize with 4-component quaternion.

Methods

Boolean : equals( DzQuat quat, Number tolerance=1e-05 )

Parameter(s):

• quat - The quaternion to be compared.
• tolerance - The maximum allowable deviation.

Return Value:

• `true` if this quaternion is considered equal to `quat`, otherwise `false`.

Since:

• 4.9.3.121

Return Value:

• The angle of rotation for this quaternion (in radians).

Since:

• 4.10.0.110

Return Value:

• The axis of rotation for this quaternion.

Since:

• 4.10.0.110

DzVec3 : getValue( Number axis1, Number axis2, Number axis3 )

Parameter(s):

• axis1 - The first axis in the rotation order.
• axis2 - The second axis in the rotation order.
• axis3 - The third axis in the rotation order.

Return Value:

• The Euler angles representing this rotation given the rotation order.

Return Value:

• The X axis that corresponds to the local coordinate frame of this rotation (the rotated coordinate axes).

Return Value:

• The Y axis that corresponds to the local coordinate frame of this rotation (the rotated coordinate axes).

Return Value:

• The Z axis that corresponds to the local coordinate frame of this rotation (the rotated coordinate axes).

DzQuat : identity()

Return Value:

• A null (identity) quaternion with components set to (0.0, 0.0, 0.0, 1.0).

Since:

• 4.14.1.27

DzQuat : inverse()

Return Value:

• The inverse of the rotation.

void : invert()

Changes a rotation to be its inverse.

Return Value:

• `true` if the quaternion is an identity rotation.

void : makeClosest( DzQuat quat )

Makes sure that this rotation lies on the same side of the hypersphere as the one given. If not, it is altered to do so.

void : makeIdentity()

Sets the quaternion to the identity quaternion. Zero this rotation.

DzQuat : multiply( DzQuat quat )

Parameter(s):

• quat - The quaternion to multiply by.

Return Value:

• The result of post-multiplying this quaternion by `quat`.

DzVec3 : multVec( DzVec3 vec )

Multiplies the given vector by the matrix of this rotation. Vector is forced to unit length.

Parameter(s):

• vec - The vector to multiply.

Return Value:

• The result of multiplying the given vector through the rotation, as a unit vector.

void : normalize()

Normalizes a rotation quaternion to unit 4D length

void : scaleAngle( Number val )

Keep the axis the same. Multiply the angle of rotation by the amount 'scaleFactor'

void : setValue( Number axis, Number radians )

Sets the value to a rotation of radians around one of the primary axes (axis == 0:x, 1:y, 2:z)

void : setValue( Number axis1, Number axis2, Number axis3, DzVec3 angles )

Sets the quaternion to an Euler rotation of angles around each axis given the rotation order.

Parameter(s):

• axis1 - The first axis in the rotation order.
• axis2 - The second axis in the rotation order.
• axis3 - The third axis in the rotation order.
• angles - The angles of each axis, where axis == 1:x, 2:y, 3:z.

void : setValue( DzVec3 axis, Number radians )

Sets the value based on the angle and axis of rotation.

void : setValue( Number x, Number y, Number z, Number w, Boolean normalize=true )

Sets the values of this quaternion.

Parameter(s):

• x - The x component.
• y - The y component.
• z - The z component.
• w - The w component.
• doNormalize - If `true`, normalizes the set values.(since 4.9.3.121)

DzQuat : slerp( DzQuat rot0, DzQuat rot1, Number t )

Preforms spherical linear interpolation between two quaternions.

Parameter(s):

• rot0 - The from rotation.
• rot1 - The to rotation.
• t - The value to interpolate.

Return Value:

• As `t` goes from 0 to 1, the value goes from rot0 to rot1.

Since:

• 4.9.3.121

Return Value:

• A string representation of this quaternion in the form "[ x, y, z, w ]".