|
HikoGUI
A low latency retained GUI
|
#include <hikogui/geometry/vector3.hpp>
Public Types | |
| using | array_type = simd<float, 4> |
| using | value_type = array_type::value_type |
Public Member Functions | |
| constexpr | vector3 (vector3 const &) noexcept=default |
| constexpr | vector3 (vector3 &&) noexcept=default |
| constexpr vector3 & | operator= (vector3 const &) noexcept=default |
| constexpr vector3 & | operator= (vector3 &&) noexcept=default |
| constexpr | vector3 (vector2 const &other) noexcept |
| Construct a vector from a lower dimension vector. | |
| constexpr | operator vector2 () 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 | vector3 (array_type const &other) noexcept |
| Construct a vector from a array_type-simd. | |
| constexpr | vector3 () noexcept |
| Construct a empty vector / zero length. | |
| constexpr | vector3 (float x, float y, float z=0.0f) noexcept |
| Construct a 3D vector from x, y and z elements. | |
| constexpr float & | x () noexcept |
| Access the x element from the vector. | |
| constexpr float & | y () noexcept |
| Access the y element from the vector. | |
| constexpr float & | z () noexcept |
| Access the z element from the vector. | |
| constexpr float | x () const noexcept |
| Access the x element from the vector. | |
| constexpr float | y () const noexcept |
| Access the y element from the vector. | |
| constexpr float | z () const noexcept |
| Access the z element from the vector. | |
| constexpr vector3 | operator- () const noexcept |
| Mirror this vector. | |
| constexpr vector3 & | operator+= (vector3 const &rhs) noexcept |
| constexpr vector3 & | operator-= (vector3 const &rhs) noexcept |
| constexpr vector3 & | operator*= (float const &rhs) noexcept |
| constexpr bool | holds_invariant () const noexcept |
| Check if the vector is valid. | |
Friends | |
| constexpr friend vector3 | operator+ (vector3 const &lhs, vector3 const &rhs) noexcept |
| Add two vectors from each other. | |
| constexpr friend vector3 | operator- (vector3 const &lhs, vector3 const &rhs) noexcept |
| Subtract two vectors from each other. | |
| constexpr friend vector3 | operator* (vector3 const &lhs, float const &rhs) noexcept |
| Scale the vector by a scaler. | |
| constexpr friend vector3 | operator* (float const &lhs, vector3 const &rhs) noexcept |
| Scale the vector by a scaler. | |
| constexpr friend bool | operator== (vector3 const &lhs, vector3 const &rhs) noexcept |
| Compare if two vectors are equal. | |
| constexpr friend float | squared_hypot (vector3 const &rhs) noexcept |
| Get the squared length of the vector. | |
| float | hypot (vector3 const &rhs) noexcept |
| Get the length of the vector. | |
| constexpr friend float | rcp_hypot (vector3 const &rhs) noexcept |
| Get the length of the vector. | |
| constexpr friend vector3 | normalize (vector3 const &rhs) noexcept |
| Normalize a vector to a unit vector. | |
| constexpr friend float | dot (vector3 const &lhs, vector3 const &rhs) noexcept |
| Get the dot product between two vectors. | |
| constexpr friend vector3 | normal (vector3 const &rhs, float angle) noexcept |
| Get the normal on a 3D vector. | |
| constexpr friend vector3 | cross (vector3 const &lhs, vector3 const &rhs) noexcept |
| Get the cross product between two 3D vectors. | |
| constexpr vector3 | min (vector3 const &lhs, vector3 const &rhs) noexcept |
| Mix the two vectors and get the lowest value of each element. | |
| constexpr vector3 | max (vector3 const &lhs, vector3 const &rhs) noexcept |
| Mix the two vectors and get the highest value of each element. | |
| constexpr vector3 | round (vector3 const &rhs) noexcept |
| Round the elements of the vector toward nearest integer. | |
| constexpr vector3 | ceil (vector3 const &rhs) noexcept |
| Round the elements of the vector toward upward and to the right. | |
| constexpr vector3 | floor (vector3 const &rhs) noexcept |
| Round the elements of the vector toward downward and to the left. | |
| std::string | to_string (vector3 const &rhs) noexcept |
| std::ostream & | operator<< (std::ostream &lhs, vector3 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.
Construct a vector from a lower dimension vector.
|
inlineexplicitconstexprnoexcept |
Construct a vector from a array_type-simd.
|
inlineconstexprnoexcept |
Construct a empty vector / zero length.
Construct a 3D vector from x, y and z elements.
| x | The x element. |
| y | The y element. |
| z | The z element. |
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.
Construct a vector from a higher dimension vector.
This will clear the values in the higher dimensions.
Mirror this vector.
Access the x element from the vector.
Access the x element from the vector.
Access the y element from the vector.
Access the y element from the vector.
Access the z element from the vector.
Access the z element from the vector.
Round the elements of the vector toward upward and to the right.
Get the cross product between two 3D 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. |
Mix the two vectors and get the highest value of each element.
| lhs | The first vector. |
| rhs | The first vector. |
Mix the two vectors and get the lowest value of each element.
| lhs | The first vector. |
| rhs | The first vector. |
Get the normal on a 3D vector.
| rhs | The vector. |
| angle | The angle around the vector, only value_type{0} is implemented (xy-plane) |
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. |