Harlinn.Windows 0.1
Loading...
Searching...
No Matches
Harlinn::Math::Tuple2< DerivedT, T > Class Template Reference

A tuple holding two numbers. More...

#include <VectorMath.h>

Inheritance diagram for Harlinn::Math::Tuple2< DerivedT, T >:
[legend]
Collaboration diagram for Harlinn::Math::Tuple2< DerivedT, T >:
[legend]

Public Types

using DerivedType = DerivedT
 
using value_type = T
 
using size_type = size_t
 
using ValueType = value_type
 
using SizeType = size_type
 
using Traits = SIMD::Traits<value_type, Size>
 
using SIMDType = typename Traits::SIMDType
 
using ArrayType = typename Traits::ArrayType
 
using reference = typename ArrayType::reference
 
using const_reference = typename ArrayType::const_reference
 
using pointer = typename ArrayType::pointer
 
using const_pointer = typename ArrayType::const_pointer
 
using iterator = typename ArrayType::iterator
 
using const_iterator = typename ArrayType::const_iterator
 
using reverse_iterator = typename ArrayType::reverse_iterator
 
using const_reverse_iterator = typename ArrayType::const_reverse_iterator
 
using Simd = TupleSimd<DerivedType>
 The mathematical operations are performed using this type which holds a SIMD vector.
 

Public Member Functions

 Tuple2 () noexcept
 
 Tuple2 (value_type v) noexcept
 
 Tuple2 (value_type xv, value_type yv) noexcept
 
 Tuple2 (const ArrayType a) noexcept
 
template<SimdType U>
requires std::is_same_v<Traits, typename U::Traits>
 Tuple2 (const U &other) noexcept
 
template<TupleType U>
requires std::is_same_v<Traits, typename U::Traits>
 Tuple2 (const U &other) noexcept
 
template<TupleType U>
requires ( std::is_same_v<Traits, typename U::Traits> == false )
 Tuple2 (const U &other) noexcept
 
template<SimdType U>
requires std::is_same_v<Traits, typename U::Traits>
DerivedTypeoperator= (const U &other) noexcept
 
Simd ToSimd () const noexcept
 
 operator Simd () const noexcept
 
template<TupleType U>
requires ( U::Size == Size )
constexpr bool operator== (const U &other) const noexcept
 
template<TupleType U>
requires ( U::Size == Size )
constexpr bool operator!= (const U &other) const noexcept
 
constexpr bool operator== (value_type value) const noexcept
 
constexpr bool operator!= (value_type value) const noexcept
 
template<SimdType U>
requires std::is_same_v<Traits, typename U::Traits>
bool operator== (const U &other) const noexcept
 
template<SimdType U>
requires std::is_same_v<Traits, typename U::Traits>
bool operator!= (const U &other) const noexcept
 
Simd operator- () const noexcept
 
DerivedTypeoperator+= (const Simd &other) noexcept
 
template<TupleType U>
requires ( U::Size == Size )
DerivedTypeoperator+= (const U &other) noexcept
 
DerivedTypeoperator+= (const value_type value) noexcept
 
DerivedTypeoperator-= (const Simd &other) noexcept
 
template<TupleType U>
requires ( U::Size == Size )
DerivedTypeoperator-= (const U &other) noexcept
 
DerivedTypeoperator-= (const value_type value) noexcept
 
DerivedTypeoperator*= (const Simd &other) noexcept
 
template<TupleType U>
requires ( U::Size == Size )
DerivedTypeoperator*= (const U &other) noexcept
 
DerivedTypeoperator*= (const value_type value) noexcept
 
DerivedTypeoperator/= (const Simd &other) noexcept
 
template<TupleType U>
requires ( U::Size == Size )
DerivedTypeoperator/= (const U &other) noexcept
 
DerivedTypeoperator/= (const value_type value) noexcept
 
const_reference operator[] (size_t index) const noexcept
 
reference operator[] (size_t index) noexcept
 
const_pointer data () const noexcept
 
pointer data () noexcept
 
constexpr size_t size () const noexcept
 
const_reference front () const noexcept
 
reference front () noexcept
 
const_reference back () const noexcept
 
reference back () noexcept
 
const_iterator begin () const noexcept
 
const_iterator cbegin () const noexcept
 
iterator begin () noexcept
 
const_iterator end () const noexcept
 
const_iterator cend () const noexcept
 
iterator end () noexcept
 
const_reverse_iterator rbegin () const noexcept
 
reverse_iterator rbegin () noexcept
 
const_reverse_iterator rend () const noexcept
 
reverse_iterator rend () noexcept
 
void Assign (value_type xv, value_type yv) noexcept
 
void Assign (const ArrayType &src) noexcept
 
void Assign (SIMDType src) noexcept
 
bool HasNaN () const noexcept
 
bool IsFinite () const noexcept
 
bool IsInfinite () const noexcept
 
std::string ToString () const
 

Static Public Member Functions

static DerivedType Zero ()
 
static DerivedType One ()
 
static DerivedType UnitX ()
 
static DerivedType UnitY ()
 

Public Attributes

union { 
 
   ArrayType   values 
 
   struct { 
 
      value_type   x 
 
      value_type   y 
 
   }  
 
};  
 

Static Public Attributes

static constexpr size_type Size = 2
 

Detailed Description

template<class DerivedT, ArithmeticType T>
class Harlinn::Math::Tuple2< DerivedT, T >

A tuple holding two numbers.

Template Parameters
DerivedTA concrete type derived from this template.
TThe type of the values.

This implementation passes Tuple2 derived objects by reference, since passing the Tuple2 derived objects by value did not make a noticeable difference on the performance of pbrto. This is also true for Tuple3 derived objects. Passing Tuple4 derived by value degraded the performance of pbrto by approximately 5 %.

Member Typedef Documentation

◆ ArrayType

template<class DerivedT , ArithmeticType T>
using Harlinn::Math::Tuple2< DerivedT, T >::ArrayType = typename Traits::ArrayType

◆ const_iterator

template<class DerivedT , ArithmeticType T>
using Harlinn::Math::Tuple2< DerivedT, T >::const_iterator = typename ArrayType::const_iterator

◆ const_pointer

template<class DerivedT , ArithmeticType T>
using Harlinn::Math::Tuple2< DerivedT, T >::const_pointer = typename ArrayType::const_pointer

◆ const_reference

template<class DerivedT , ArithmeticType T>
using Harlinn::Math::Tuple2< DerivedT, T >::const_reference = typename ArrayType::const_reference

◆ const_reverse_iterator

template<class DerivedT , ArithmeticType T>
using Harlinn::Math::Tuple2< DerivedT, T >::const_reverse_iterator = typename ArrayType::const_reverse_iterator

◆ DerivedType

template<class DerivedT , ArithmeticType T>
using Harlinn::Math::Tuple2< DerivedT, T >::DerivedType = DerivedT

◆ iterator

template<class DerivedT , ArithmeticType T>
using Harlinn::Math::Tuple2< DerivedT, T >::iterator = typename ArrayType::iterator

◆ pointer

template<class DerivedT , ArithmeticType T>
using Harlinn::Math::Tuple2< DerivedT, T >::pointer = typename ArrayType::pointer

◆ reference

template<class DerivedT , ArithmeticType T>
using Harlinn::Math::Tuple2< DerivedT, T >::reference = typename ArrayType::reference

◆ reverse_iterator

template<class DerivedT , ArithmeticType T>
using Harlinn::Math::Tuple2< DerivedT, T >::reverse_iterator = typename ArrayType::reverse_iterator

◆ Simd

template<class DerivedT , ArithmeticType T>
using Harlinn::Math::Tuple2< DerivedT, T >::Simd = TupleSimd<DerivedType>

The mathematical operations are performed using this type which holds a SIMD vector.

◆ SIMDType

template<class DerivedT , ArithmeticType T>
using Harlinn::Math::Tuple2< DerivedT, T >::SIMDType = typename Traits::SIMDType

◆ size_type

template<class DerivedT , ArithmeticType T>
using Harlinn::Math::Tuple2< DerivedT, T >::size_type = size_t

◆ SizeType

template<class DerivedT , ArithmeticType T>
using Harlinn::Math::Tuple2< DerivedT, T >::SizeType = size_type

◆ Traits

template<class DerivedT , ArithmeticType T>
using Harlinn::Math::Tuple2< DerivedT, T >::Traits = SIMD::Traits<value_type, Size>

◆ value_type

template<class DerivedT , ArithmeticType T>
using Harlinn::Math::Tuple2< DerivedT, T >::value_type = T

◆ ValueType

template<class DerivedT , ArithmeticType T>
using Harlinn::Math::Tuple2< DerivedT, T >::ValueType = value_type

Constructor & Destructor Documentation

◆ Tuple2() [1/7]

template<class DerivedT , ArithmeticType T>
Harlinn::Math::Tuple2< DerivedT, T >::Tuple2 ( )
inlinenoexcept

◆ Tuple2() [2/7]

template<class DerivedT , ArithmeticType T>
Harlinn::Math::Tuple2< DerivedT, T >::Tuple2 ( value_type v)
inlineexplicitnoexcept

◆ Tuple2() [3/7]

template<class DerivedT , ArithmeticType T>
Harlinn::Math::Tuple2< DerivedT, T >::Tuple2 ( value_type xv,
value_type yv )
inlinenoexcept

◆ Tuple2() [4/7]

template<class DerivedT , ArithmeticType T>
Harlinn::Math::Tuple2< DerivedT, T >::Tuple2 ( const ArrayType a)
inlinenoexcept

◆ Tuple2() [5/7]

template<class DerivedT , ArithmeticType T>
template<SimdType U>
requires std::is_same_v<Traits, typename U::Traits>
Harlinn::Math::Tuple2< DerivedT, T >::Tuple2 ( const U & other)
inlinenoexcept

◆ Tuple2() [6/7]

template<class DerivedT , ArithmeticType T>
template<TupleType U>
requires std::is_same_v<Traits, typename U::Traits>
Harlinn::Math::Tuple2< DerivedT, T >::Tuple2 ( const U & other)
inlinenoexcept

◆ Tuple2() [7/7]

template<class DerivedT , ArithmeticType T>
template<TupleType U>
requires ( std::is_same_v<Traits, typename U::Traits> == false )
Harlinn::Math::Tuple2< DerivedT, T >::Tuple2 ( const U & other)
inlineexplicitnoexcept

Member Function Documentation

◆ Assign() [1/3]

template<class DerivedT , ArithmeticType T>
void Harlinn::Math::Tuple2< DerivedT, T >::Assign ( const ArrayType & src)
inlinenoexcept

◆ Assign() [2/3]

template<class DerivedT , ArithmeticType T>
void Harlinn::Math::Tuple2< DerivedT, T >::Assign ( SIMDType src)
inlinenoexcept

◆ Assign() [3/3]

template<class DerivedT , ArithmeticType T>
void Harlinn::Math::Tuple2< DerivedT, T >::Assign ( value_type xv,
value_type yv )
inlinenoexcept

◆ back() [1/2]

template<class DerivedT , ArithmeticType T>
const_reference Harlinn::Math::Tuple2< DerivedT, T >::back ( ) const
inlinenoexcept

◆ back() [2/2]

template<class DerivedT , ArithmeticType T>
reference Harlinn::Math::Tuple2< DerivedT, T >::back ( )
inlinenoexcept

◆ begin() [1/2]

template<class DerivedT , ArithmeticType T>
const_iterator Harlinn::Math::Tuple2< DerivedT, T >::begin ( ) const
inlinenoexcept

◆ begin() [2/2]

template<class DerivedT , ArithmeticType T>
iterator Harlinn::Math::Tuple2< DerivedT, T >::begin ( )
inlinenoexcept

◆ cbegin()

template<class DerivedT , ArithmeticType T>
const_iterator Harlinn::Math::Tuple2< DerivedT, T >::cbegin ( ) const
inlinenoexcept

◆ cend()

template<class DerivedT , ArithmeticType T>
const_iterator Harlinn::Math::Tuple2< DerivedT, T >::cend ( ) const
inlinenoexcept

◆ data() [1/2]

template<class DerivedT , ArithmeticType T>
const_pointer Harlinn::Math::Tuple2< DerivedT, T >::data ( ) const
inlinenoexcept

◆ data() [2/2]

template<class DerivedT , ArithmeticType T>
pointer Harlinn::Math::Tuple2< DerivedT, T >::data ( )
inlinenoexcept

◆ end() [1/2]

template<class DerivedT , ArithmeticType T>
const_iterator Harlinn::Math::Tuple2< DerivedT, T >::end ( ) const
inlinenoexcept

◆ end() [2/2]

template<class DerivedT , ArithmeticType T>
iterator Harlinn::Math::Tuple2< DerivedT, T >::end ( )
inlinenoexcept

◆ front() [1/2]

template<class DerivedT , ArithmeticType T>
const_reference Harlinn::Math::Tuple2< DerivedT, T >::front ( ) const
inlinenoexcept

◆ front() [2/2]

template<class DerivedT , ArithmeticType T>
reference Harlinn::Math::Tuple2< DerivedT, T >::front ( )
inlinenoexcept

◆ HasNaN()

template<class DerivedT , ArithmeticType T>
bool Harlinn::Math::Tuple2< DerivedT, T >::HasNaN ( ) const
inlinenoexcept

◆ IsFinite()

template<class DerivedT , ArithmeticType T>
bool Harlinn::Math::Tuple2< DerivedT, T >::IsFinite ( ) const
inlinenoexcept

◆ IsInfinite()

template<class DerivedT , ArithmeticType T>
bool Harlinn::Math::Tuple2< DerivedT, T >::IsInfinite ( ) const
inlinenoexcept

◆ One()

template<class DerivedT , ArithmeticType T>
static DerivedType Harlinn::Math::Tuple2< DerivedT, T >::One ( )
inlinestatic

◆ operator Simd()

template<class DerivedT , ArithmeticType T>
Harlinn::Math::Tuple2< DerivedT, T >::operator Simd ( ) const
inlinenoexcept

◆ operator!=() [1/3]

template<class DerivedT , ArithmeticType T>
template<TupleType U>
requires ( U::Size == Size )
bool Harlinn::Math::Tuple2< DerivedT, T >::operator!= ( const U & other) const
inlineconstexprnoexcept

◆ operator!=() [2/3]

template<class DerivedT , ArithmeticType T>
template<SimdType U>
requires std::is_same_v<Traits, typename U::Traits>
bool Harlinn::Math::Tuple2< DerivedT, T >::operator!= ( const U & other) const
inlinenoexcept

◆ operator!=() [3/3]

template<class DerivedT , ArithmeticType T>
bool Harlinn::Math::Tuple2< DerivedT, T >::operator!= ( value_type value) const
inlineconstexprnoexcept

◆ operator*=() [1/3]

template<class DerivedT , ArithmeticType T>
DerivedType & Harlinn::Math::Tuple2< DerivedT, T >::operator*= ( const Simd & other)
inlinenoexcept

◆ operator*=() [2/3]

template<class DerivedT , ArithmeticType T>
template<TupleType U>
requires ( U::Size == Size )
DerivedType & Harlinn::Math::Tuple2< DerivedT, T >::operator*= ( const U & other)
inlinenoexcept

◆ operator*=() [3/3]

template<class DerivedT , ArithmeticType T>
DerivedType & Harlinn::Math::Tuple2< DerivedT, T >::operator*= ( const value_type value)
inlinenoexcept

◆ operator+=() [1/3]

template<class DerivedT , ArithmeticType T>
DerivedType & Harlinn::Math::Tuple2< DerivedT, T >::operator+= ( const Simd & other)
inlinenoexcept

◆ operator+=() [2/3]

template<class DerivedT , ArithmeticType T>
template<TupleType U>
requires ( U::Size == Size )
DerivedType & Harlinn::Math::Tuple2< DerivedT, T >::operator+= ( const U & other)
inlinenoexcept

◆ operator+=() [3/3]

template<class DerivedT , ArithmeticType T>
DerivedType & Harlinn::Math::Tuple2< DerivedT, T >::operator+= ( const value_type value)
inlinenoexcept

◆ operator-()

template<class DerivedT , ArithmeticType T>
Simd Harlinn::Math::Tuple2< DerivedT, T >::operator- ( ) const
inlinenoexcept

◆ operator-=() [1/3]

template<class DerivedT , ArithmeticType T>
DerivedType & Harlinn::Math::Tuple2< DerivedT, T >::operator-= ( const Simd & other)
inlinenoexcept

◆ operator-=() [2/3]

template<class DerivedT , ArithmeticType T>
template<TupleType U>
requires ( U::Size == Size )
DerivedType & Harlinn::Math::Tuple2< DerivedT, T >::operator-= ( const U & other)
inlinenoexcept

◆ operator-=() [3/3]

template<class DerivedT , ArithmeticType T>
DerivedType & Harlinn::Math::Tuple2< DerivedT, T >::operator-= ( const value_type value)
inlinenoexcept

◆ operator/=() [1/3]

template<class DerivedT , ArithmeticType T>
DerivedType & Harlinn::Math::Tuple2< DerivedT, T >::operator/= ( const Simd & other)
inlinenoexcept

◆ operator/=() [2/3]

