template<class T>
Magnum::Math::DualComplex class

Dual complex number.

Template parameters
T Underlying data type

Represents 2D rotation and translation. See 2D and 3D transformations for brief introduction.

Base classes

template<class T>
class Dual
Dual number.

Public types

using Type = T
Underlying data type.

Public static functions

static auto rotation(Rad<T> angle) -> DualComplex<T>
Rotation dual complex number.
static auto translation(const Vector2<T>& vector) -> DualComplex<T>
Translation dual complex number.
static auto fromMatrix(const Matrix3<T>& matrix) -> DualComplex<T>
Create dual complex number from rotation matrix.

Constructors, destructors, conversion operators

DualComplex(IdentityInitT = IdentityInit) constexpr noexcept
Default constructor.
DualComplex(ZeroInitT) explicit constexpr noexcept
Construct zero-initialized dual complex number.
DualComplex(NoInitT) explicit noexcept
Construct without initializing the contents.
DualComplex(const Complex<T>& real, const Complex<T>& dual = Complex<T>(T(0), T(0))) constexpr noexcept
Construct dual complex number from real and dual part.
DualComplex(const Vector2<T>& vector) explicit constexpr noexcept
Construct dual complex number from vector.
template<class U>
DualComplex(const DualComplex<U>& other) explicit constexpr noexcept
Construct dual complex number from another of different type.
template<class U, class V = decltype(Implementation::DualComplexConverter<T, U>::from(std::declval<U>()))>
DualComplex(const U& other) explicit constexpr
Construct dual complex number from external representation.
DualComplex(const Dual<Complex<T>>& other) constexpr noexcept
Copy constructor.
template<class U, class V = decltype(Implementation::DualComplexConverter<T, U>::to(std::declval<DualComplex<T>>()))>
operator U() const explicit constexpr
Convert dual complex number to external representation.

Public functions

auto isNormalized() const -> bool
Whether the dual complex number is normalized.
auto rotation() const -> Complex<T> constexpr
Rotation part of dual complex number.
auto translation() const -> Vector2<T>
Translation part of dual complex number.
auto toMatrix() const -> Matrix3<T>
Convert dual complex number to transformation matrix.
auto operator*(const DualComplex<T>& other) const -> DualComplex<T>
Multipy with dual complex number.
auto complexConjugated() const -> DualComplex<T>
Complex-conjugated dual complex number.
auto dualConjugated() const -> DualComplex<T>
Dual-conjugated dual complex number.
auto conjugated() const -> DualComplex<T>
Conjugated dual complex number.
auto lengthSquared() const -> T
Complex number length squared.
auto length() const -> T
Dual quaternion length.
auto normalized() const -> DualComplex<T>
Normalized dual complex number (of unit length)
auto inverted() const -> DualComplex<T>
Inverted dual complex number.
auto invertedNormalized() const -> DualComplex<T>
Inverted normalized dual complex number.
auto transformPoint(const Vector2<T>& vector) const -> Vector2<T>
Rotate and translate point with dual complex number.

Function documentation

template<class T>
static DualComplex<T> Magnum::Math::DualComplex<T>::rotation(Rad<T> angle)

Rotation dual complex number.

Parameters
angle Rotation angle (counterclockwise)
\[ \hat c = (cos \theta + i sin \theta) + \epsilon (0 + i0) \]

template<class T>
static DualComplex<T> Magnum::Math::DualComplex<T>::translation(const Vector2<T>& vector)

Translation dual complex number.

Parameters
vector Translation vector
\[ \hat c = (0 + i1) + \epsilon (v_x + iv_y) \]

template<class T>
static DualComplex<T> Magnum::Math::DualComplex<T>::fromMatrix(const Matrix3<T>& matrix)

Create dual complex number from rotation matrix.

Expects that the matrix represents rigid transformation.

template<class T>
Magnum::Math::DualComplex<T>::DualComplex(IdentityInitT = IdentityInit) constexpr noexcept

Default constructor.

Creates unit dual complex number.

\[ \hat c = (0 + i1) + \epsilon (0 + i0) \]

