#include <Magnum/Math/DualComplex.h>
template<class T>
DualComplex class
Dual complex number.
Template parameters | |
---|---|
T | Underlying data type |
Represents 2D rotation and translation. Usually denoted as the following in equations, with being the real() part and the dual() part:
See Dual and Complex for further notation description and 2D and 3D transformations for brief introduction.
Base classes
-
template<class T>class Dual<Complex<T>>
- 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 a dual complex number from rotation matrix.
- static auto from(const Complex<T>& rotation, const Vector2<T>& translation) -> DualComplex<T> new in Git master
- Create a dual complex from rotation complex and translation vector.
Constructors, destructors, conversion operators
- DualComplex() constexpr noexcept
- Default constructor.
- DualComplex(IdentityInitT) explicit constexpr noexcept
- Identity constructor.
- DualComplex(ZeroInitT) explicit constexpr noexcept
- Construct a zero-initialized dual complex number.
-
DualComplex(Magnum::
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 a dual complex number from real and dual part.
- DualComplex(const Vector2<T>& vector) explicit constexpr noexcept
- Construct a dual complex number from vector.
-
template<class U>DualComplex(const DualComplex<U>& other) explicit constexpr noexcept
- Construct a dual complex number from another of different type.
-
template<class U, class = decltype(Implementation::DualComplexConverter<T, U>::from(std::DualComplex(const U& other) explicit constexpr
declval<U>()))> - Construct a dual complex number from external representation.
- DualComplex(const Dual<Complex<T>>& other) constexpr noexcept
- Copy constructor.
-
template<class U, class = decltype(Implementation::DualComplexConverter<T, U>::to(std::operator U() const explicit constexpr
declval<DualComplex<T>>()))> - Convert the dual complex number to external representation.
Public functions
- auto data() -> T*
- Raw data.
- auto data() const -> const T*
- 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>
- Multiply 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 transformVector(const Vector2<T>& vector) const -> Vector2<T> new in 2020.06
- Rotate a vector with a 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) |
For creating a dual complex number from a rotation Complex, use the implicit conversion provided by DualComplex(const Complex<T>&, const Complex<T>&).
template<class T>
static DualComplex<T> Magnum:: Math:: DualComplex<T>:: translation(const Vector2<T>& vector)
Translation dual complex number.
Parameters | |
---|---|
vector | Translation vector |
template<class T>
static DualComplex<T> Magnum:: Math:: DualComplex<T>:: fromMatrix(const Matrix3<T>& matrix)
Create a dual complex number from rotation matrix.
Expects that the matrix represents rigid transformation.
template<class T>
static DualComplex<T> Magnum:: Math:: DualComplex<T>:: from(const Complex<T>& rotation,
const Vector2<T>& translation) new in Git master
Create a dual complex from rotation complex and translation vector.
template<class T>
Magnum:: Math:: DualComplex<T>:: DualComplex() constexpr noexcept
Default constructor.
Equivalent to DualComplex(IdentityInitT).
template<class T>
Magnum:: Math:: DualComplex<T>:: DualComplex(IdentityInitT) explicit constexpr noexcept
Identity constructor.
Creates unit dual complex number.
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 a dual complex number from real and dual part.
This constructor can be also used to implicitly convert a rotation complex number to a rotation dual complex number.
template<class T>
Magnum:: Math:: DualComplex<T>:: DualComplex(const Vector2<T>& vector) explicit constexpr noexcept
Construct a dual complex number from vector.
To be used in transformations later.
template<class T>
template<class U>
Magnum:: Math:: DualComplex<T>:: DualComplex(const DualComplex<U>& other) explicit constexpr noexcept
Construct a dual complex number from another of different type.
Performs only default casting on the values, no rounding or anything else.
template<class T>
T* Magnum:: Math:: DualComplex<T>:: data()
Raw data.
Contrary to what Doxygen shows, returns reference to an one-dimensional fixed-size array of four elements, i.e. T(&)[4]
.
template<class T>
const T* Magnum:: Math:: DualComplex<T>:: data() const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
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:
template<class T>
Vector2<T> Magnum:: Math:: DualComplex<T>:: translation() const
Translation part of dual complex number.
template<class T>
DualComplex<T> Magnum:: Math:: DualComplex<T>:: operator*(const DualComplex<T>& other) const
Multiply with dual complex number.
template<class T>
DualComplex<T> Magnum:: Math:: DualComplex<T>:: complexConjugated() const
Complex-conjugated dual complex number.
template<class T>
DualComplex<T> Magnum:: Math:: DualComplex<T>:: dualConjugated() const
Dual-conjugated dual complex number.
template<class T>
DualComplex<T> Magnum:: Math:: DualComplex<T>:: conjugated() const
Conjugated dual complex number.
Both complex and dual conjugation.
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.
template<class T>
T Magnum:: Math:: DualComplex<T>:: length() const
Dual quaternion length.
See lengthSquared() which is faster for comparing length with other values.
template<class T>
DualComplex<T> Magnum:: Math:: DualComplex<T>:: normalized() const
Normalized dual complex number (of unit length)
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.
template<class T>
DualComplex<T> Magnum:: Math:: DualComplex<T>:: invertedNormalized() const
Inverted normalized dual complex number.
Expects that the complex number is normalized.
template<class T>
Vector2<T> Magnum:: Math:: DualComplex<T>:: transformVector(const Vector2<T>& vector) const new in 2020.06
Rotate a vector with a dual complex number.
Calls Complex::
template<class T>
Vector2<T> Magnum:: Math:: DualComplex<T>:: transformPoint(const Vector2<T>& vector) const
Rotate and translate point with dual complex number.
template<class T>
template<class T>
Debug& operator<<(Debug& debug,
const DualComplex<T>& value)
Debug output operator.