R2::basic_rotation

namespace nin::R2 {
    template <std::floating_point T>
    class basic_rotation;
}

A 2D rotation stored as an angle quantity. Unlike basic_orientation_qty, a rotation can span multiple full turns.

Trigonometric values are cached and recomputed lazily when the angle changes.

Nested types

Type Definition

value_type

T

orientation_qty

basic_orientation_qty<T>

Member functions

(Constructor)

constructs a 2D rotation

basic_rotation()

(1)

basic_rotation(basic_rotation<T1> const& other)

(2)

basic_rotation(units::angle_v<T> angle)

(3)

basic_rotation(ori const& reference, ori const& measure, int revolutions = 0)

(4)

  • (1) Default constructor. Zero rotation.

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

  • (3) Constructs from an angle.

  • (4) Constructs the rotation that maps reference to measure, plus revolutions full turns.

invert

negates the rotation angle in place

void invert()

(1)

angle

rotation angle accessor

units::angle_v<T> angle() const

(1)

units::angle_v<T>& angle()

(2)

  • (1) Returns the current angle.

  • (2) Returns a mutable reference. Modifying it invalidates the cache.

operator()

applies the rotation

TM operator()(TM const& vec) const

(1)

orientation_qty operator()(orientation_qty const& orient = {}) const

(2)

basic_position_qty<T> operator()(basic_position_qty<T> const& point) const

(3)

  • (1) Rotates a 2-element container of raw scalars.

  • (2) Rotates an orientation quantity.

  • (3) Rotates a position quantity.

Non-member functions

inv

returns an inverted rotation

basic_rotation<T> inv(basic_rotation<T> R)

(1)

compose

composes two rotations

basic_rotation<T> compose(basic_rotation<T> const& left, basic_rotation<T> const& right)

(1)

The left rotation evaluates after the right rotation.