QuatD

Description

struct Tinman.Core.Math.QuatD

A quaternion for representing a 3D rotation.

The set of quaternions is a four-dimensional vector space, where each element q has the form Q = (w,x,y,z) = w + x*i + y*j + z*k, where i, j and k are the imaginary components. A unit-length quaternion has a Length of one, use Norm to normalize arbitrary quaternions to unit-length.

Public / Constants

Identity


public static readonly attribute Identity → (QuatD)

The identity quaternion.

See also

Mat3D.Identity

Undefined


public static readonly attribute Undefined → (QuatD)

A quaternion with undefined value.

Zero


public static readonly attribute Zero → (QuatD)

The zero quaternion.

Public / Constructors

Axis​Angle

2 overloads


[Pure]
public static method AxisAngle1 → (2)

axis in : Vec3D

The unit-length rotation axis vector.

angle in : float64

The rotation angle, in radians.

returns → QuatD

The resulting unit-length quaternion.

Returns a QuatD value for the given rotation axis and angle.

Flipping the sign of the rotation angle in has the same effect as flipping the direction of the rotation axis in. Flipping both yields the same quaternion.

See also

Mat3D.Rotate1


[Pure]
public static method AxisAngle2 → (4)

axisX in : float64

X-component of the unit-length rotation axis vector.

axisY in : float64

Y-component of the unit-length rotation axis vector.

axisZ in : float64

Z-component of the unit-length rotation axis vector.

angle in : float64

The rotation angle, in radians.

returns → QuatD

The resulting unit-length quaternion.

Returns a QuatD value for the given rotation axis and angle.

Flipping the sign of the rotation angle in has the same effect as flipping the direction of the rotation axis. Flipping both yields the same quaternion.

See also

Mat3D.Rotate1

Matrix


[Pure]
public static method Matrix → (1)

matrix in : Mat3D

The rotation matrix.

returns → QuatD

The resulting unit-length quaternion.

Returns a QuatD value for the given rotation matrix.

Quat​D


public constructor QuatD → (4)

in : float64

The X-component of the quaternion.

in : float64

The Y-component of the quaternion.

in : float64

The Z-component of the quaternion.

in : float64

The W-component of the quaternion.

Creates a new instance of QuatD.

Velocity

2 overloads


[Pure]
public static method Velocity1 → (2)

time in : float64

The time period, in seconds.

in : Vec3D

The angular velocity pseudo-vector.

returns → QuatD

The resulting unit-length quaternion.

Returns a quaternion for the given angular velocity over time.


[Pure]
public static method Velocity2 → (4)

time in : float64

The time period, in seconds.

in : float64

X-component of the angular velocity, in radians per second.

in : float64

Y-component of the angular velocity, in radians per second.

in : float64

Z-component of the angular velocity, in radians per second.

returns → QuatD

The resulting unit-length quaternion.

Returns a quaternion for the given angular velocity over time.

Public / Methods

Axis​Angle


[Pure]
public method AxisAngle → (1)

axis out : Vec3D

The unit-length rotation axis.

returns → float64

The rotation angle in radians, in the range [0..2pi].

Returns the rotation axis and angle of this unit-length quaternion.

Equals

2 overloads


[Pure]
public method Equals2 → (4)

in : float64

X-component of quaternion.

in : float64

Y-component of quaternion.

in : float64

Z-component of quaternion.

in : float64

W-component of quaternion.

returns → bool

true if both quaternions are equal, false if they are not.

Checks if this quaternion and the given one are equal.

Equals​Almost

2 overloads


[Pure]
public method EqualsAlmost1 → (1)

in : QuatD

The quaternion.

returns → bool

true if both quaternions are similar, false if they are not.

Checks if this quaternion and the given one are similar but necessarily equal.

See also

Maths.Similar2


[Pure]
public method EqualsAlmost2 → (4)

in : float64

X-component of quaternion.

in : float64

Y-component of quaternion.

in : float64

Z-component of quaternion.

in : float64

W-component of quaternion.

returns → bool

true if both quaternions are similar, false if they are not.

Checks if this quaternion and the given one are similar but necessarily equal.

See also

Maths.Similar2

Interpolate


[Pure]
public method Interpolate → (2)

other in : QuatD

The other unit-length quaternion.

factor in : float64

The interpolation factor: 0 yield this, 1 yields other in.

returns → QuatD

The resulting quaternion.

Performs spherical interpolation between this unit-length quaternion and the given one.

Matrix


[Pure]
public method Matrix → ()

returns → Mat3D

The rotation matrix.

Returns the rotation matrix for this unit-length quaternion.

Mul

3 overloads


[Pure]
public method Mul1 → (1)

in : float64

The scalar factor.

returns → QuatD

The resulting quaternion.

Computes the scalar multiple of this quaternion.

The scalar multiple of a quaternion represents the same rotation.


[Pure]
public method Mul2 → (1)

in : QuatD

The quaternion to multiply with.

returns → QuatD

The resulting quaternion.

Multiplies this quaternion with the given one.

The multiplication of two quaternions q1 * q2 represents the rotation that results from rotating with q2 first and with q1 second.


public method Mul3 → (4)

in : float64

X-component of the quaternion to multiply with.

in : float64

Y-component of the quaternion to multiply with.

in : float64

Z-component of the quaternion to multiply with.

in : float64

W-component of the quaternion to multiply with.

returns → QuatD

The resulting quaternion.

Multiplies this quaternion with the given one.

The multiplication of two quaternions q1 * q2 represents the rotation that results from rotation with q2 first and q1 second.

Norm


[Pure]
public method Norm → ()

returns → QuatD

The resulting unit-length quaternion.

Normalizes this quaternion to unit-length.

Public / Attributes

Inverse


public attribute Inverse → (get)

value : QuatD

The quaternion inverse.

Returns the inverse of this quaternion.

Multiplying a quaternion with its inverse yields Identity.

Is​Undefined


public attribute IsUndefined → (get)

value : bool

true if this quaternion has an undefined value, false if not.

Checks if this quaternion has an undefined value.

A quaternion is undefined if at least one component is NaN (not-a-number).

Length


public attribute Length → (get)

value : float64

The quaternion magnitude.

Returns the magnitude of this quaternion.

Length​Sqr


public attribute LengthSqr → (get)

value : float64

The quaternion square magnitude.

Returns the square magnitude of this quaternion.

W


public readonly attribute W → (float64)

The scalar part of the quaternion.

X


public readonly attribute X → (float64)

X-component of the vector part of the quaternion.

Y


public readonly attribute Y → (float64)

Y-component of the vector part of the quaternion.

Z


public readonly attribute Z → (float64)

Z-component of the vector part of the quaternion.

Serialization

Serializer


public static readonly attribute Serializer → (ITypeSerializer<QuatD>)

The serialization helper object for values of QuatD.