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

#include <hikogui/geometry/extent3.hpp>

Public Types

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

Public Member Functions

constexpr extent3 (extent3 const &) noexcept=default
 
constexpr extent3 (extent3 &&) noexcept=default
 
constexpr extent3operator= (extent3 const &) noexcept=default
 
constexpr extent3operator= (extent3 &&) noexcept=default
 
constexpr extent3 (extent2 const &other) noexcept
 Construct a extent from a lower dimension extent.
 
constexpr operator extent2 () const noexcept
 
constexpr operator array_type () const noexcept
 Convert a extent to its array_type-nummeric_array.
 
constexpr extent3 (array_type const &other) noexcept
 
constexpr operator bool () const noexcept
 
constexpr operator vector3 () const noexcept
 
constexpr extent3 () noexcept
 Construct a empty extent / zero length.
 
constexpr extent3 (float width, float height, float depth=0.0f) noexcept
 Construct a 3D extent from width, height and depth.
 
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 width () const noexcept
 Access the x-as-width element from the extent.
 
constexpr float height () const noexcept
 Access the y-as-height element from the extent.
 
constexpr float depth () const noexcept
 Access the z-as-depth element from the extent.
 
constexpr vector3 right () const noexcept
 
constexpr vector3 up () const noexcept
 
constexpr extent3operator+= (extent3 const &rhs) noexcept
 
constexpr bool holds_invariant () const noexcept
 Check if the extent is valid.
 

Static Public Member Functions

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

Friends

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

Detailed Description

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

◆ extent3() [1/3]

constexpr hi::v1::extent3::extent3 ( extent2 const & other)
inlineconstexprnoexcept

Construct a extent from a lower dimension extent.

◆ extent3() [2/3]

constexpr hi::v1::extent3::extent3 ( )
inlineconstexprnoexcept

Construct a empty extent / zero length.

◆ extent3() [3/3]

constexpr hi::v1::extent3::extent3 ( 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]

constexpr float hi::v1::extent3::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]

constexpr float & hi::v1::extent3::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]

constexpr float hi::v1::extent3::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]

constexpr float & hi::v1::extent3::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()

constexpr bool hi::v1::extent3::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 array_type()

constexpr hi::v1::extent3::operator array_type ( ) const
inlineexplicitconstexprnoexcept

Convert a extent to its array_type-nummeric_array.

◆ width() [1/2]

constexpr float hi::v1::extent3::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]

constexpr float & hi::v1::extent3::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

float hypot ( extent3 const & rhs)
friend

Get the length of the extent.

Parameters
rhsThe extent.
Returns
The length of the extent.

◆ normalize

constexpr friend extent3 normalize ( extent3 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]

constexpr friend extent3 operator* ( extent3 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]

constexpr friend extent3 operator* ( float const & lhs,
extent3 const & rhs )
friend

Scale the extent by a scaler.

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

◆ operator+ [1/2]

constexpr friend extent3 operator+ ( extent3 const & lhs,
extent3 const & rhs )
friend

Add two extents from each other.

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

◆ operator+ [2/2]

constexpr friend extent3 operator+ ( extent3 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-

constexpr friend extent3 operator- ( extent3 const & lhs,
extent3 const & rhs )
friend

Subtract two extents from each other.

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

◆ operator==

constexpr friend bool operator== ( extent3 const & lhs,
extent3 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

constexpr friend float rcp_hypot ( extent3 const & rhs)
friend

Get the length of the extent.

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

◆ squared_hypot

hi_force_inline constexpr friend float squared_hypot ( extent3 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: