HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Friends
tt::numeric_array< T, N > Class Template Reference

Public Types

using container_type = aligned_array<T, N>
 
using value_type = typename container_type::value_type
 
using size_type = typename container_type::size_type
 
using difference_type = typename container_type::difference_type
 
using reference = typename container_type::reference
 
using const_reference = typename container_type::const_reference
 
using pointer = typename container_type::pointer
 
using const_pointer = typename container_type::const_pointer
 
using iterator = typename container_type::iterator
 
using const_iterator = typename container_type::const_iterator
 

Public Member Functions

constexpr numeric_array (numeric_array const &rhs) noexcept=default
 
constexpr numeric_array (numeric_array &&rhs) noexcept=default
 
constexpr numeric_arrayoperator= (numeric_array const &rhs) noexcept=default
 
constexpr numeric_arrayoperator= (numeric_array &&rhs) noexcept=default
 
constexpr numeric_array (std::initializer_list< T > rhs) noexcept
 
constexpr numeric_array (T const &first) noexcept
 
template<arithmetic... Rest>
requires (sizeof...(Rest) + 2 <= N)
constexpr numeric_array (T const &first, T const &second, Rest const &...rest) noexcept
 
constexpr numeric_array (aligned_array< T, N > const &rhs) noexcept
 
template<arithmetic U, ssize_t M>
constexpr numeric_array (std::array< U, M > const &rhs) noexcept
 
template<arithmetic U, ssize_t M>
constexpr numeric_array (numeric_array< U, M > const &rhs) noexcept
 
 numeric_array (__m128 const &rhs) noexcept
 
 numeric_array (__m128d const &rhs) noexcept
 
 numeric_array (__m128i const &rhs) noexcept
 
 numeric_array (__m256 const &rhs) noexcept
 
 numeric_array (__m256d const &rhs) noexcept
 
 numeric_array (__m256i const &rhs) noexcept
 
template<arithmetic U, ssize_t M>
constexpr operator std::array< U, M > () const noexcept
 
template<arithmetic U, ssize_t M>
constexpr operator numeric_array< U, M > () const noexcept
 
 operator __m128 () const noexcept
 
 operator __m128d () const noexcept
 
 operator __m128i () const noexcept
 
 operator __m256 () const noexcept
 
 operator __m256d () const noexcept
 
 operator __m256i () const noexcept
 
constexpr T const & operator[] (ssize_t i) const noexcept
 
constexpr T & operator[] (ssize_t i) noexcept
 
constexpr reference front () noexcept
 
constexpr const_reference front () const noexcept
 
constexpr reference back () noexcept
 
constexpr const_reference back () const noexcept
 
constexpr pointer data () noexcept
 
constexpr const_pointer data () const noexcept
 
constexpr iterator begin () noexcept
 
constexpr const_iterator begin () const noexcept
 
constexpr const_iterator cbegin () const noexcept
 
constexpr iterator end () noexcept
 
constexpr const_iterator end () const noexcept
 
constexpr const_iterator cend () const noexcept
 
constexpr bool empty () const noexcept
 
constexpr size_type size () const noexcept
 
constexpr size_type max_size () const noexcept
 
constexpr bool is_point () const noexcept
 
constexpr bool is_vector () const noexcept
 
constexpr bool is_opaque () const noexcept
 
constexpr bool is_transparent () const noexcept
 
constexpr T const & x () const noexcept
 
constexpr T const & y () const noexcept
 
constexpr T const & z () const noexcept
 
constexpr T const & w () const noexcept
 
constexpr T & x () noexcept
 
constexpr T & y () noexcept
 
constexpr T & z () noexcept
 
constexpr T & w () noexcept
 
constexpr T const & r () const noexcept
 
constexpr T const & g () const noexcept
 
constexpr T const & b () const noexcept
 
constexpr T const & a () const noexcept
 
constexpr T & r () noexcept
 
constexpr T & g () noexcept
 
constexpr T & b () noexcept
 
constexpr T & a () noexcept
 
constexpr T const & width () const noexcept
 
constexpr T const & height () const noexcept
 
constexpr T const & depth () const noexcept
 
constexpr T & width () noexcept
 
constexpr T & height () noexcept
 
constexpr T & depth () noexcept
 
constexpr numeric_arrayoperator+= (numeric_array const &rhs) noexcept
 
constexpr numeric_arrayoperator+= (T const &rhs) noexcept
 
constexpr numeric_arrayoperator-= (numeric_array const &rhs) noexcept
 
constexpr numeric_arrayoperator-= (T const &rhs) noexcept
 
constexpr numeric_arrayoperator*= (numeric_array const &rhs) noexcept
 
