Structure

simd_quatd

A double-precision quaternion.

Declaration

struct simd_quatd

Topics

Initializers

init()

Creates a new quaternion.

init(vector: simd_double4)

Creates a new quaternion from the specified vector.

init(simd_double4x4)

Creates a new quaternion from the specified 4 x 4 rotation matrix.

init(simd_double3x3)

Creates a new quaternion from the specified 3 x 3 rotation matrix.

init(angle: Double, axis: SIMD3<Double>)

Creates a new quaternion with an action that's a specified rotation about a specified axis.

init(from: SIMD3<Double>, to: SIMD3<Double>)

Creates a new quaternion with an action that's a rotation between two vectors.

init(ix: Double, iy: Double, iz: Double, r: Double)

Creates a new quaternion from the specified imaginary and real parts.

init(real: Double, imag: SIMD3<Double>)

Creates a new quaternion from the specified real and imaginary parts.

Quaternion Properties

var angle: Double

The angle, in radians, by which the quaternion's action rotates.

var axis: SIMD3<Double>

The normalized axis about which the quaternion's action rotates.

var conjugate: simd_quatd

The conjugate of the quaternion.

var imag: SIMD3<Double>

The imaginary part of the quaternion.

var real: Double

The real part of the quaternion.

var inverse: simd_quatd

The inverse of the quaternion.

var length: Double

The length of the quaternion.

var normalized: simd_quatd

The unit quaternion of the quaternion.

var vector: simd_double4

The underlying vector of the quaternion.

var debugDescription: String

A representation of the quaternion that's suitable for debugging.

Quaternion Creation Functions

func simd_quaternion(Double, Double, Double, Double) -> simd_quatd

Returns a new quaternion from 4 scalar values.

func simd_quaternion(Double, simd_double3) -> simd_quatd

Returns a new quaternion from a scalar value and a three-element vector.

func simd_quaternion(UnsafePointer<Double>!) -> simd_quatd

Returns a new quaternion from a pointer to scalar values.

func simd_quaternion(simd_double3, simd_double3) -> simd_quatd

Returns a new quaternion from 2 three-element vectors.

func simd_quaternion(simd_double3x3) -> simd_quatd

Returns a new quaternion from a 3 x 3 matrix.

func simd_quaternion(simd_double4) -> simd_quatd

Returns a new quaternion from a four-element vector.

func simd_quaternion(simd_double4x4) -> simd_quatd

Returns a new quaternion from a 4 x 4 matrix.

Math Functions

func simd_add(simd_quatd, simd_quatd) -> simd_quatd

Returns the sum of two quaternions.

func simd_mul(simd_quatd, simd_quatd) -> simd_quatd

Returns the product of two quaternions.

func simd_sub(simd_quatd, simd_quatd) -> simd_quatd

Returns the difference between two quaternions.

Quaternion Functions

func simd_act(simd_quatd, simd_double3) -> simd_double3

Returns a vector rotated by a quaternion.

func simd_angle(simd_quatd) -> Double

Returns the angle by which a quaternion rotates.

func simd_axis(simd_quatd) -> simd_double3

Returns the axis about which a quaternion rotates.

func simd_bezier(simd_quatd, simd_quatd, simd_quatd, simd_quatd, Double) -> simd_quatd

Returns the spherical cubic Bezier interpolation between quaternions.

func simd_conjugate(simd_quatd) -> simd_quatd

Returns the conjugate of a quaternion.

func simd_imag(simd_quatd) -> simd_double3

Returns the imaginary (vector) part of a quaternion.

func simd_negate(simd_quatd) -> simd_quatd

Returns the negation of a quaternion.

func simd_real(simd_quatd) -> Double

Returns the real (scalar) part of a quaternion.

func simd_slerp(simd_quatd, simd_quatd, Double) -> simd_quatd

Returns a spherical linearly interpolated value along the shortest arc between two quaternions.

func simd_slerp_longest(simd_quatd, simd_quatd, Double) -> simd_quatd

Returns a spherical linearly interpolated value along the longest arc between two quaternions.

func simd_spline(simd_quatd, simd_quatd, simd_quatd, simd_quatd, Double) -> simd_quatd

Returns an interpolated value between two quaternions along a spherical cubic spline.

Geometry Functions

func simd_dot(simd_quatd, simd_quatd) -> Double

Returns the dot product of two quaternions.

func simd_length(simd_quatd) -> Double

Returns the length of a quaternion.

func simd_normalize(simd_quatd) -> simd_quatd

Returns a quaternion pointing in the same direction as the supplied quaternion with a length of 1.

Inverse Function

func simd_inverse(simd_quatd) -> simd_quatd

Returns the inverse of a quaternion.

Relationships

See Also

Quaternions

Rotating a Cube by Transforming Its Vertices

Rotate a cube through a series of keyframes using quaternion interpolation to transition between them.

struct simd_quatf

A single-precision quaternion.