Air-Trap 1.0.0
A multiplayer R-Type clone game engine built with C++23 and ECS architecture
Loading...
Searching...
No Matches
rtp::Vec4< T > Struct Template Reference

A 4-dimensional vector. More...

#include <Vec4.hpp>

Inheritance diagram for rtp::Vec4< T >:
Collaboration diagram for rtp::Vec4< T >:

Public Member Functions

constexpr Vec4 (void)=default
 Default constructor.
 
constexpr Vec4 (T x, T y, T z, T w) noexcept
 Parameterized constructor.
 
constexpr ~Vec4 ()=default
 Default destructor.
 
constexpr bool operator== (const Vec4 &) const noexcept=default
 Checks if two vectors are exactly equal.
 
constexpr auto & operator[] (this auto &self, size_t index) noexcept
 Accesses the coordinate at the specified index.
 
- Public Member Functions inherited from rtp::details::VecBase< T, 4 >
constexpr auto squaredDistance (this const Self &self, const std::remove_cvref_t< Self > &other) noexcept -> T
 
constexpr auto distance (this const Self &self, const std::remove_cvref_t< Self > &other) noexcept -> RealT
 
constexpr auto squaredLength (this const Self &self) noexcept -> T
 
constexpr auto length (this const Self &self) noexcept -> RealT
 
constexpr auto normalize (this Self &self) noexcept -> Self &
 
constexpr auto normalized (this const Self &self) noexcept -> std::remove_cvref_t< Self >
 
constexpr auto dot (this const Self &self, const std::remove_cvref_t< Self > &other) noexcept -> T
 
constexpr auto project (this const Self &self, const std::remove_cvref_t< Self > &other) noexcept -> std::remove_cvref_t< Self >
 
constexpr auto & operator+= (this Self &self, const std::remove_cvref_t< Self > &other) noexcept
 
constexpr auto & operator+= (this Self &self, T scalar) noexcept
 
constexpr auto & operator-= (this Self &self, const std::remove_cvref_t< Self > &other) noexcept
 
constexpr auto & operator-= (this Self &self, T scalar) noexcept
 
constexpr auto & operator*= (this Self &self, const std::remove_cvref_t< Self > &other) noexcept
 
constexpr auto & operator*= (this Self &self, T scalar) noexcept
 
constexpr auto & operator/= (this Self &self, const std::remove_cvref_t< Self > &other) noexcept
 
constexpr auto & operator/= (this Self &self, T scalar) noexcept
 

Public Attributes

x {}
 X coordinate.
 
y {}
 Y coordinate.
 
z {}
 Z coordinate.
 
w {}
 W coordinate.
 

Additional Inherited Members

- Public Types inherited from rtp::details::VecBase< T, 4 >
using RealT = std::conditional_t< std::is_integral_v< T >, double, T >
 

Detailed Description

template<Numeric T>
struct rtp::Vec4< T >

A 4-dimensional vector.

Template Parameters
TMust be an integral or floating-point type.

Definition at line 53 of file Vec4.hpp.

Constructor & Destructor Documentation

◆ Vec4() [1/2]

template<Numeric T>
constexpr rtp::Vec4< T >::Vec4 ( void  )
constexprdefault

Default constructor.

Initializes to (0, 0, 0, 0).

◆ Vec4() [2/2]

template<Numeric T>
constexpr rtp::Vec4< T >::Vec4 ( x,
y,
z,
w 
)
constexprnoexcept

Parameterized constructor.

◆ ~Vec4()

template<Numeric T>
constexpr rtp::Vec4< T >::~Vec4 ( )
constexprdefault

Default destructor.

Member Function Documentation

◆ operator==()

template<Numeric T>
constexpr bool rtp::Vec4< T >::operator== ( const Vec4< T > &  ) const
constexprdefaultnoexcept

Checks if two vectors are exactly equal.

◆ operator[]()

template<Numeric T>
constexpr auto & rtp::Vec4< T >::operator[] ( this auto &  self,
size_t  index 
)
constexprnoexcept

Accesses the coordinate at the specified index.

Parameters
indexThe index (0 for x, 1 for y, 2 for z, 3 for w).
Returns
Reference to the coordinate.

Member Data Documentation

◆ w

template<Numeric T>
T rtp::Vec4< T >::w {}

W coordinate.

Definition at line 57 of file Vec4.hpp.

◆ x

template<Numeric T>
T rtp::Vec4< T >::x {}

X coordinate.

Definition at line 54 of file Vec4.hpp.

◆ y

template<Numeric T>
T rtp::Vec4< T >::y {}

Y coordinate.

Definition at line 55 of file Vec4.hpp.

◆ z

template<Numeric T>
T rtp::Vec4< T >::z {}

Z coordinate.

Definition at line 56 of file Vec4.hpp.


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