Direct-BT v3.3.0-1-gc2d430c
Direct-BT - Direct Bluetooth Programming.
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | List of all members
jau::math::Vector2I< Value_type, > Struct Template Reference

2D vector using two integer components. More...

#include <vec2i.hpp>

Collaboration diagram for jau::math::Vector2I< Value_type, >:

Public Types

typedef const value_typeconst_iterator
 
typedef const value_typeconst_pointer
 
typedef const value_typeconst_reference
 
typedef jau::float_bytes< sizeof(value_type)>::type float_type
 
typedef value_typeiterator
 
typedef value_typepointer
 
typedef value_typereference
 
typedef Value_type value_type
 

Public Member Functions

constexpr Vector2I () noexcept
 
constexpr Vector2I (const value_type v) noexcept
 
constexpr Vector2I (const value_type x_, const value_type y_) noexcept
 
constexpr Vector2I (const Vector2I &o) noexcept=default
 
constexpr Vector2I (Vector2I &&o) noexcept=default
 
constexpr Vector2Iadd (const value_type dx, const value_type dy) noexcept
 this = this + {sx, sy}, returns this. More...
 
constexpr iterator begin () noexcept
 
constexpr const_iterator cbegin () const noexcept
 
constexpr iterator get (iterator xy) const noexcept
 xy = this, returns xy. More...
 
bool intersects (const Vector2I &o)
 
constexpr bool is_zero () const noexcept
 
constexpr value_type length () const noexcept
 Return the length of this vector, a.k.a the norm or magnitude More...
 
constexpr value_type length_sq () const noexcept
 Return the squared length of this vector, a.k.a the squared norm or squared magnitude More...
 
constexpr Vector2Imul (const value_type sx, const value_type sy) noexcept
 this = this * {sx, sy}, returns this. More...
 
constexpr Vector2Inormalize () noexcept
 Normalize this vector in place, returns *this. More...
 
 operator const_pointer () const noexcept
 
 operator pointer () noexcept
 
constexpr Vector2Ioperator*= (const value_type s) noexcept
 Scale this vector with given scale factor. More...
 
constexpr Vector2Ioperator+= (const Vector2I &rhs) noexcept
 this = this + rhs, returns this. More...
 
constexpr Vector2Ioperator-= (const Vector2I &rhs) noexcept
 this = this - rhs, returns this. More...
 
constexpr Vector2Ioperator/= (const value_type s) noexcept
 Divide this vector with given scale factor. More...
 
constexpr Vector2Ioperator= (const Vector2I &) noexcept=default
 
constexpr Vector2Ioperator= (Vector2I &&) noexcept=default
 
constexpr bool operator== (const Vector2I &rhs) const noexcept
 
constexpr value_type operator[] (size_t i) const noexcept
 Returns read-only component. More...
 
constexpr reference operator[] (size_t i) noexcept
 Returns writeable reference to component. More...
 
constexpr_cxx26 void rotate (const float_type radians, const Vector2I &ctr)
 
void rotate (const float_type sin, const float_type cos, const Vector2I &ctr)
 
constexpr Vector2Iscale (const value_type s) noexcept
 this = this * s, returns this. More...
 
constexpr Vector2Iset (const value_type vx, const value_type vy) noexcept
 TODO constexpr bool operator<=>(const vec2i_t& rhs ) const noexcept { return ... }. More...
 
constexpr Vector2Iset (const_iterator xy) noexcept
 this = xy, returns this. More...
 
std::string toString () const noexcept
 

Public Attributes

value_type x
 
value_type y
 

Static Public Attributes

static constexpr const size_t byte_size = components * sizeof(value_type)
 Size in bytes (aligned) More...
 
static constexpr const size_t components = 2
 Number of components
More...
 
static constexpr const value_type one = value_type(1)
 
static constexpr const value_type zero = value_type(0)
 

Detailed Description

template<typename Value_type, std::enable_if_t< std::is_integral_v< Value_type >, bool > = true>
struct jau::math::Vector2I< Value_type, >

2D vector using two integer components.

Definition at line 49 of file vec2i.hpp.

Member Typedef Documentation

◆ value_type

template<typename Value_type , std::enable_if_t< std::is_integral_v< Value_type >, bool > = true>
typedef Value_type jau::math::Vector2I< Value_type, >::value_type

Definition at line 50 of file vec2i.hpp.

◆ pointer

template<typename Value_type , std::enable_if_t< std::is_integral_v< Value_type >, bool > = true>
typedef value_type* jau::math::Vector2I< Value_type, >::pointer

Definition at line 51 of file vec2i.hpp.

◆ const_pointer

template<typename Value_type , std::enable_if_t< std::is_integral_v< Value_type >, bool > = true>
typedef const value_type* jau::math::Vector2I< Value_type, >::const_pointer

Definition at line 52 of file vec2i.hpp.

◆ reference

template<typename Value_type , std::enable_if_t< std::is_integral_v< Value_type >, bool > = true>
typedef value_type& jau::math::Vector2I< Value_type, >::reference

Definition at line 53 of file vec2i.hpp.

◆ const_reference

template<typename Value_type , std::enable_if_t< std::is_integral_v< Value_type >, bool > = true>
typedef const value_type& jau::math::Vector2I< Value_type, >::const_reference

Definition at line 54 of file vec2i.hpp.

◆ iterator

template<typename Value_type , std::enable_if_t< std::is_integral_v< Value_type >, bool > = true>
typedef value_type* jau::math::Vector2I< Value_type, >::iterator

Definition at line 55 of file vec2i.hpp.

◆ const_iterator

template<typename Value_type , std::enable_if_t< std::is_integral_v< Value_type >, bool > = true>
typedef const value_type* jau::math::Vector2I< Value_type, >::const_iterator

Definition at line 56 of file vec2i.hpp.

◆ float_type

template<typename Value_type , std::enable_if_t< std::is_integral_v< Value_type >, bool > = true>
typedef jau::float_bytes<sizeof(value_type)>::type jau::math::Vector2I< Value_type, >::float_type

Definition at line 58 of file vec2i.hpp.

Constructor & Destructor Documentation

◆ Vector2I() [1/5]

template<typename Value_type , std::enable_if_t< std::is_integral_v< Value_type >, bool > = true>
constexpr jau::math::Vector2I< Value_type, >::Vector2I ( )
inlineconstexprnoexcept

Definition at line 72 of file vec2i.hpp.

◆ Vector2I() [2/5]

template<typename Value_type , std::enable_if_t< std::is_integral_v< Value_type >, bool > = true>
constexpr jau::math::Vector2I< Value_type, >::Vector2I ( const value_type  v)
inlineconstexprnoexcept

Definition at line 75 of file vec2i.hpp.

◆ Vector2I() [3/5]

template<typename Value_type , std::enable_if_t< std::is_integral_v< Value_type >, bool > = true>
constexpr jau::math::Vector2I< Value_type, >::Vector2I ( const value_type  x_,
const value_type  y_ 
)
inlineconstexprnoexcept

Definition at line 78 of file vec2i.hpp.

◆ Vector2I() [4/5]

template<typename Value_type , std::enable_if_t< std::is_integral_v< Value_type >, bool > = true>
constexpr jau::math::Vector2I< Value_type, >::Vector2I ( const Vector2I< Value_type, > &  o)
constexprdefaultnoexcept

◆ Vector2I() [5/5]

template<typename Value_type , std::enable_if_t< std::is_integral_v< Value_type >, bool > = true>
constexpr jau::math::Vector2I< Value_type, >::Vector2I ( Vector2I< Value_type, > &&  o)
constexprdefaultnoexcept

Member Function Documentation

◆ operator=() [1/2]

template<typename Value_type , std::enable_if_t< std::is_integral_v< Value_type >, bool > = true>
constexpr Vector2I & jau::math::Vector2I< Value_type, >::operator= ( const Vector2I< Value_type, > &  )
constexprdefaultnoexcept

◆ operator=() [2/2]

template<typename Value_type , std::enable_if_t< std::is_integral_v< Value_type >, bool > = true>
constexpr Vector2I & jau::math::Vector2I< Value_type, >::operator= ( Vector2I< Value_type, > &&  )
constexprdefaultnoexcept

◆ operator[]() [1/2]

template<typename Value_type , std::enable_if_t< std::is_integral_v< Value_type >, bool > = true>
constexpr value_type jau::math::Vector2I< Value_type, >::operator[] ( size_t  i) const
inlineconstexprnoexcept

Returns read-only component.

Definition at line 87 of file vec2i.hpp.

◆ operator const_pointer()

template<typename Value_type , std::enable_if_t< std::is_integral_v< Value_type >, bool > = true>
jau::math::Vector2I< Value_type, >::operator const_pointer ( ) const
inlineexplicitnoexcept

Definition at line 92 of file vec2i.hpp.

◆ cbegin()

template<typename Value_type , std::enable_if_t< std::is_integral_v< Value_type >, bool > = true>
constexpr const_iterator jau::math::Vector2I< Value_type, >::cbegin ( ) const
inlineconstexprnoexcept

Definition at line 93 of file vec2i.hpp.

◆ operator[]() [2/2]

template<typename Value_type , std::enable_if_t< std::is_integral_v< Value_type >, bool > = true>
constexpr reference jau::math::Vector2I< Value_type, >::operator[] ( size_t  i)
inlineconstexprnoexcept

Returns writeable reference to component.

Definition at line 96 of file vec2i.hpp.

◆ operator pointer()

template<typename Value_type , std::enable_if_t< std::is_integral_v< Value_type >, bool > = true>
jau::math::Vector2I< Value_type, >::operator pointer ( )
inlineexplicitnoexcept

Definition at line 101 of file vec2i.hpp.

◆ begin()

template<typename Value_type , std::enable_if_t< std::is_integral_v< Value_type >, bool > = true>
constexpr iterator jau::math::Vector2I< Value_type, >::begin ( )
inlineconstexprnoexcept

Definition at line 102 of file vec2i.hpp.

◆ get()

template<typename Value_type , std::enable_if_t< std::is_integral_v< Value_type >, bool > = true>
constexpr iterator jau::math::Vector2I< Value_type, >::get ( iterator  xy) const
inlineconstexprnoexcept

xy = this, returns xy.

Definition at line 105 of file vec2i.hpp.

◆ operator==()

template<typename Value_type , std::enable_if_t< std::is_integral_v< Value_type >, bool > = true>
constexpr bool jau::math::Vector2I< Value_type, >::operator== ( const Vector2I< Value_type, > &  rhs) const
inlineconstexprnoexcept

Definition at line 111 of file vec2i.hpp.

◆ set() [1/2]

template<typename Value_type , std::enable_if_t< std::is_integral_v< Value_type >, bool > = true>
constexpr Vector2I & jau::math::Vector2I< Value_type, >::set ( const value_type  vx,
const value_type  vy 
)
inlineconstexprnoexcept

TODO constexpr bool operator<=>(const vec2i_t& rhs ) const noexcept { return ... }.

Definition at line 122 of file vec2i.hpp.

◆ set() [2/2]

template<typename Value_type , std::enable_if_t< std::is_integral_v< Value_type >, bool > = true>
constexpr Vector2I & jau::math::Vector2I< Value_type, >::set ( const_iterator  xy)
inlineconstexprnoexcept

this = xy, returns this.

Definition at line 126 of file vec2i.hpp.

◆ add()

template<typename Value_type , std::enable_if_t< std::is_integral_v< Value_type >, bool > = true>
constexpr Vector2I & jau::math::Vector2I< Value_type, >::add ( const value_type  dx,
const value_type  dy 
)
inlineconstexprnoexcept

this = this + {sx, sy}, returns this.

Definition at line 130 of file vec2i.hpp.

◆ mul()

template<typename Value_type , std::enable_if_t< std::is_integral_v< Value_type >, bool > = true>
constexpr Vector2I & jau::math::Vector2I< Value_type, >::mul ( const value_type  sx,
const value_type  sy 
)
inlineconstexprnoexcept

this = this * {sx, sy}, returns this.

Definition at line 134 of file vec2i.hpp.

◆ scale()

template<typename Value_type , std::enable_if_t< std::is_integral_v< Value_type >, bool > = true>
constexpr Vector2I & jau::math::Vector2I< Value_type, >::scale ( const value_type  s)
inlineconstexprnoexcept

this = this * s, returns this.

Definition at line 138 of file vec2i.hpp.

◆ operator+=()

template<typename Value_type , std::enable_if_t< std::is_integral_v< Value_type >, bool > = true>
constexpr Vector2I & jau::math::Vector2I< Value_type, >::operator+= ( const Vector2I< Value_type, > &  rhs)
inlineconstexprnoexcept

this = this + rhs, returns this.

Definition at line 142 of file vec2i.hpp.

◆ operator-=()

template<typename Value_type , std::enable_if_t< std::is_integral_v< Value_type >, bool > = true>
constexpr Vector2I & jau::math::Vector2I< Value_type, >::operator-= ( const Vector2I< Value_type, > &  rhs)
inlineconstexprnoexcept

this = this - rhs, returns this.

Definition at line 148 of file vec2i.hpp.

◆ operator*=()

template<typename Value_type , std::enable_if_t< std::is_integral_v< Value_type >, bool > = true>
constexpr Vector2I & jau::math::Vector2I< Value_type, >::operator*= ( const value_type  s)
inlineconstexprnoexcept

Scale this vector with given scale factor.

Parameters
sscale factor
Returns
this instance

Definition at line 158 of file vec2i.hpp.

◆ operator/=()

template<typename Value_type , std::enable_if_t< std::is_integral_v< Value_type >, bool > = true>
constexpr Vector2I & jau::math::Vector2I< Value_type, >::operator/= ( const value_type  s)
inlineconstexprnoexcept

Divide this vector with given scale factor.

Parameters
sscale factor
Returns
this instance

Definition at line 168 of file vec2i.hpp.

◆ rotate() [1/2]

template<typename Value_type , std::enable_if_t< std::is_integral_v< Value_type >, bool > = true>
constexpr_cxx26 void jau::math::Vector2I< Value_type, >::rotate ( const float_type  radians,
const Vector2I< Value_type, > &  ctr 
)
inline

Definition at line 173 of file vec2i.hpp.

◆ rotate() [2/2]

template<typename Value_type , std::enable_if_t< std::is_integral_v< Value_type >, bool > = true>
void jau::math::Vector2I< Value_type, >::rotate ( const float_type  sin,
const float_type  cos,
const Vector2I< Value_type, > &  ctr 
)
inline

Definition at line 178 of file vec2i.hpp.

◆ toString()

template<typename Value_type , std::enable_if_t< std::is_integral_v< Value_type >, bool > = true>
std::string jau::math::Vector2I< Value_type, >::toString ( ) const
inlinenoexcept

Definition at line 186 of file vec2i.hpp.

◆ is_zero()

template<typename Value_type , std::enable_if_t< std::is_integral_v< Value_type >, bool > = true>
constexpr bool jau::math::Vector2I< Value_type, >::is_zero ( ) const
inlineconstexprnoexcept

Definition at line 188 of file vec2i.hpp.

◆ length_sq()

template<typename Value_type , std::enable_if_t< std::is_integral_v< Value_type >, bool > = true>
constexpr value_type jau::math::Vector2I< Value_type, >::length_sq ( ) const
inlineconstexprnoexcept

Return the squared length of this vector, a.k.a the squared norm or squared magnitude

Definition at line 195 of file vec2i.hpp.

◆ length()

template<typename Value_type , std::enable_if_t< std::is_integral_v< Value_type >, bool > = true>
constexpr value_type jau::math::Vector2I< Value_type, >::length ( ) const
inlineconstexprnoexcept

Return the length of this vector, a.k.a the norm or magnitude

Definition at line 202 of file vec2i.hpp.

◆ normalize()

template<typename Value_type , std::enable_if_t< std::is_integral_v< Value_type >, bool > = true>
constexpr Vector2I & jau::math::Vector2I< Value_type, >::normalize ( )
inlineconstexprnoexcept

Normalize this vector in place, returns *this.

Definition at line 208 of file vec2i.hpp.

◆ intersects()

template<typename Value_type , std::enable_if_t< std::is_integral_v< Value_type >, bool > = true>
bool jau::math::Vector2I< Value_type, >::intersects ( const Vector2I< Value_type, > &  o)
inline

Definition at line 222 of file vec2i.hpp.

Member Data Documentation

◆ zero

template<typename Value_type , std::enable_if_t< std::is_integral_v< Value_type >, bool > = true>
constexpr const value_type jau::math::Vector2I< Value_type, >::zero = value_type(0)
staticconstexpr

Definition at line 60 of file vec2i.hpp.

◆ one

template<typename Value_type , std::enable_if_t< std::is_integral_v< Value_type >, bool > = true>
constexpr const value_type jau::math::Vector2I< Value_type, >::one = value_type(1)
staticconstexpr

Definition at line 61 of file vec2i.hpp.

◆ components

template<typename Value_type , std::enable_if_t< std::is_integral_v< Value_type >, bool > = true>
constexpr const size_t jau::math::Vector2I< Value_type, >::components = 2
staticconstexpr

Number of components

Definition at line 64 of file vec2i.hpp.

◆ byte_size

template<typename Value_type , std::enable_if_t< std::is_integral_v< Value_type >, bool > = true>
constexpr const size_t jau::math::Vector2I< Value_type, >::byte_size = components * sizeof(value_type)
staticconstexpr

Size in bytes (aligned)

Definition at line 67 of file vec2i.hpp.

◆ x

template<typename Value_type , std::enable_if_t< std::is_integral_v< Value_type >, bool > = true>
value_type jau::math::Vector2I< Value_type, >::x

Definition at line 69 of file vec2i.hpp.

◆ y

template<typename Value_type , std::enable_if_t< std::is_integral_v< Value_type >, bool > = true>
value_type jau::math::Vector2I< Value_type, >::y

Definition at line 70 of file vec2i.hpp.


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