jaulib v1.3.0
Jau Support Library (C++, Java, ..)
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | List of all members
jau::math::Vector4F< Value_type, > Class Template Reference

4D vector using four value_type components. More...

#include <vec4f.hpp>

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

Public Types

typedef const value_typeconst_iterator
 
typedef const value_typeconst_pointer
 
typedef const value_typeconst_reference
 
typedef value_typeiterator
 
typedef value_typepointer
 
typedef value_typereference
 
typedef Value_type value_type
 
typedef Vector3F< value_type, std::is_floating_point_v< Value_type > > Vec3
 

Public Member Functions

constexpr Vector4F () noexcept
 
constexpr Vector4F (const value_type v) noexcept
 
constexpr Vector4F (const value_type x_, const value_type y_, const value_type z_, const value_type w_) noexcept
 
constexpr Vector4F (const Vec3 &o3, const value_type w_) noexcept
 
constexpr Vector4F (const Vector4F &o) noexcept=default
 
constexpr Vector4F (const_iterator v) noexcept
 
constexpr Vector4F (std::initializer_list< value_type > v) noexcept
 
constexpr Vector4F (Vector4F &&o) noexcept=default
 
constexpr Vector4Fadd (const value_type dx, const value_type dy, const value_type dz, const value_type dw) noexcept
 this = this + {dx, dy, dz, dw}, returns this. More...
 
constexpr iterator begin () noexcept
 
constexpr const_iterator cbegin () const noexcept
 
constexpr value_type dist (const Vector4F &o) const noexcept
 Return the distance between this vector and the given one. More...
 
constexpr value_type dist_sq (const Vector4F &o) const noexcept
 Return the squared distance between this vector and the given one. More...
 
constexpr iterator get (iterator xyzw) const noexcept
 xyzw = this, returns xyzw. More...
 
constexpr Vec3getVec3 (Vec3 &out) const noexcept
 out = { this.x, this.y, this.z } dropping w, returns out. More...
 
constexpr_cxx23 bool intersects (const Vector4F &o) const noexcept
 
constexpr bool is_zero () const noexcept
 
constexpr value_type length () const noexcept
 Return the length of a vector, a.k.a the norm or magnitude More...
 
constexpr value_type length_sq () const noexcept
 Return the squared length of a vector, a.k.a the squared norm or squared magnitude More...
 
constexpr Vector4Fmul (const value_type sx, const value_type sy, const value_type sz, const value_type sw) noexcept
 this = this * {sx, sy, sz, sw}, returns this. More...
 
constexpr Vector4Fnormalize () noexcept
 Normalize this vector in place. More...
 
 operator const_pointer () const noexcept
 
 operator pointer () noexcept
 
constexpr Vector4Foperator*= (const value_type s) noexcept
 Scale this vector with given scale factor. More...
 
constexpr Vector4Foperator+= (const Vector4F &rhs) noexcept
 this = this + rhs, returns this. More...
 
constexpr Vector4Foperator-= (const Vector4F &rhs) noexcept
 this = this - rhs, returns this. More...
 
constexpr Vector4Foperator/= (const value_type s) noexcept
 Divide this vector with given scale factor. More...
 
constexpr Vector4Foperator= (const Vector4F &) noexcept=default
 
constexpr Vector4Foperator= (Vector4F &&) noexcept=default
 
