|
HikoGUI
A low latency retained GUI
|
#include <hikogui/geometry/vector.hpp>
Public Types | |
| using | value_type = T |
| using | array_type = numeric_array<value_type, 4> |
Public Member Functions | |
| constexpr | vector (vector const &) noexcept=default |
| constexpr | vector (vector &&) noexcept=default |
| constexpr vector & | operator= (vector const &) noexcept=default |
| constexpr vector & | operator= (vector &&) noexcept=default |
| template<int E> requires (E < D) | |
| constexpr | vector (vector< value_type, E > const &other) noexcept |
| Construct a vector from a lower dimension vector. | |
| template<int E> requires (E > D) | |
| constexpr | vector (vector< value_type, E > const &other) noexcept |
| Construct a vector from a higher dimension vector. | |
| constexpr | operator array_type () const noexcept |
| Convert a vector to its array_type-nummeric_array. | |
| constexpr | vector (array_type const &other) noexcept |
| Construct a vector from a array_type-numeric_array. | |
| constexpr | vector () noexcept |
| Construct a empty vector / zero length. | |
| constexpr | vector (value_type x, value_type y) noexcept |
| Construct a 2D vector from x and y elements. | |
| constexpr | vector (value_type x, value_type y, value_type z=value_type{0}) noexcept |
| Construct a 3D vector from x, y and z elements. | |
| constexpr value_type & | x () noexcept |
| Access the x element from the vector. | |
| constexpr value_type & | y () noexcept |
| Access the y element from the vector. | |
| constexpr value_type & | z () noexcept |
| Access the z element from the vector. | |
| constexpr value_type const & | x () const noexcept |
| Access the x element from the vector. | |
| constexpr value_type const & | y () const noexcept |
| Access the y element from the vector. | |
| constexpr value_type const & | z () const noexcept |
| Access the z element from the vector. | |
| constexpr vector | operator- () const noexcept |
| Mirror this vector. | |
|
template<int E> requires (E <= D) | |
| constexpr vector & | operator+= (vector< value_type, E > const &rhs) noexcept |
| constexpr bool | holds_invariant () const noexcept |
| Check if the vector is valid. | |
Friends | |
| constexpr friend vector | operator+ (vector const &lhs, vector const &rhs) noexcept |
| Add two vectors from each other. | |
| constexpr friend vector | operator- (vector const &lhs, vector const &rhs) noexcept |
| Subtract two vectors from each other. | |
| constexpr friend vector | operator* (vector const &lhs, value_type const &rhs) noexcept |
| Scale the vector by a scaler. | |
| constexpr friend vector | operator* (value_type const &lhs, vector const &rhs) noexcept |
| Scale the vector by a scaler. | |
| constexpr friend bool | operator== (vector const &lhs, vector const &rhs) noexcept |
| Compare if two vectors are equal. | |
| constexpr friend value_type | squared_hypot (vector const &rhs) noexcept |
| Get the squared length of the vector. | |
| constexpr friend value_type | hypot (vector const &rhs) noexcept |
| Get the length of the vector. | |
| constexpr friend value_type | rcp_hypot (vector const &rhs) noexcept |
| Get the length of the vector. | |
| constexpr friend vector | normalize (vector const &rhs) noexcept |
| Normalize a vector to a unit vector. | |
| constexpr friend value_type | dot (vector const &lhs, vector const &rhs) noexcept |
| Get the dot product between two vectors. | |
| constexpr friend value_type | det (vector const &lhs, vector const &rhs) noexcept |
| Get the determinate between two vectors. | |
| template<int E> | |
| constexpr auto | min (vector const &lhs, vector< value_type, E > const &rhs) noexcept |
| Mix the two vectors and get the lowest value of each element. | |
| template<int E> | |
| constexpr auto | max (vector const &lhs, vector< value_type, E > const &rhs) noexcept |
| Mix the two vectors and get the highest value of each element. | |
| constexpr vector | round (vector const &rhs) noexcept |
| Round the elements of the vector toward nearest integer. | |
| constexpr vector | ceil (vector const &rhs) noexcept |
| Round the elements of the vector toward upward and to the right. | |
| constexpr vector | floor (vector const &rhs) noexcept |
| Round the elements of the vector toward downward and to the left. | |
| std::string | to_string (vector const &rhs) noexcept |
| std::ostream & | operator<< (std::ostream &lhs, vector const &rhs) noexcept |
A high-level geometric vector Part of the high-level vector, point, mat and color types.
A vector, for both 2D or 3D is internally represented as a 4D homogeneous vector. Which can be efficiently implemented as a __m128 SSE register.
|
inlineconstexprnoexcept |
Construct a vector from a lower dimension vector.
|
inlineexplicitconstexprnoexcept |
Construct a vector from a higher dimension vector.
This will clear the values in the higher dimensions.
|
inlineexplicitconstexprnoexcept |
Construct a vector from a array_type-numeric_array.
|
inlineconstexprnoexcept |
Construct a empty vector / zero length.
|
inlineconstexprnoexcept |
Construct a 2D vector from x and y elements.
| x | The x element. |
| y | The y element. |
|
inlineconstexprnoexcept |
Construct a 3D vector from x, y and z elements.
| x | The x element. |
| y | The y element. |
| z | The z element. |
|
inlineconstexprnoexcept |
Check if the vector is valid.
This function will check if w is zero, and with 2D vector is z is zero.
|
inlineexplicitconstexprnoexcept |
Convert a vector to its array_type-nummeric_array.
|
inlineconstexprnoexcept |
Mirror this vector.
|
inlineconstexprnoexcept |
Access the x element from the vector.
|
inlineconstexprnoexcept |
Access the x element from the vector.
|
inlineconstexprnoexcept |
Access the y element from the vector.
|
inlineconstexprnoexcept |
Access the y element from the vector.
|
inlineconstexprnoexcept |
Access the z element from the vector.
|
inlineconstexprnoexcept |
Access the z element from the vector.
Round the elements of the vector toward upward and to the right.
Get the determinate between two vectors.
| lhs | The first vector. |
| rhs | The second vector. |
Get the dot product between two vectors.
| lhs | The first vector. |
| rhs | The second vector. |
Round the elements of the vector toward downward and to the left.
Get the length of the vector.
| rhs | The vector. |
|
friend |
Mix the two vectors and get the highest value of each element.
| lhs | The first vector. |
| rhs | The first vector. |
|
friend |
Mix the two vectors and get the lowest value of each element.
| lhs | The first vector. |
| rhs | The first vector. |
Normalize a vector to a unit vector.
| rhs | The vector. |
Scale the vector by a scaler.
| lhs | The vector to scale. |
| rhs | The scaling factor. |
Scale the vector by a scaler.
| lhs | The vector to scale. |
| rhs | The scaling factor. |
Add two vectors from each other.
| lhs | The first vector. |
| rhs | The second vector. |
Subtract two vectors from each other.
| lhs | The first vector. |
| rhs | The second vector. |
Compare if two vectors are equal.
| lhs | The first vector. |
| rhs | The second vector. |
Get the length of the vector.
| rhs | The vector. |
Round the elements of the vector toward nearest integer.
Get the squared length of the vector.
| rhs | The vector. |