constexpr numeric_arrayoperator*= (T const &rhs) noexcept
 
constexpr numeric_arrayoperator/= (numeric_array const &rhs) noexcept
 
constexpr numeric_arrayoperator/= (T const &rhs) noexcept
 
constexpr numeric_arrayoperator%= (numeric_array const &rhs) noexcept
 
constexpr numeric_arrayoperator%= (T const &rhs) noexcept
 
template<ssize_t... Elements>
constexpr numeric_array swizzle () const
 swizzle around the elements of the numeric array.
 

Static Public Member Functions

static constexpr numeric_array broadcast (T rhs) noexcept
 
static constexpr numeric_array point () noexcept
 Get a point at the origin.
 
static constexpr numeric_array point (numeric_array rhs) noexcept
 Convert vector to point.
 
static constexpr numeric_array point (std::initializer_list< T > rhs) noexcept
 
template<arithmetic... Rest>
requires (sizeof...(Rest) < N)
static constexpr numeric_array point (T const &first, Rest const &...rest) noexcept
 
static constexpr numeric_array color (std::initializer_list< T > rhs) noexcept
 
template<arithmetic... Rest>
requires (sizeof...(Rest) < N)
static constexpr numeric_array color (T const &first, Rest const &...rest) noexcept
 

Static Public Attributes

static constexpr ssize_t get_zero = -1
 
static constexpr ssize_t get_one = -2
 

Friends

template<ssize_t I>
constexpr T & get (numeric_array &rhs) noexcept
 Get a element from the numeric array.
 
template<ssize_t I>
constexpr T get (numeric_array &&rhs) noexcept
 Get a element from the numeric array.
 
template<ssize_t I>
constexpr T get (numeric_array const &rhs) noexcept
 Get a element from the numeric array.
 
template<size_t Mask = ~size_t{0}>
constexpr numeric_array zero (numeric_array rhs) noexcept
 Set individual elements to zero.
 
template<size_t Mask = ~size_t{0}>
constexpr numeric_array neg (numeric_array rhs) noexcept
 Negate individual elements.
 
constexpr numeric_array operator- (numeric_array const &rhs) noexcept
 
constexpr numeric_array abs (numeric_array const &rhs) noexcept
 
constexpr numeric_array rcp (numeric_array const &rhs) noexcept
 
constexpr numeric_array sqrt (numeric_array const &rhs) noexcept
 
constexpr numeric_array rcp_sqrt (numeric_array const &rhs) noexcept
 
constexpr numeric_array floor (numeric_array const &rhs) noexcept
 
constexpr numeric_array ceil (numeric_array const &rhs) noexcept
 
constexpr numeric_array round (numeric_array const &rhs) noexcept
 
template<ssize_t Mask>
constexpr T dot (numeric_array const &lhs, numeric_array const &rhs) noexcept
 Take a dot product.
 
template<ssize_t Mask>
constexpr T hypot (numeric_array const &rhs) noexcept
 Take the length of the vector.
 
template<ssize_t Mask>
constexpr T squared_hypot (numeric_array const &rhs) noexcept
 Take the squared length of the vector.
 
template<ssize_t Mask>
constexpr T rcp_hypot (numeric_array const &rhs) noexcept
 Take a reciprocal of the length.
 
template<ssize_t Mask>
constexpr numeric_array normalize (numeric_array const &rhs) noexcept
 Normalize a vector.
 
constexpr unsigned int eq (numeric_array const &lhs, numeric_array const &rhs) noexcept
 
constexpr unsigned int ne (numeric_array const &lhs, numeric_array const &rhs) noexcept
 
constexpr unsigned int lt (numeric_array const &lhs, numeric_array const &rhs) noexcept
 
constexpr unsigned int gt (numeric_array const &lhs, numeric_array const &rhs) noexcept
 
constexpr unsigned int le (numeric_array const &lhs, numeric_array const &rhs) noexcept
 
constexpr unsigned int ge (numeric_array const &lhs, numeric_array const &rhs) noexcept
 
constexpr bool operator== (numeric_array const &lhs, numeric_array const &rhs) noexcept
 
constexpr bool operator!= (numeric_array const &lhs, numeric_array const &rhs) noexcept
 
constexpr numeric_array operator+ (numeric_array const &lhs, numeric_array const &rhs) noexcept
 
constexpr numeric_array operator+ (numeric_array const &lhs, T const &rhs) noexcept
 
constexpr numeric_array operator+ (T const &lhs, numeric_array const &rhs) noexcept
 
constexpr numeric_array hadd (numeric_array const &lhs, numeric_array const &rhs) noexcept
 