template<class T>
Magnum::Math::DualComplex<T>::DualComplex(const Complex<T>& real, const Complex<T>& dual = Complex<T>(T(0), T(0))) constexpr noexcept

Construct dual complex number from real and dual part.

\[ \hat c = c_0 + \epsilon c_\epsilon \]

template<class T>
Magnum::Math::DualComplex<T>::DualComplex(const Vector2<T>& vector) explicit constexpr noexcept

Construct dual complex number from vector.

To be used in transformations later.

\[ \hat c = (0 + i1) + \epsilon(v_x + iv_y) \]

template<class T> template<class U>
Magnum::Math::DualComplex<T>::DualComplex(const DualComplex<U>& other) explicit constexpr noexcept

Construct dual complex number from another of different type.

Performs only default casting on the values, no rounding or anything else.

template<class T>
bool Magnum::Math::DualComplex<T>::isNormalized() const

Whether the dual complex number is normalized.

Dual complex number is normalized if its real part has unit length:

\[ |c_0|^2 = |c_0| = 1 \]

template<class T>
Complex<T> Magnum::Math::DualComplex<T>::rotation() const constexpr

Rotation part of dual complex number.

template<class T>
Vector2<T> Magnum::Math::DualComplex<T>::translation() const

Translation part of dual complex number.

\[ \boldsymbol a = (c_\epsilon c_0^*) \]

template<class T>
Matrix3<T> Magnum::Math::DualComplex<T>::toMatrix() const

Convert dual complex number to transformation matrix.

template<class T>
DualComplex<T> Magnum::Math::DualComplex<T>::operator*(const DualComplex<T>& other) const

Multipy with dual complex number.

\[ \hat a \hat b = a_0 b_0 + \epsilon (a_0 b_\epsilon + a_\epsilon) \]

template<class T>
DualComplex<T> Magnum::Math::DualComplex<T>::complexConjugated() const

Complex-conjugated dual complex number.

\[ \hat c^* = c^*_0 + c^*_\epsilon \]

template<class T>
DualComplex<T> Magnum::Math::DualComplex<T>::dualConjugated() const

Dual-conjugated dual complex number.

\[ \overline{\hat c} = c_0 - \epsilon c_\epsilon \]

template<class T>
DualComplex<T> Magnum::Math::DualComplex<T>::conjugated() const

Conjugated dual complex number.

Both complex and dual conjugation.

\[ \overline{\hat c^*} = c^*_0 - \epsilon c^*_\epsilon = c^*_0 + \epsilon(-a_\epsilon + ib_\epsilon) \]

template<class T>
T Magnum::Math::DualComplex<T>::lengthSquared() const

Complex number length squared.

Should be used instead of length() for comparing complex number length with other values, because it doesn't compute the square root.

\[ |\hat c|^2 = c_0 \cdot c_0 = |c_0|^2 \]

template<class T>
T Magnum::Math::DualComplex<T>::length() const

Dual quaternion length.

See lengthSquared() which is faster for comparing length with other values.

\[ |\hat c| = \sqrt{c_0 \cdot c_0} = |c_0| \]

template<class T>
DualComplex<T> Magnum::Math::DualComplex<T>::normalized() const

Normalized dual complex number (of unit length)

\[ c' = \frac{c_0}{|c_0|} \]

template<class T>
DualComplex<T> Magnum::Math::DualComplex<T>::inverted() const

Inverted dual complex number.

See invertedNormalized() which is faster for normalized dual complex numbers.

\[ \hat c^{-1} = c_0^{-1} - \epsilon c_\epsilon \]

template<class T>
DualComplex<T> Magnum::Math::DualComplex<T>::invertedNormalized() const

Inverted normalized dual complex number.

Expects that the complex number is normalized.

\[ \hat c^{-1} = c_0^{-1} - \epsilon c_\epsilon = c_0^* - \epsilon c_\epsilon \]

template<class T>
Vector2<T> Magnum::Math::DualComplex<T>::transformPoint(const Vector2<T>& vector) const

Rotate and translate point with dual complex number.

\[ v' = \hat c v = \hat c ((0 + i) + \epsilon(v_x + iv_y)) \]

template<class T> template<class T>
Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug& debug, const DualComplex<T>& value)

Debug output operator.