HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Friends
v1::point3 Class Reference

#include <hikogui/geometry/point3.hpp>

Public Types

using array_type = simd<float, 4>
 
using value_type = array_type::value_type
 

Public Member Functions

constexpr point3 (point3 const &) noexcept=default
 
constexpr point3 (point3 &&) noexcept=default
 
constexpr point3operator= (point3 const &) noexcept=default
 
constexpr point3operator= (point3 &&) noexcept=default
 
constexpr point3 (point2 const &other) noexcept
 Construct a point from a lower dimension point.
 
constexpr operator point2 () const noexcept
 
constexpr point3 (point2 const &other, float z) noexcept
 Construct a point from a lower dimension point.
 
constexpr operator array_type () const noexcept
 Convert a point to its array_type-nummeric_array.
 
constexpr point3 (array_type const &other) noexcept
 Construct a point from a array_type-simd.
 
constexpr point3 () noexcept
 Construct a point at the origin of the coordinate system.
 
constexpr point3 (float x, float y, float z=0.0f) 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 & z () noexcept
 Access the z 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 float z () const noexcept
 Access the z element from the point.
 
constexpr point3operator+= (vector3 const &rhs) noexcept
 
constexpr point3operator-= (vector3 const &rhs) noexcept
 
constexpr bool holds_invariant () const noexcept
 Check if the point is valid.
 

Friends

constexpr friend point3 operator+ (point3 const &lhs, vector3 const &rhs) noexcept
 Move a point along a vector.
 
constexpr friend point3 operator+ (vector3 const &lhs, point3 const &rhs) noexcept
 Move a point along a vector.
 
constexpr friend point3 operator- (point3 const &lhs, vector3 const &rhs) noexcept
 Move a point backward along the vector.
 
constexpr friend vector3 operator- (point3 const &lhs, point3 const &rhs) noexcept
 Find the vector between two points.
 
constexpr friend bool operator== (point3 const &lhs, point3 const &rhs) noexcept
 Compare if two points are equal.
 
constexpr point3 midpoint (point3 const &lhs, point3 const &rhs) noexcept
 
constexpr point3 reflect (point3 const &lhs, point3 const &rhs) noexcept
 Reflect a point.
 
constexpr point3 min (point3 const &lhs, point3 const &rhs) noexcept
 Mix the two points and get the lowest value of each element.
 
constexpr point3 max (point3 const &lhs, point3 const &rhs) noexcept
 Mix the two points and get the highest value of each element.
 
constexpr point3 round (point3 const &rhs) noexcept
 Round the coordinates of a point toward nearest integer.
 
constexpr point3 ceil (point3 const &rhs) noexcept
 Round the coordinates of a point toward the right-top.
 
constexpr point3 floor (point3 const &rhs) noexcept
 Round the coordinates of a point toward the left-bottom.
 
constexpr point3 ceil (point3 const &lhs, extent3 rhs) noexcept
 Round the coordinates of a point toward the top-right with the given granularity.
 
constexpr point3 floor (point3 const &lhs, extent3 rhs) noexcept
 Round the coordinates of a point toward the left-bottom with the given granularity.
 
float distance (point3 const &lhs, point3 const &rhs) noexcept
 
std::string to_string (point3 const &rhs) noexcept
 
std::ostreamoperator<< (std::ostream &lhs, point3 const &rhs) noexcept
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ point3() [1/5]

constexpr v1::point3::point3 ( point2 const & other)
inlineconstexprnoexcept

Construct a point from a lower dimension point.

◆ point3() [2/5]

constexpr v1::point3::point3 ( point2 const & other,
float z )
inlineconstexprnoexcept

Construct a point from a lower dimension point.

◆ point3() [3/5]

constexpr v1::point3::point3 ( array_type const & other)
inlineexplicitconstexprnoexcept

Construct a point from a array_type-simd.

◆ point3() [4/5]

constexpr v1::point3::point3 ( )
inlineconstexprnoexcept

Construct a point at the origin of the coordinate system.

◆ point3() [5/5]

constexpr v1::point3::point3 ( float x,
float y,
float z = 0.0f )
inlineconstexprnoexcept

