R3::basic_orientation_qty

namespace nin::R3 {
    template <std::floating_point T>
    class basic_orientation_qty;
}

A 3D orientation stored internally as a unit quaternion. The default-constructed orientation corresponds to the identity (no rotation).

Orientations represent a direction in 3D space without tracking the number of full turns. For turn-aware transformations use basic_rotation.

Multiple construction paths are provided: quaternion, rotation matrix, axis-angle, two body axes, and Euler angles.

Nested types

Type Definition

value_type

T

Inner types

Type Definition

axis_angle

struct { nin::vector<T,3> axis; units::angle_v<T> angle; }

Member functions

(Constructor)

constructs a 3D orientation

basic_orientation_qty()

(1)

basic_orientation_qty(basic_orientation_qty<T1> const&)

(2)

basic_orientation_qty(quaternion const& quat)

(3)

basic_orientation_qty(TM const& matrix, matrix_ordering order)

(4)

basic_orientation_qty(TX const& axisX, TY const& axisY)

(5)

basic_orientation_qty(TA const& axis, units::angle_v<T> angle)

(6)

basic_orientation_qty(angle first, angle second, angle third, euler_seq)

(7)

  • (1) Default constructor. Identity orientation.

  • (2) Explicit converting constructor from a different floating-point type.

  • (3) Constructs from a quaternion. The quaternion need not be unit-length but its norm must be normal.

  • (4) Constructs from a 3x3 rotation matrix in row-major or column-major order.

  • (5) Constructs from two body-fixed axes (X and Y). The Z axis is derived.

  • (6) Constructs from an axis and an angle (axis-angle representation).

  • (7) Constructs from three Euler angles and a rotation sequence. Euler angles use the intrinsic convention.

to_quaternion

returns the underlying quaternion

quaternion const& to_quaternion() const

(1)

to_axis_angle

converts to axis-angle representation

axis_angle to_axis_angle() const

(1)

Returns a struct with axis (unit vector) and angle.

to_matrix

converts to rotation matrix

std::array<T,9> to_matrix(matrix_ordering order) const

(1)

Returns a flat 3x3 rotation matrix in the requested ordering.

to_euler_angles

converts to Euler angles

std::array<angle,3> to_euler_angles(euler_seq euler) const

(1)

Returns three angles for the requested Euler sequence.

Non-member functions

slerp

spherical linear interpolation

basic_orientation_qty slerp(a, b, T t, slerp_solution length = SHORTEST)

(1)

Interpolates between orientations a and b with parameter t in [0, 1]. The length parameter selects between the shortest and reflex paths.