template<class DerivedT , ArithmeticType T>
template<TupleType U>
requires ( U::Size == Size )
DerivedType & Harlinn::Math::Tuple2< DerivedT, T >::operator/= ( const U & other)
inlinenoexcept

◆ operator/=() [3/3]

template<class DerivedT , ArithmeticType T>
DerivedType & Harlinn::Math::Tuple2< DerivedT, T >::operator/= ( const value_type value)
inlinenoexcept

◆ operator=()

template<class DerivedT , ArithmeticType T>
template<SimdType U>
requires std::is_same_v<Traits, typename U::Traits>
DerivedType & Harlinn::Math::Tuple2< DerivedT, T >::operator= ( const U & other)
inlinenoexcept

◆ operator==() [1/3]

template<class DerivedT , ArithmeticType T>
template<TupleType U>
requires ( U::Size == Size )
bool Harlinn::Math::Tuple2< DerivedT, T >::operator== ( const U & other) const
inlineconstexprnoexcept

◆ operator==() [2/3]

template<class DerivedT , ArithmeticType T>
template<SimdType U>
requires std::is_same_v<Traits, typename U::Traits>
bool Harlinn::Math::Tuple2< DerivedT, T >::operator== ( const U & other) const
inlinenoexcept

◆ operator==() [3/3]

template<class DerivedT , ArithmeticType T>
bool Harlinn::Math::Tuple2< DerivedT, T >::operator== ( value_type value) const
inlineconstexprnoexcept

◆ operator[]() [1/2]

template<class DerivedT , ArithmeticType T>
const_reference Harlinn::Math::Tuple2< DerivedT, T >::operator[] ( size_t index) const
inlinenoexcept

◆ operator[]() [2/2]

template<class DerivedT , ArithmeticType T>
reference Harlinn::Math::Tuple2< DerivedT, T >::operator[] ( size_t index)
inlinenoexcept

◆ rbegin() [1/2]

template<class DerivedT , ArithmeticType T>
const_reverse_iterator Harlinn::Math::Tuple2< DerivedT, T >::rbegin ( ) const
inlinenoexcept

◆ rbegin() [2/2]

template<class DerivedT , ArithmeticType T>
reverse_iterator Harlinn::Math::Tuple2< DerivedT, T >::rbegin ( )
inlinenoexcept

◆ rend() [1/2]

template<class DerivedT , ArithmeticType T>
const_reverse_iterator Harlinn::Math::Tuple2< DerivedT, T >::rend ( ) const
inlinenoexcept

◆ rend() [2/2]

template<class DerivedT , ArithmeticType T>
reverse_iterator Harlinn::Math::Tuple2< DerivedT, T >::rend ( )
inlinenoexcept

◆ size()

template<class DerivedT , ArithmeticType T>
size_t Harlinn::Math::Tuple2< DerivedT, T >::size ( ) const
inlineconstexprnoexcept

◆ ToSimd()

template<class DerivedT , ArithmeticType T>
Simd Harlinn::Math::Tuple2< DerivedT, T >::ToSimd ( ) const
inlinenoexcept

◆ ToString()

template<class DerivedT , ArithmeticType T>
std::string Harlinn::Math::Tuple2< DerivedT, T >::ToString ( ) const
inline

◆ UnitX()

template<class DerivedT , ArithmeticType T>
static DerivedType Harlinn::Math::Tuple2< DerivedT, T >::UnitX ( )
inlinestatic

◆ UnitY()

template<class DerivedT , ArithmeticType T>
static DerivedType Harlinn::Math::Tuple2< DerivedT, T >::UnitY ( )
inlinestatic

◆ Zero()

template<class DerivedT , ArithmeticType T>
static DerivedType Harlinn::Math::Tuple2< DerivedT, T >::Zero ( )
inlinestatic

Member Data Documentation

◆ [union]

union { ... } Harlinn::Math::Tuple2< DerivedT, T >

◆ Size

template<class DerivedT , ArithmeticType T>
size_type Harlinn::Math::Tuple2< DerivedT, T >::Size = 2
staticconstexpr

◆ values

template<class DerivedT , ArithmeticType T>
ArrayType Harlinn::Math::Tuple2< DerivedT, T >::values

◆ x

template<class DerivedT , ArithmeticType T>
value_type Harlinn::Math::Tuple2< DerivedT, T >::x

◆ y

template<class DerivedT , ArithmeticType T>
value_type Harlinn::Math::Tuple2< DerivedT, T >::y

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