Construct a 3D point from x, y and z elements.

Parameters
xThe x element.
yThe y element.
zThe z element.

Member Function Documentation

◆ holds_invariant()

constexpr bool v1::point3::holds_invariant ( ) const
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.

◆ operator array_type()

constexpr v1::point3::operator array_type ( ) const
inlineexplicitconstexprnoexcept

Convert a point to its array_type-nummeric_array.

◆ x() [1/2]

constexpr float v1::point3::x ( ) const
inlineconstexprnoexcept

Access the x element from the point.

Returns
a reference to the x element.

◆ x() [2/2]

constexpr float & v1::point3::x ( )
inlineconstexprnoexcept

Access the x element from the point.

Returns
a reference to the x element.

◆ y() [1/2]

constexpr float v1::point3::y ( ) const
inlineconstexprnoexcept

Access the y element from the point.

Returns
a reference to the y element.

◆ y() [2/2]

constexpr float & v1::point3::y ( )
inlineconstexprnoexcept

Access the y element from the point.

Returns
a reference to the y element.

◆ z() [1/2]

constexpr float v1::point3::z ( ) const
inlineconstexprnoexcept

Access the z element from the point.

Returns
a reference to the z element.

◆ z() [2/2]

constexpr float & v1::point3::z ( )
inlineconstexprnoexcept

Access the z element from the point.

Returns
a reference to the z element.

Friends And Related Symbol Documentation

◆ ceil [1/2]

constexpr point3 ceil ( point3 const & lhs,
extent3 rhs )
friend

Round the coordinates of a point toward the top-right with the given granularity.

◆ ceil [2/2]

constexpr point3 ceil ( point3 const & rhs)
friend

Round the coordinates of a point toward the right-top.

◆ floor [1/2]

constexpr point3 floor ( point3 const & lhs,
extent3 rhs )
friend

Round the coordinates of a point toward the left-bottom with the given granularity.

◆ floor [2/2]

constexpr point3 floor ( point3 const & rhs)
friend

Round the coordinates of a point toward the left-bottom.

◆ max

constexpr point3 max ( point3 const & lhs,
point3 const & rhs )
friend

Mix the two points and get the highest value of each element.

Parameters
lhsThe first point.
rhsThe first point.
Returns
A point that is the most right of both points, and most top of both points.

◆ min

constexpr point3 min ( point3 const & lhs,
point3 const & rhs )
friend

Mix the two points and get the lowest value of each element.

Parameters
lhsThe first point.
rhsThe first point.
Returns
A point that is the most left of both points, and most bottom of both points.

◆ operator+ [1/2]

constexpr friend point3 operator+ ( point3 const & lhs,
vector3 const & rhs )
friend

Move a point along a vector.

Parameters
lhsThe point to move.
rhsThe vector to move along.
Returns
The moved point.

◆ operator+ [2/2]

constexpr friend point3 operator+ ( vector3 const & lhs,
point3 const & rhs )
friend

Move a point along a vector.

Parameters
lhsThe vector to move along.
rhsThe point to move.
Returns
The moved point.

◆ operator- [1/2]

constexpr friend vector3 operator- ( point3 const & lhs,
point3 const & rhs )
friend

Find the vector between two points.

Parameters
lhsThe first point.
rhsThe second point.
Returns
The vector from the second to first point.

◆ operator- [2/2]

constexpr friend point3 operator- ( point3 const & lhs,
vector3 const & rhs )
friend

Move a point backward along the vector.

Parameters
lhsThe point to move.
rhsThe vector to move backward.
Returns
The moved point.

◆ operator==

constexpr friend bool operator== ( point3 const & lhs,
point3 const & rhs )
friend

Compare if two points are equal.

Parameters
lhsThe first point.
rhsThe second point.
Returns
True if both point are completely equal to each other.

◆ reflect

constexpr point3 reflect ( point3 const & lhs,
point3 const & rhs )
friend

Reflect a point.

Parameters
lhsThe point to be reflected
rhsThe anchor point.
Returns
The reflected point.

◆ round

constexpr point3 round ( point3 const & rhs)
friend

Round the coordinates of a point toward nearest integer.


The documentation for this class was generated from the following file: