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

A 2-dimensional vector. More...

#include <Vec2.hpp>

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

Public Member Functions

constexpr Vec2 (void)=default
 Default constructor.
 
constexpr Vec2 (T x, T y) noexcept
 Parameterized constructor.
 
constexpr ~Vec2 ()=default
 Default destructor.
 
constexpr bool operator== (const Vec2 &) 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, 2 >
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 {}
 
y {}
 

Additional Inherited Members

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

Detailed Description

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

A 2-dimensional vector.

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

Definition at line 53 of file Vec2.hpp.

Constructor & Destructor Documentation

◆ Vec2() [1/2]

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

Default constructor.

Initializes to (0, 0).

◆ Vec2() [2/2]

template<Numeric T>
constexpr rtp::Vec2< T >::Vec2 ( x,
y 
)
constexprnoexcept

Parameterized constructor.

◆ ~Vec2()

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

Default destructor.

Member Function Documentation

◆ operator==()

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

Checks if two vectors are exactly equal.

◆ operator[]()

template<Numeric T>
constexpr auto & rtp::Vec2< 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).
Returns
Reference to the coordinate.

Member Data Documentation

◆ x

◆ y


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