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

A 3-dimensional vector. More...

#include <Vec3.hpp>

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

Public Member Functions

constexpr Vec3 (void)=default
 Default constructor.
 
constexpr Vec3 (T x, T y, T z) noexcept
 Parameterized constructor.
 
constexpr ~Vec3 ()=default
 Default destructor.
 
constexpr bool operator== (const Vec3 &) 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.
 
constexpr auto cross (const Vec3 &other) const noexcept -> Vec3
 The cross product of two 3D vectors.
 
- Public Member Functions inherited from rtp::details::VecBase< T, 3 >
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.
 

Additional Inherited Members

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

Detailed Description

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

A 3-dimensional vector.

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

Definition at line 53 of file Vec3.hpp.

Constructor & Destructor Documentation

◆ Vec3() [1/2]

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

Default constructor.

Initializes to (0, 0, 0).

◆ Vec3() [2/2]

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

Parameterized constructor.

◆ ~Vec3()

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

Default destructor.

Member Function Documentation

◆ cross()

template<Numeric T>
constexpr auto rtp::Vec3< T >::cross ( const Vec3< T > &  other) const -> Vec3
constexprnoexcept

The cross product of two 3D vectors.

◆ operator==()

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

Checks if two vectors are exactly equal.

◆ operator[]()

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

Member Data Documentation

◆ x

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

X coordinate.

Definition at line 54 of file Vec3.hpp.

◆ y

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

Y coordinate.

Definition at line 55 of file Vec3.hpp.

◆ z

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

Z coordinate.

Definition at line 56 of file Vec3.hpp.


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