constexpr numeric_array hsub (numeric_array const &lhs, numeric_array const &rhs) noexcept
 
constexpr numeric_array operator- (numeric_array const &lhs, numeric_array const &rhs) noexcept
 
constexpr numeric_array operator- (numeric_array const &lhs, T const &rhs) noexcept
 
template<size_t Mask = ~size_t{0}>
constexpr numeric_array addsub (numeric_array const &lhs, numeric_array const &rhs) noexcept
 Add or subtract individual elements.
 
constexpr numeric_array operator- (T const &lhs, numeric_array const &rhs) noexcept
 
constexpr numeric_array operator* (numeric_array const &lhs, numeric_array const &rhs) noexcept
 
constexpr numeric_array operator* (numeric_array const &lhs, T const &rhs) noexcept
 
constexpr numeric_array operator* (T const &lhs, numeric_array const &rhs) noexcept
 
constexpr numeric_array operator/ (numeric_array const &lhs, numeric_array const &rhs) noexcept
 
constexpr numeric_array operator/ (numeric_array const &lhs, T const &rhs) noexcept
 
constexpr numeric_array operator/ (T const &lhs, numeric_array const &rhs) noexcept
 
constexpr numeric_array operator% (numeric_array const &lhs, numeric_array const &rhs) noexcept
 
constexpr numeric_array operator% (numeric_array const &lhs, T const &rhs) noexcept
 
constexpr numeric_array operator% (T const &lhs, numeric_array const &rhs) noexcept
 
constexpr numeric_array min (numeric_array const &lhs, numeric_array const &rhs) noexcept
 
constexpr numeric_array max (numeric_array const &lhs, numeric_array const &rhs) noexcept
 
constexpr numeric_array clamp (numeric_array const &lhs, numeric_array const &low, numeric_array const &high) noexcept
 
constexpr numeric_array cross_2D (numeric_array const &rhs) noexcept
 Calculate the 2D normal on a 2D vector.
 
constexpr numeric_array normal_2D (numeric_array const &rhs) noexcept
 Calculate the 2D unit-normal on a 2D vector.
 
constexpr float cross_2D (numeric_array const &lhs, numeric_array const &rhs) noexcept
 Calculate the cross-product between two 2D vectors.
 
constexpr friend numeric_array cross_3D (numeric_array const &lhs, numeric_array const &rhs) noexcept
 
template<int D>
requires (D == 4)
numeric_array hamilton_cross (numeric_array const &lhs, numeric_array const &rhs) noexcept
 
constexpr numeric_array midpoint (numeric_array const &p1, numeric_array const &p2) noexcept
 Find a point at the midpoint between two points.
 
constexpr numeric_array reflect_point (numeric_array const &p, numeric_array const anchor) noexcept
 Find the point on the other side and at the same distance of an anchor-point.
 
template<typename... Columns>
constexpr std::array< numeric_array, N > transpose (Columns const &...columns) noexcept
 
numeric_array desaturate (numeric_array const &color, T brightness) noexcept
 
numeric_array composit (numeric_array const &under, numeric_array const &over) noexcept
 
std::string to_string (numeric_array const &rhs) noexcept
 
std::ostreamoperator<< (std::ostream &lhs, numeric_array const &rhs)
 
template<int I, typename First , typename... Rest>
constexpr void transpose_detail (First const &first, Rest const &...rest, std::array< numeric_array, N > &r) noexcept
 

Member Function Documentation

◆ point() [1/2]

template<arithmetic T, ssize_t N>
static constexpr numeric_array tt::numeric_array< T, N >::point ( )
inlinestaticconstexprnoexcept

Get a point at the origin.

◆ point() [2/2]

template<arithmetic T, ssize_t N>
static constexpr numeric_array tt::numeric_array< T, N >::point ( numeric_array< T, N > rhs)
inlinestaticconstexprnoexcept

Convert vector to point.

◆ swizzle()

template<arithmetic T, ssize_t N>
template<ssize_t... Elements>
constexpr numeric_array tt::numeric_array< T, N >::swizzle ( ) const
inlineconstexpr

swizzle around the elements of the numeric array.

Template Parameters
Elementsa list of indices pointing to an element in this array. Or the special indices -1: literal zero, -2: literal one.
Returns
A new array with the elements ordered based on the Elements list. The elements at the end of the array are set to zero.

Friends And Related Symbol Documentation

◆ addsub

template<arithmetic T, ssize_t N>
template<size_t Mask = ~size_t{0}>
constexpr numeric_array addsub ( numeric_array< T, N > const & lhs,
numeric_array< T, N > const & rhs )
friend

Add or subtract individual elements.