constexpr bool operator== (const Vector4F &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 Vector4Fscale (const value_type s) noexcept
 this = this * s, returns this. More...
 
constexpr Vector4Fset (const value_type vx, const value_type vy, const value_type vz, const value_type vw) noexcept
 
constexpr Vector4Fset (const Vec3f &o, const value_type w_) noexcept
 TODO constexpr bool operator<=>(const vec4f_t& rhs ) const noexcept { return ... }. More...
 
constexpr Vector4Fset (const_iterator xyzw) noexcept
 this = xyzw, returns this. More...
 
std::string toString () const noexcept
 

Public Attributes

value_type w
 
value_type x
 
value_type y
 
value_type z
 

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 = 4
 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_floating_point_v< Value_type >, bool > = true>
class jau::math::Vector4F< Value_type, >

4D vector using four value_type components.

Definition at line 51 of file vec4f.hpp.

Member Typedef Documentation

◆ value_type

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

Definition at line 53 of file vec4f.hpp.

◆ pointer

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

Definition at line 54 of file vec4f.hpp.

◆ const_pointer

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

Definition at line 55 of file vec4f.hpp.

◆ reference

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

Definition at line 56 of file vec4f.hpp.

◆ const_reference

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

Definition at line 57 of file vec4f.hpp.

◆ iterator

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

Definition at line 58 of file vec4f.hpp.

◆ const_iterator

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

Definition at line 59 of file vec4f.hpp.

◆ Vec3

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
typedef Vector3F<value_type, std::is_floating_point_v<Value_type> > jau::math::Vector4F< Value_type, >::Vec3

Definition at line 61 of file vec4f.hpp.

Constructor & Destructor Documentation

◆ Vector4F() [1/8]

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

Definition at line 77 of file vec4f.hpp.

◆ Vector4F() [2/8]

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

Definition at line 80 of file vec4f.hpp.

◆ Vector4F() [3/8]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr jau::math::Vector4F< Value_type, >::Vector4F ( const value_type  x_,
const value_type  y_,
const value_type  z_,
const value_type  w_ 
)
inlineconstexprnoexcept

Definition at line 83 of file vec4f.hpp.

◆ Vector4F() [4/8]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr jau::math::Vector4F< Value_type, >::Vector4F ( const Vec3 o3,
const value_type  w_ 
)
inlineconstexprnoexcept

Definition at line 86 of file vec4f.hpp.

◆ Vector4F() [5/8]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr jau::math::Vector4F< Value_type, >::Vector4F ( const_iterator  v)
inlineconstexprnoexcept

Definition at line 89 of file vec4f.hpp.

◆ Vector4F() [6/8]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr jau::math::Vector4F< Value_type, >::Vector4F ( std::initializer_list< value_type v)
inlineconstexprnoexcept

Definition at line 92 of file vec4f.hpp.

◆ Vector4F() [7/8]

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

◆ Vector4F() [8/8]

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

Member Function Documentation

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ operator[]() [1/2]

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

Returns read-only component.

Definition at line 101 of file vec4f.hpp.

◆ operator const_pointer()

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

Definition at line 106 of file vec4f.hpp.

◆ cbegin()

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

Definition at line 107 of file vec4f.hpp.

◆ operator[]() [2/2]

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

Returns writeable reference to component.

Definition at line 110 of file vec4f.hpp.

◆ operator pointer()

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

Definition at line 115 of file vec4f.hpp.

◆ begin()

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

Definition at line 116 of file vec4f.hpp.

◆ get()

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr iterator jau::math::Vector4F< Value_type, >::get ( iterator  xyzw) const
inlineconstexprnoexcept

xyzw = this, returns xyzw.

Definition at line 119 of file vec4f.hpp.

◆ getVec3()

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr Vec3 & jau::math::Vector4F< Value_type, >::getVec3 ( Vec3 out) const
inlineconstexprnoexcept

out = { this.x, this.y, this.z } dropping w, returns out.

Definition at line 128 of file vec4f.hpp.

Here is the caller graph for this function:

◆ operator==()

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

Definition at line 135 of file vec4f.hpp.

◆ set() [1/3]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr Vector4F & jau::math::Vector4F< Value_type, >::set ( const Vec3f o,
const value_type  w_ 
)
inlineconstexprnoexcept

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

this = { o, w }, returns this.

Definition at line 148 of file vec4f.hpp.

Here is the caller graph for this function:

◆ set() [2/3]

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

Definition at line 151 of file vec4f.hpp.

◆ set() [3/3]

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr Vector4F & jau::math::Vector4F< Value_type, >::set ( const_iterator  xyzw)
inlineconstexprnoexcept

this = xyzw, returns this.

Definition at line 155 of file vec4f.hpp.

◆ add()

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

this = this + {dx, dy, dz, dw}, returns this.

Definition at line 159 of file vec4f.hpp.

Here is the caller graph for this function:

◆ mul()

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

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

Definition at line 163 of file vec4f.hpp.

Here is the caller graph for this function:

◆ scale()

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

this = this * s, returns this.

Definition at line 167 of file vec4f.hpp.

Here is the caller graph for this function:

◆ operator+=()

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

this = this + rhs, returns this.

Definition at line 171 of file vec4f.hpp.

◆ operator-=()

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

this = this - rhs, returns this.

Definition at line 177 of file vec4f.hpp.

◆ operator*=()

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

Scale this vector with given scale factor.

Parameters
sscale factor
Returns
this instance

Definition at line 187 of file vec4f.hpp.

◆ operator/=()

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

Divide this vector with given scale factor.

Parameters
sscale factor
Returns
this instance

Definition at line 197 of file vec4f.hpp.

◆ toString()

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

Definition at line 202 of file vec4f.hpp.

◆ is_zero()

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

Definition at line 204 of file vec4f.hpp.

◆ length_sq()

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

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

Definition at line 211 of file vec4f.hpp.

◆ length()

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

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

Definition at line 218 of file vec4f.hpp.

◆ normalize()

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

Normalize this vector in place.

Definition at line 225 of file vec4f.hpp.

◆ dist_sq()

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr value_type jau::math::Vector4F< Value_type, >::dist_sq ( const Vector4F< Value_type, > &  o) const
inlineconstexprnoexcept

Return the squared distance between this vector and the given one.

When comparing the relative distance between two points it is usually sufficient to compare the squared distances, thus avoiding an expensive square root operation.

Definition at line 249 of file vec4f.hpp.

◆ dist()

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr value_type jau::math::Vector4F< Value_type, >::dist ( const Vector4F< Value_type, > &  o) const
inlineconstexprnoexcept

Return the distance between this vector and the given one.

Definition at line 260 of file vec4f.hpp.

◆ intersects()

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr_cxx23 bool jau::math::Vector4F< Value_type, >::intersects ( const Vector4F< Value_type, > &  o) const
inlinenoexcept

Definition at line 264 of file vec4f.hpp.

Member Data Documentation

◆ zero

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

Definition at line 63 of file vec4f.hpp.

◆ one

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

Definition at line 64 of file vec4f.hpp.

◆ components

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
constexpr const size_t jau::math::Vector4F< Value_type, >::components = 4
staticconstexpr

Number of components

Definition at line 67 of file vec4f.hpp.

◆ byte_size

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

Size in bytes (aligned)

Definition at line 70 of file vec4f.hpp.

◆ x

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

Definition at line 72 of file vec4f.hpp.

◆ y

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

Definition at line 73 of file vec4f.hpp.

◆ z

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
value_type jau::math::Vector4F< Value_type, >::z

Definition at line 74 of file vec4f.hpp.

◆ w

template<typename Value_type , std::enable_if_t< std::is_floating_point_v< Value_type >, bool > = true>
value_type jau::math::Vector4F< Value_type, >::w

Definition at line 75 of file vec4f.hpp.


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