Structure

simd_quatf

A single-precision quaternion.

Topics

Initializers

`init()`

Creates a new quaternion.

`init(vector: simd_float4)`

Creates a new quaternion from the specified vector.

`init(simd_float4x4)`

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

`init(simd_float3x3)`

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

`init(angle: Float, axis: SIMD3<Float>)`

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

`init(from: SIMD3<Float>, to: SIMD3<Float>)`

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

`init(ix: Float, iy: Float, iz: Float, r: Float)`

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

`init(real: Float, imag: SIMD3<Float>)`

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

Quaternion Properties

`var angle: Float`

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

`var axis: SIMD3<Float>`

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

`var conjugate: simd_quatf`

The conjugate of the quaternion.

`var imag: SIMD3<Float>`

The imaginary part of the quaternion.

`var real: Float`

The real part of the quaternion.

`var inverse: simd_quatf`

The inverse of the quaternion.

`var length: Float`

The length of the quaternion.

`var normalized: simd_quatf`

The unit quaternion of the quaternion.

`var vector: simd_float4`

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(Float, simd_float3) -> simd_quatf`

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

`func simd_quaternion(UnsafePointer<Float>!) -> simd_quatf`

Returns a new quaternion from a pointer to scalar values.

`func simd_quaternion(simd_float3, simd_float3) -> simd_quatf`

Returns a new quaternion from 2 three-element vectors.

`func simd_quaternion(simd_float3x3) -> simd_quatf`

Returns a new quaternion from a 3 x 3 matrix.

`func simd_quaternion(simd_float4) -> simd_quatf`

Returns a new quaternion from a four-element vector.

`func simd_quaternion(simd_float4x4) -> simd_quatf`

Returns a new quaternion from a 4 x 4 matrix.

Quaternion Functions

`func simd_angle(simd_quatf) -> Float`

Returns the angle by which a quaternion rotates.

`func simd_axis(simd_quatf) -> simd_float3`

Returns the axis about which a quaternion rotates.

`func simd_bezier(simd_quatf, simd_quatf, simd_quatf, simd_quatf, Float) -> simd_quatf`

Returns the spherical cubic Bezier interpolation between quaternions.

`func simd_imag(simd_quatf) -> simd_float3`

Returns the imaginary (vector) part of a quaternion.

`func simd_real(simd_quatf) -> Float`

Returns the real (scalar) part of a quaternion.

`func simd_slerp(simd_quatf, simd_quatf, Float) -> simd_quatf`

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

`func simd_slerp_longest(simd_quatf, simd_quatf, Float) -> simd_quatf`

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

`func simd_spline(simd_quatf, simd_quatf, simd_quatf, simd_quatf, Float) -> simd_quatf`

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

Geometry Functions

`func simd_dot(simd_quatf, simd_quatf) -> Float`

Returns the dot product of two quaternions.

`func simd_length(simd_quatf) -> Float`

Returns the length of a quaternion.

`func simd_normalize(simd_quatf) -> simd_quatf`

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

Instance Methods

`func act(SIMD3<Float>) -> SIMD3<Float>`

Returns the specified vector rotated by the quaternion.

Relationships

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_quatd`

A double-precision quaternion.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.