Template Parameters
Maskbit mask where '1' means to add, '0' means to subtract.

◆ cross_2D [1/2]

template<arithmetic T, ssize_t N>
constexpr float cross_2D ( numeric_array< T, N > const & lhs,
numeric_array< T, N > const & rhs )
friend

Calculate the cross-product between two 2D vectors.

◆ cross_2D [2/2]

template<arithmetic T, ssize_t N>
constexpr numeric_array cross_2D ( numeric_array< T, N > const & rhs)
friend

Calculate the 2D normal on a 2D vector.

◆ dot

template<arithmetic T, ssize_t N>
template<ssize_t Mask>
constexpr T dot ( numeric_array< T, N > const & lhs,
numeric_array< T, N > const & rhs )
friend

Take a dot product.

Template Parameters
MaskA mask for which elements participate in the dot product.
Parameters
lhsThe left hand side.
rhsThe right hand side.
Returns
Result of the dot product.

◆ get [1/3]

template<arithmetic T, ssize_t N>
template<ssize_t I>
constexpr T get ( numeric_array< T, N > && rhs)
friend

Get a element from the numeric array.

Template Parameters
IIndex into the array, or the special indices: -1 yields a literal 0, -2 yields a literal 1.

◆ get [2/3]

template<arithmetic T, ssize_t N>
template<ssize_t I>
constexpr T & get ( numeric_array< T, N > & rhs)
friend

Get a element from the numeric array.

Template Parameters
IIndex into the array

◆ get [3/3]

template<arithmetic T, ssize_t N>
template<ssize_t I>
constexpr T get ( numeric_array< T, N > const & rhs)
friend

Get a element from the numeric array.

Template Parameters
IIndex into the array, or the special indices: -1 yields a literal 0, -2 yields a literal 1.

◆ hypot

template<arithmetic T, ssize_t N>
template<ssize_t Mask>
constexpr T hypot ( numeric_array< T, N > const & rhs)
friend

Take the length of the vector.

Template Parameters
MaskA mask for which elements participate in the hypot calculation.
Parameters
lhsThe left hand side.
rhsThe right hand side.
Returns
Result of the hypot calculation.

◆ midpoint

template<arithmetic T, ssize_t N>
constexpr numeric_array midpoint ( numeric_array< T, N > const & p1,
numeric_array< T, N > const & p2 )
friend

Find a point at the midpoint between two points.

◆ neg

template<arithmetic T, ssize_t N>
template<size_t Mask = ~size_t{0}>
constexpr numeric_array neg ( numeric_array< T, N > rhs)
friend

Negate individual elements.

Template Parameters
Maskbit mask where '1' means to negate, '0' to keep original.

◆ normal_2D

template<arithmetic T, ssize_t N>
constexpr numeric_array normal_2D ( numeric_array< T, N > const & rhs)
friend

Calculate the 2D unit-normal on a 2D vector.

◆ normalize

template<arithmetic T, ssize_t N>
template<ssize_t Mask>
constexpr numeric_array normalize ( numeric_array< T, N > const & rhs)
friend

Normalize a vector.

All elements that do not participate in the normalization will be set to zero.

Template Parameters
MaskA mask for which elements participate in the normalization calculation.
Parameters
lhsThe left hand side.
rhsThe right hand side.
Returns
The normalized vector.

◆ rcp_hypot

template<arithmetic T, ssize_t N>
template<ssize_t Mask>
constexpr T rcp_hypot ( numeric_array< T, N > const & rhs)
friend

Take a reciprocal of the length.

Template Parameters
MaskA mask for which elements participate in the hypot calculation.
Parameters
lhsThe left hand side.
rhsThe right hand side.
Returns
Result of the hypot-squared calculation.

◆ reflect_point

template<arithmetic T, ssize_t N>
constexpr numeric_array reflect_point ( numeric_array< T, N > const & p,
numeric_array< T, N > const anchor )
friend

Find the point on the other side and at the same distance of an anchor-point.

◆ squared_hypot

template<arithmetic T, ssize_t N>
template<ssize_t Mask>
constexpr T squared_hypot ( numeric_array< T, N > const & rhs)
friend

Take the squared length of the vector.

Template Parameters
MaskA mask for which elements participate in the hypot calculation.
Parameters
lhsThe left hand side.
rhsThe right hand side.
Returns
Result of the hypot-squared calculation.

◆ zero

template<arithmetic T, ssize_t N>
template<size_t Mask = ~size_t{0}>
constexpr numeric_array zero ( numeric_array< T, N > rhs)
friend

Set individual elements to zero.

Template Parameters
Maskbit mask where '1' means to negate, '0' to keep original.

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