HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Friends
v1::geo::extent< D > Class Template Reference

#include <hikogui/geometry/extent.hpp>

Public Member Functions

constexpr extent (extent const &) noexcept=default
 
constexpr extent (extent &&) noexcept=default
 
constexpr extentoperator= (extent const &) noexcept=default
 
constexpr extentoperator= (extent &&) noexcept=default
 
template<int E>
requires (E < D)
constexpr extent (extent< E > const &other) noexcept
 Construct a extent from a lower dimension extent.
 
constexpr operator f32x4 () const noexcept
 Convert a extent to its f32x4-nummeric_array.
 
constexpr extent (f32x4 const &other) noexcept
 
constexpr operator bool () const noexcept
 
template<int E>
requires (E >= D)
constexpr operator vector< E > () const noexcept
 
constexpr extent () noexcept
 Construct a empty extent / zero length.
 
constexpr extent (float width, float height) noexcept
 Construct a 2D extent from the width and height.
 
constexpr extent (float width, float height, float depth=0.0f) noexcept
 Construct a 3D extent from width, height and depth.
 
constexpr floatwidth () noexcept
 Access the x-as-width element from the extent.
 
constexpr floatheight () noexcept
 Access the y-as-height element from the extent.
 
constexpr floatdepth () noexcept
 Access the z-as-depth element from the extent.
 
constexpr float constwidth () const noexcept
 Access the x-as-width element from the extent.
 
constexpr float constheight () const noexcept
 Access the y-as-height element from the extent.
 
constexpr float constdepth () const noexcept
 Access the z-as-depth element from the extent.
 
constexpr vector< D > right () const noexcept
 
constexpr vector< D > up () const noexcept
 
constexpr extentoperator+= (extent const &rhs) noexcept
 
constexpr bool holds_invariant () const noexcept
 Check if the extent is valid.
 

Static Public Member Functions

static constexpr extent infinity () noexcept
 
static constexpr extent infinity () noexcept
 
static constexpr extent large () noexcept
 
static constexpr extent large () noexcept
 
static constexpr extent nan () noexcept
 
static constexpr extent nan () noexcept
 

Friends

constexpr friend extent operator+ (extent const &lhs, extent const &rhs) noexcept
 Add two extents from each other.
 
constexpr friend extent operator- (extent const &lhs, extent const &rhs) noexcept
 Subtract two extents from each other.
 
constexpr friend scale< D > operator/ (extent const &lhs, extent const &rhs) noexcept
 
constexpr friend extent operator* (extent const &lhs, float const &rhs) noexcept
 Scale the extent by a scaler.
 
template<int E>
constexpr friend auto operator+ (extent const &lhs, vector< E > const &rhs) noexcept
 
template<int E>
constexpr friend auto operator+ (vector< E > const &lhs, extent const &rhs) noexcept
 
constexpr friend extent operator+ (extent const &lhs, float const &rhs) noexcept
 Add a scaler to the extent.
 
constexpr friend extent operator* (float const &lhs, extent const &rhs) noexcept
 Scale the extent by a scaler.
 
constexpr friend bool operator== (extent const &lhs, extent const &rhs) noexcept
 Compare if two extents are equal.
 
constexpr friend std::partial_ordering operator<=> (extent const &lhs, extent const &rhs) noexcept
 
constexpr friend std::partial_ordering operator<=> (extent const &lhs, extent const &rhs) noexcept
 
hi_force_inline constexpr friend float squared_hypot (extent const &rhs) noexcept
 Get the squared length of the extent.
 
constexpr friend float hypot (extent const &rhs) noexcept
 Get the length of the extent.
 
constexpr friend float rcp_hypot (extent const &rhs) noexcept
 Get the length of the extent.
 
constexpr friend extent normalize (extent const &rhs) noexcept
 Normalize a extent to a unit extent.
 
constexpr friend extent ceil (extent const &rhs) noexcept
 
constexpr friend extent floor (extent const &rhs) noexcept
 
constexpr friend extent round (extent const &rhs) noexcept
 
constexpr friend extent min (extent const &lhs, extent const &rhs) noexcept
 
constexpr friend extent max (extent const &lhs, extent const &rhs) noexcept
 
constexpr friend extent clamp (extent const &value, extent const &min, extent const &max) noexcept
 
std::string to_string (extent const &rhs) noexcept
 
std::ostreamoperator<< (std::ostream &lhs, extent const &rhs) noexcept
 

Detailed Description

template<int D>
class v1::geo::extent< D >

A high-level geometric extent.

A extent, for both 2D or 3D is internally represented as a 4D homogeneous extent. Which can be efficiently implemented as a __m128 SSE register.

Constructor & Destructor Documentation

◆ extent() [1/4]

template<int D>
template<int E>
requires (E < D)
constexpr v1::geo::extent< D >::extent ( extent< E > const & other)
inlineconstexprnoexcept

Construct a extent from a lower dimension extent.

◆ extent() [2/4]

template<int D>
constexpr v1::geo::extent< D >::extent ( )
inlineconstexprnoexcept

Construct a empty extent / zero length.

◆ extent() [3/4]

template<int D>
constexpr v1::geo::extent< D >::extent ( float width,
float height )
inlineconstexprnoexcept

Construct a 2D extent from the width and height.

Parameters
widthThe width element.
heightThe height element.

◆ extent() [4/4]

template<int D>
constexpr v1::geo::extent< D >::extent ( float width,
float height,
float depth = 0.0f )
inlineconstexprnoexcept

Construct a 3D extent from width, height and depth.

Parameters
widthThe width element.
heightThe height element.
depthThe depth element.

Member Function Documentation

◆ depth() [1/2]

template<int D>
constexpr float const & v1::geo::extent< D >::depth ( ) const
inlineconstexprnoexcept

Access the z-as-depth element from the extent.

A extent can be seen as having a width, height and depth, these accessors are aliases for x, y, and z.

Returns
a reference to the z element.

◆ depth() [2/2]

template<int D>
constexpr float & v1::geo::extent< D >::depth ( )
inlineconstexprnoexcept

Access the z-as-depth element from the extent.

A extent can be seen as having a width, height and depth, these accessors are aliases for x, y, and z.

Returns
a reference to the z element.

◆ height() [1/2]

template<int D>
constexpr float const & v1::geo::extent< D >::height ( ) const
inlineconstexprnoexcept

Access the y-as-height element from the extent.

A extent can be seen as having a width, height and depth, these accessors are aliases for x, y, and z.

Returns
a reference to the y element.

◆ height() [2/2]

template<int D>
constexpr float & v1::geo::extent< D >::height ( )
inlineconstexprnoexcept

Access the y-as-height element from the extent.

A extent can be seen as having a width, height and depth, these accessors are aliases for x, y, and z.

Returns
a reference to the y element.

◆ holds_invariant()

template<int D>
constexpr bool v1::geo::extent< D >::holds_invariant ( ) const
inlineconstexprnoexcept

Check if the extent is valid.

Extends must be positive. This function will check if w is zero, and with 2D extent is z is zero.

◆ operator f32x4()

template<int D>
constexpr v1::geo::extent< D >::operator f32x4 ( ) const
inlineexplicitconstexprnoexcept

Convert a extent to its f32x4-nummeric_array.

◆ width() [1/2]

template<int D>
constexpr float const & v1::geo::extent< D >::width ( ) const
inlineconstexprnoexcept

Access the x-as-width element from the extent.

A extent can be seen as having a width, height and depth, these accessors are aliases for x, y, and z.

Returns
a reference to the x element.

◆ width() [2/2]

template<int D>
constexpr float & v1::geo::extent< D >::width ( )
inlineconstexprnoexcept

Access the x-as-width element from the extent.

A extent can be seen as having a width, height and depth, these accessors are aliases for x, y, and z.

Returns
a reference to the x element.

Friends And Related Symbol Documentation

◆ hypot

template<int D>
constexpr friend float hypot ( extent< D > const & rhs)
friend

Get the length of the extent.

Parameters
rhsThe extent.
Returns
The length of the extent.

◆ normalize

template<int D>
constexpr friend extent normalize ( extent< D > const & rhs)
friend

Normalize a extent to a unit extent.

Parameters
rhsThe extent.
Returns
A extent with the same direction as the given extent, but its length is 1.0.

◆ operator* [1/2]

template<int D>
constexpr friend extent operator* ( extent< D > const & lhs,
float const & rhs )
friend

Scale the extent by a scaler.

Parameters
lhsThe extent to scale.
rhsThe scaling factor.
Returns
The scaled extent.

◆ operator* [2/2]

template<int D>
constexpr friend extent operator* ( float const & lhs,
extent< D > const & rhs )
friend

Scale the extent by a scaler.

Parameters
lhsThe extent to scale.
rhsThe scaling factor.
Returns
The scaled extent.

◆ operator+ [1/2]

template<int D>
constexpr friend extent operator+ ( extent< D > const & lhs,
extent< D > const & rhs )
friend

Add two extents from each other.

Parameters
lhsThe first extent.
rhsThe second extent.
Returns
A new extent.

◆ operator+ [2/2]

template<int D>
constexpr friend extent operator+ ( extent< D > const & lhs,
float const & rhs )
friend

Add a scaler to the extent.

Parameters
lhsThe extent to scale.
rhsThe scaling factor.
Returns
The scaled extent.

◆ operator-

template<int D>
constexpr friend extent operator- ( extent< D > const & lhs,
extent< D > const & rhs )
friend

Subtract two extents from each other.

Parameters
lhsThe first extent.
rhsThe second extent.
Returns
A new extent.

◆ operator==

template<int D>
constexpr friend bool operator== ( extent< D > const & lhs,
extent< D > const & rhs )
friend

Compare if two extents are equal.

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

◆ rcp_hypot

template<int D>
constexpr friend float rcp_hypot ( extent< D > const & rhs)
friend

Get the length of the extent.

Parameters
rhsThe extent.
Returns
One over the length of the extent.

◆ squared_hypot

template<int D>
hi_force_inline constexpr friend float squared_hypot ( extent< D > const & rhs)
friend

Get the squared length of the extent.

Parameters
rhsThe extent.
Returns
The length of the extent.

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