|
HikoGUI
A low latency retained GUI
|
#include <hikogui/geometry/matrix.hpp>
Public Member Functions | |
| constexpr | matrix (matrix const &) noexcept=default |
| constexpr | matrix (matrix &&) noexcept=default |
| constexpr matrix & | operator= (matrix const &) noexcept=default |
| constexpr matrix & | operator= (matrix &&) noexcept=default |
| constexpr | matrix () noexcept |
| Constructs an identity matrix. | |
| constexpr | matrix (f32x4 col0, f32x4 col1, f32x4 col2, f32x4 col3=f32x4{0.0f, 0.0f, 0.0f, 1.0f}) noexcept |
| Construct a matrix from four columns. | |
| constexpr | matrix (vector3 col0, vector3 col1, vector3 col2, vector3 col3=vector3{}) noexcept |
| Construct a matrix from four vectors. | |
| constexpr | matrix (float c0r0, float c1r0, float c2r0, float c0r1, float c1r1, float c2r1, float c0r2, float c1r2, float c2r2) noexcept |
| Construct a 3x3 matrix from scalar values. | |
| constexpr | matrix (float c0r0, float c1r0, float c2r0, float c3r0, float c0r1, float c1r1, float c2r1, float c3r1, float c0r2, float c1r2, float c2r2, float c3r2, float c0r3, float c1r3, float c2r3, float c3r3) noexcept |
| Construct a 4x4 matrix from scalar values. | |
| template<int E> requires (E < D) | |
| constexpr | matrix (matrix< E > const &other) noexcept |
| Copy-construct a matrix from a smaller matrix. | |
| template<int E> requires (E < D) | |
| constexpr matrix & | operator= (matrix< E > const &rhs) noexcept |
| Copy-assign a matrix from a smaller matrix. | |
| constexpr | operator std::array< f32x4, 4 > () const noexcept |
| Convert a point to its f32x4-nummeric_array. | |
| constexpr bool | holds_invariant () const noexcept |
| constexpr f32x4 | operator* (f32x4 const &rhs) const noexcept |
Transform a f32x4 numeric array by the matrix. | |
| constexpr float | operator* (float const &rhs) const noexcept |
| Transform a float by the scaling factor of the matrix. | |
| constexpr corner_radii | operator* (corner_radii const &rhs) const noexcept |
| Transform a float by the scaling factor of the matrix. | |
| template<int E> | |
| constexpr auto | operator* (vector< float, E > const &rhs) const noexcept |
| Transform a vector by the matrix. | |
| template<int E> | |
| constexpr auto | operator* (extent< float, E > const &rhs) const noexcept |
| Transform a extent by the matrix. | |
| template<int E> | |
| constexpr auto | operator* (point< float, E > const &rhs) const noexcept |
| Transform a point by the matrix. | |
| constexpr rectangle | operator* (aarectangle const &rhs) const noexcept |
| Transform an axis-aligned rectangle by the matrix. | |
| constexpr rectangle | operator* (rectangle const &rhs) const noexcept |
| Transform a rectangle by the matrix. | |
| constexpr quad | operator* (quad const &rhs) const noexcept |
| Transform a quad by the matrix. | |
| constexpr circle | operator* (circle const &rhs) const noexcept |
| Transform a circle by the matrix. | |
| constexpr line_segment | operator* (line_segment const &rhs) const noexcept |
| Transform a line-segment by the matrix. | |
| constexpr auto | operator* (color const &rhs) const noexcept |
| Transform a color by a color matrix. | |
| constexpr auto | operator* (matrix const &rhs) const noexcept |
| Matrix/Matrix multiplication. | |
| template<int E> | |
| constexpr bool | operator== (matrix< E > const &rhs) const noexcept |
| Compare two matrices potentially of different dimensions. | |
| constexpr matrix | operator~ () const |
| Invert matrix. | |
Static Public Member Functions | |
| static constexpr matrix | uniform (aarectangle src_rectangle, aarectangle dst_rectangle, alignment alignment) noexcept |
| Create a transformation matrix to translate and uniformly-scale a src_rectangle to a dst_rectangle. | |
Friends | |
| template<int I> | |
| constexpr f32x4 const & | get (matrix const &rhs) noexcept |
| Get a column. | |
| template<int I> | |
| constexpr f32x4 & | get (matrix &rhs) noexcept |
| Get a column. | |
| constexpr matrix | transpose (matrix const &rhs) noexcept |
| Matrix transpose. | |
| template<char DstX, char DstY, char DstZ, char DstW = 'w'> requires (D == 3) | |
| constexpr matrix | reflect (matrix const &rhs) noexcept |
| Reflect axis of a matrix. | |
A 2D or 3D homogenius matrix for transforming homogenious vectors and points.
This matrix is in column major order. It is implemented as 4 columns made from a f32x4 numeric-array.
|
inlineconstexprnoexcept |
Constructs an identity matrix.
|
inlineconstexprnoexcept |
Construct a matrix from four columns.
| col0 | The 1st f32x4 column. @param col1 The 2ndf32x4 column. |
| col2 | The 3rd f32x4 column. @param col3 The 4thf32x4 column. |
|
inlineconstexprnoexcept |
Construct a matrix from four vectors.
| col0 | The 1st f32x4 column. @param col1 The 2ndf32x4 column. |
| col2 | The 3rd f32x4 column. @param col3 The 4thf32x4 column. |
|
inlineconstexprnoexcept |
Construct a 3x3 matrix from scalar values.
The function parameters are in row-major order for pretty formatting in source code. The matrix itself remains in column-major order.
| c0r0 | Value for column 0, row 0 |
| c1r0 | Value for column 1, row 0 |
| c2r0 | Value for column 2, row 0 |
| c0r1 | Value for column 0, row 1 |
| c1r1 | Value for column 1, row 1 |
| c2r1 | Value for column 2, row 1 |
| c0r2 | Value for column 0, row 2 |
| c1r2 | Value for column 1, row 2 |
| c2r2 | Value for column 2, row 2 |
|
inlineconstexprnoexcept |
Construct a 4x4 matrix from scalar values.
The function parameters are in row-major order for pretty formatting in source code. The matrix itself remains in column-major order.
| c0r0 | Value for column 0, row 0 |
| c1r0 | Value for column 1, row 0 |
| c2r0 | Value for column 2, row 0 |
| c3r0 | Value for column 3, row 0 |
| c0r1 | Value for column 0, row 1 |
| c1r1 | Value for column 1, row 1 |
| c2r1 | Value for column 2, row 1 |
| c3r1 | Value for column 3, row 1 |
| c0r2 | Value for column 0, row 2 |
| c1r2 | Value for column 1, row 2 |
| c2r2 | Value for column 2, row 2 |
| c3r2 | Value for column 3, row 2 |
| c0r3 | Value for column 0, row 3 |
| c1r3 | Value for column 1, row 3 |
| c2r3 | Value for column 2, row 3 |
| c3r3 | Value for column 3, row 3 |
|
inlineconstexprnoexcept |
Copy-construct a matrix from a smaller matrix.
|
inlineexplicitconstexprnoexcept |
Convert a point to its f32x4-nummeric_array.
|
inlineconstexprnoexcept |
Transform an axis-aligned rectangle by the matrix.
After transformation it can not be guaranteed that an axis-aligned rectangle remained aligned to axis, therefor a normal rectangle is returned
| rhs | The axis-aligned rectangle to be transformed. |
|
inlineconstexprnoexcept |
Transform a circle by the matrix.
| rhs | The circle to be transformed. |
|
inlineconstexprnoexcept |
Transform a color by a color matrix.
The alpha value is not included in the transformation and copied from the input.
| rhs | The color to be transformed. |
|
inlineconstexprnoexcept |
Transform a float by the scaling factor of the matrix.
The floating point number is transformed into a vector laying on the x-axis, then transformed, then extracting the hypot from it.
|
inlineconstexprnoexcept |
Transform a extent by the matrix.
Extents will not be translated.
| rhs | The extent to be transformed. |
|
inlineconstexprnoexcept |
Transform a f32x4 numeric array by the matrix.
| rhs | The f32x4 numeric array to transform. |
|
inlineconstexprnoexcept |
Transform a float by the scaling factor of the matrix.
The floating point number is transformed into a vector laying on the x-axis, then transformed, then extracting the hypot from it.
|
inlineconstexprnoexcept |
Transform a line-segment by the matrix.
| rhs | The line-segment to be transformed. |
|
inlineconstexprnoexcept |
Matrix/Matrix multiplication.
|
inlineconstexprnoexcept |
Transform a point by the matrix.
| rhs | The point to be transformed. |
|
inlineconstexprnoexcept |
Transform a quad by the matrix.
| rhs | The quad to be transformed. |
|
inlineconstexprnoexcept |
Transform a rectangle by the matrix.
| rhs | The rectangle to be transformed. |
|
inlineconstexprnoexcept |
Transform a vector by the matrix.
Vectors will not be translated.
| rhs | The vector to be transformed. |
|
inlineconstexprnoexcept |
Copy-assign a matrix from a smaller matrix.
|
inlineconstexprnoexcept |
Compare two matrices potentially of different dimensions.
| rhs | The right-hand-side matrix. |
| true | When the two matrices compare equal. |
|
inlineconstexpr |
Invert matrix.
|
staticconstexprnoexcept |
Create a transformation matrix to translate and uniformly-scale a src_rectangle to a dst_rectangle.
The implementation is located in scale.hpp since the definition requires both scale and translate.
| src_rectangle | The rectangle to be transformed. |
| dst_rectangle | The rectangle after transformation. |
| alignment | How the src_rectangle should be aligned inside the dst_rectangle after scaling and moving. |
Get a column.
| I | The index of the column. |
f32x4. Get a column.
| I | The index of the column. |
f32x4.
|
friend |
Reflect axis of a matrix.
The default axis of HikoGUI's geometry system are:
In Vulkan the Y axis is downward; so to translate a matrix from HikoGUI to Vulkan you can use:
The original axis are defined as the lower-case characters 'x', 'y', 'z' and 'w'; or for the negated axis as the upper-case characters 'X', 'Y', 'Z' and 'W'.
| DstX | Which of the original axis to use for the new matrix's x-axis. |
| DstY | Which of the original axis to use for the new matrix's y-axis. |
| DstZ | Which of the original axis to use for the new matrix's z-axis. |
| DstW | Which of the original axis to use for the new matrix's w-axis. |
| The | matrix to reflect |