SQuatD
A Quaternion.
They are compact, don't suffer from gimbal lock, and can easily be interpolated. Quaternions consist of four components (x, y, z, w), where x, y, z form the vector part, and w is the scalar part.
Constructors
Method New(x:Double, y:Double, z:Double, w:Double = 1)
Creates a new SQuatD instance with the supplied x, y, z, and w components.
Operators
Method Operator*:SQuatD(b:SQuatD)
Multiplies this quaternion by quaternion b, returning a new quaternion that represents the combined rotation.
Method Operator-:SQuatD()
Returns a new quaternion with the negation of this quaternion's components, representing the inverse rotation.
Methods
Method AngleTo:Double(quat:SQuatD)
Returns the angle (in degrees) between this quaternion and the quaternion quat, representing the difference in their rotations.
Method Dot:Double(b:SQuatD)
Calculates the dot product between this quaternion and quaternion b, which is useful for various mathematical operations, such as finding the angle between two rotations.
Method Invert:SQuatD()
Returns the inverse of this quaternion, representing the opposite rotation.
Method Interpolate:SQuatD(b:SQuatD, t:Double)
Performs linear interpolation between this quaternion and quaternion b by the factor t (0 <= t <= 1), and normalizes the result afterwards.
Method Length:Double()
Computes the length (magnitude) of this quaternion when considered as a 4-dimensional vector.
Method LengthSquared:Double()
Computes the squared length (squared magnitude) of this quaternion when considered as a 4-dimensional vector.
Calculating the squared length instead of the length is much faster. Often if you are comparing lengths of two quaternions, you can just compare their squared lengths.
Method Normal:SQuatD()
Normalizes this quaternion, resulting in a quaternion with the same orientation but with a magnitude of 1.
Method RotateTowards:SQuatD(quat:SQuatD, s:Double)
Rotates this quaternion by an angular step s (in degrees) towards the specified quaternion quat.
Method SphericalInterpolate:SQuatD(b:SQuatD, t:Double)
Performs spherical linear interpolation (slerp) between this quaternion and quaternion b by the factor t (0 <= t <= 1).
Method EulerRotate:SQuatD(rot:SVec3D, order:ERotationOrder = ERotationOrder.XYZ)
Returns a quaternion representing a rotation around the Euler angles specified by rot, using the specified rotation order.
Method ToEuler:SVec3D(order:ERotationOrder = ERotationOrder.XYZ)
Converts this quaternion to Euler angles (in degrees) using the specified rotation order.
Method ToString:String() Override
Returns a String representation of the quaternion.
Functions
Function CreateFromEuler:SQuatD(euler:SVec3D, order:ERotationOrder = ERotationOrder.XYZ)
Creates a new SQuatD instance from the rotation specified by the Euler angles and the rotation order.
Function CreateFromRotation:SQuatD(mat:SMat4D)
Creates a new SQuatD instance from the rotation component of the 4x4 matrix mat.
see http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm
Function ToMat3:SMat3D(a:SQuatD)
Converts the quaternion a to a 3x3 rotation matrix, returning a new matrix that represents the same rotation as the quaternion.
Function ToMat4:SMat4D(a:SQuatD)
Converts the quaternion a to a 4x4 rotation matrix, returning a new matrix that represents the same rotation as the quaternion.
Function RotTrans:SMat4D(a:SQuatD, s:SVec3D)
Creates a 4x4 matrix that represents both translation and rotation.
The returned matrix places objects at position s, oriented with the rotation specified by quaternion a.
Function RotTransOrigin:SMat4D(a:SQuatD, s:SVec3D, origin:SVec3D)
Creates a translation, rotation and scaling matrix.
The returned matrix is such that it places objects at position origin, oriented in rotation a and scaled by s.
Function Identity:SQuatD()
Returns the identity quaternion, representing no rotation (x=0, y=0, z=0, w=1).
