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

#include <ttauri/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
 Construct a extent from a f32x4-numeric_array.
 
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 x and y elements.
 
constexpr extent (float width, float height, float depth=0.0f) noexcept
 Construct a 3D extent from x, y and z elements.
 
constexpr float & width () noexcept
 Access the x-as-width element from the extent.
 
constexpr float & height () noexcept
 Access the y-as-height element from the extent.
 
constexpr float & depth () noexcept
 Access the z-as-depth element from the extent.
 
constexpr float const & width () const noexcept
 Access the x-as-width element from the extent.
 
constexpr float const & height () const noexcept
 Access the y-as-height element from the extent.
 
constexpr float const & depth () const noexcept
 Access the z-as-depth element from the extent.
 
constexpr vector< D > right () const noexcept
 
constexpr vector< D > up () const noexcept
 
constexpr bool is_valid () const noexcept
 Check if the extent is valid.
 

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 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 bool operator< (extent const &lhs, extent const &rhs) noexcept
 Compare the size of the extents.
 
constexpr friend bool operator< (extent const &lhs, extent const &rhs) noexcept
 Compare the size of the extents.
 
constexpr friend bool operator<= (extent const &lhs, extent const &rhs) noexcept
 Compare the size of the extents.
 
constexpr friend bool operator<= (extent const &lhs, extent const &rhs) noexcept
 Compare the size of the extents.
 
constexpr friend bool operator> (extent const &lhs, extent const &rhs) noexcept
 Compare the size of the extents.
 
constexpr friend bool operator> (extent const &lhs, extent const &rhs) noexcept
 Compare the size of the extents.
 
constexpr friend bool operator>= (extent const &lhs, extent const &rhs) noexcept
 Compare the size of the extents.
 
constexpr friend bool operator>= (extent const &lhs, extent const &rhs) noexcept
 Compare the size of the extents.
 
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
 
std::string to_string (extent const &rhs) noexcept
 
std::ostreamoperator<< (std::ostream &lhs, extent const &rhs) noexcept
 

Detailed Description

template<int D>
class tt::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/5]

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

Construct a extent from a lower dimension extent.

◆ extent() [2/5]

template<int D>
constexpr tt::geo::extent< D >::extent ( f32x4 const & other)
inlineexplicitconstexprnoexcept

Construct a extent from a f32x4-numeric_array.

◆ extent() [3/5]

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

Construct a empty extent / zero length.

◆ extent() [4/5]

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

Construct a 2D extent from x and y elements.

Parameters
xThe x element.
yThe y element.

◆ extent() [5/5]

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

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

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

Member Function Documentation

◆ depth() [1/2]

template<int D>
constexpr float const & tt::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 & tt::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 & tt::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 & tt::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.

◆ is_valid()

template<int D>
constexpr bool tt::geo::extent< D >::is_valid ( ) 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 tt::geo::extent< D >::operator f32x4 ( ) const
inlineexplicitconstexprnoexcept

Convert a extent to its f32x4-nummeric_array.

◆ width() [1/2]

template<int D>
constexpr float const & tt::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 & tt::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< [1/2]

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

Compare the size of the extents.

◆ operator< [2/2]

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

Compare the size of the extents.

◆ operator<= [1/2]

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

Compare the size of the extents.

◆ operator<= [2/2]

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

Compare the size of the extents.

◆ 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.

◆ operator> [1/2]

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

Compare the size of the extents.

◆ operator> [2/2]

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

Compare the size of the extents.

◆ operator>= [1/2]

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

Compare the size of the extents.

◆ operator>= [2/2]

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

Compare the size of the extents.

◆ 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>
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: