HikoGUI
Select Version: ⚠️ This documents the main development branch of HikoGUI. It might differ from release versions.
A low latency retained GUI
|
#include <hikogui/geometry/point2.hpp>
Public Types | |
using | array_type = simd<float, 4> |
using | value_type = array_type::value_type |
Public Member Functions | |
constexpr | point2 (point2 const &) noexcept=default |
constexpr | point2 (point2 &&) noexcept=default |
constexpr point2 & | operator= (point2 const &) noexcept=default |
constexpr point2 & | operator= (point2 &&) noexcept=default |
constexpr | operator array_type () const noexcept |
Convert a point to its array_type-nummeric_array. | |
constexpr | point2 (array_type const &other) noexcept |
Construct a point from a array_type-simd. | |
constexpr | point2 () noexcept |
Construct a point at the origin of the coordinate system. | |
constexpr | point2 (float x, float y) noexcept |
Construct a 3D point from x, y and z elements. | |
constexpr float & | x () noexcept |
Access the x element from the point. | |
constexpr float & | y () noexcept |
Access the y element from the point. | |
constexpr float | x () const noexcept |
Access the x element from the point. | |
constexpr float | y () const noexcept |
Access the y element from the point. | |
constexpr point2 & | operator+= (vector2 const &rhs) noexcept |
constexpr point2 & | operator-= (vector2 const &rhs) noexcept |
constexpr bool | holds_invariant () const noexcept |
Check if the point is valid. | |
Friends | |
constexpr friend point2 | operator+ (point2 const &lhs, vector2 const &rhs) noexcept |
Move a point along a vector. | |
constexpr friend point2 | operator+ (vector2 const &lhs, point2 const &rhs) noexcept |
Move a point along a vector. | |
constexpr friend point2 | operator- (point2 const &lhs, vector2 const &rhs) noexcept |
Move a point backward along the vector. | |
constexpr friend vector2 | operator- (point2 const &lhs, point2 const &rhs) noexcept |
Find the vector between two points. | |
constexpr friend bool | operator== (point2 const &lhs, point2 const &rhs) noexcept |
Compare if two points are equal. | |
constexpr point2 | midpoint (point2 const &lhs, point2 const &rhs) noexcept |
constexpr point2 | reflect (point2 const &lhs, point2 const &rhs) noexcept |
Reflect a point. | |
constexpr point2 | min (point2 const &lhs, point2 const &rhs) noexcept |
Mix the two points and get the lowest value of each element. | |
constexpr point2 | max (point2 const &lhs, point2 const &rhs) noexcept |
Mix the two points and get the highest value of each element. | |
constexpr point2 | round (point2 const &rhs) noexcept |
Round the coordinates of a point toward nearest integer. | |
constexpr point2 | ceil (point2 const &rhs) noexcept |
Round the coordinates of a point toward the right-top. | |
constexpr point2 | floor (point2 const &rhs) noexcept |
Round the coordinates of a point toward the left-bottom. | |
constexpr point2 | ceil (point2 const &lhs, extent2 rhs) noexcept |
Round the coordinates of a point toward the top-right with the given granularity. | |
constexpr point2 | floor (point2 const &lhs, extent2 rhs) noexcept |
Round the coordinates of a point toward the left-bottom with the given granularity. | |
float | distance (point2 const &lhs, point2 const &rhs) noexcept |
std::string | to_string (point2 const &rhs) noexcept |
std::ostream & | operator<< (std::ostream &lhs, point2 const &rhs) noexcept |
A high-level geometric point Part of the high-level vec, point, mat and color types.
A point, for both 2D or 3D is internally represented as a 4D homogeneous vector. Which can be efficiently implemented as a __m128 SSE register.
|
inlineexplicitconstexprnoexcept |
Construct a point from a array_type-simd.
|
inlineconstexprnoexcept |
Construct a point at the origin of the coordinate system.
|
inlineconstexprnoexcept |
Construct a 3D point from x, y and z elements.
x | The x element. |
y | The y element. |
|
inlineconstexprnoexcept |
Check if the point is valid.
This function will check if w is not zero, and with a 2D point is z is zero.
|
inlineexplicitconstexprnoexcept |
Convert a point to its array_type-nummeric_array.
|
inlineconstexprnoexcept |
Access the x element from the point.
|
inlineconstexprnoexcept |
Access the x element from the point.
|
inlineconstexprnoexcept |
Access the y element from the point.
|
inlineconstexprnoexcept |
Access the y element from the point.
Round the coordinates of a point toward the top-right with the given granularity.
Round the coordinates of a point toward the right-top.
Round the coordinates of a point toward the left-bottom with the given granularity.
Round the coordinates of a point toward the left-bottom.
Mix the two points and get the highest value of each element.
lhs | The first point. |
rhs | The first point. |
Mix the two points and get the lowest value of each element.
lhs | The first point. |
rhs | The first point. |
Move a point along a vector.
lhs | The point to move. |
rhs | The vector to move along. |
Move a point along a vector.
lhs | The vector to move along. |
rhs | The point to move. |
Find the vector between two points.
lhs | The first point. |
rhs | The second point. |
Move a point backward along the vector.
lhs | The point to move. |
rhs | The vector to move backward. |
Compare if two points are equal.
lhs | The first point. |
rhs | The second point. |
Reflect a point.
lhs | The point to be reflected |
rhs | The anchor point. |
Round the coordinates of a point toward nearest integer.