MathLib
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | List of all members
BasicVector2D< Type > Struct Template Reference

#include <math/Vector2D.hpp>

Classes

struct  BasicRef
 

Public Types

using Ref = BasicRef< Type >
 
using ConstRef = BasicRef< const Type >
 
Types
using value_type = Type
 The underlying implementation type.
 

Public Member Functions

constexpr value_type normSquared () const
 
constexpr value_type norm () const
 
constexpr value_type magnitudeSquared () const
 
constexpr value_type magnitude () const
 
constexpr BasicVector2D< Type > normalized () const
 
Constructors
constexpr BasicVector2D ()=default
 
constexpr BasicVector2D (const Type &x_in, const Type &y_in=0)
 
constexpr BasicVector2D (const std::tuple< Type, Type > &t)
 
Assignment
constexpr BasicVector2D< Type > & operator= (const BasicVector2D &other)=default
 
constexpr BasicVector2D< Type > & operator= (Ref other)
 
Conversion Operators
constexpr operator std::tuple< Type, Type > () const
 
Invalid Value Check
bool isNaN () const
 
bool isInf () const
 
Swizzle operations
constexpr BasicVector2D xx () const
 
constexpr BasicVector2D xx ()
 
constexpr BasicVector2D yy () const
 
constexpr BasicVector2D yy ()
 
constexpr ConstRef xy () const &
 
constexpr Ref xy () &
 
constexpr BasicVector2D xy () &&
 
constexpr ConstRef yx () const &
 
constexpr Ref yx () &
 
constexpr BasicVector2D yx () &&
 

Static Public Member Functions

Constants
static constexpr BasicVector2D< Type > unit_x ()
 
static constexpr BasicVector2D< Type > unit_y ()
 
static constexpr BasicVector2D< Type > zero ()
 

Public Attributes

Element Access
Type x {}
 
Type y {}
 

Friends

Equality
template<class U >
requires Concept::SameUnqualified<Type, U>
constexpr bool operator== (const BasicVector2D &left, const BasicVector2D< U > &right)
 
template<class U , std::floating_point OT = float>
requires Concept::SameUnqualified<Type, U>
constexpr bool approximately_equal_to (const BasicVector2D &value_to_test, const BasicVector2D< U > &value_it_should_be, OT tolerance=OT{0.0002})
 
template<class U , std::floating_point OT = float>
requires Concept::SameUnqualified<Type, U>
constexpr bool approximately_equal_to (const BasicVector2D &value_to_test, BasicRef< U > value_it_should_be, OT tolerance=OT{0.0002})
 
Operators
template<class U >
requires Concept::SameUnqualified<Type, U>
constexpr BasicVector2D< Type > operator+ (const BasicVector2D &left, const BasicVector2D< U > &right)
 
template<class U >
requires Concept::SameUnqualified<Type, U>
constexpr BasicVector2D< Type > operator+ (const BasicVector2D &left, BasicRef< U > right)
 
template<class U >
requires Concept::SameUnqualified<Type, U>
constexpr BasicVector2D< Type > operator- (const BasicVector2D &left, const BasicVector2D< U > &right)
 
template<class U >
requires Concept::SameUnqualified<Type, U>
constexpr BasicVector2D< Type > operator- (const BasicVector2D &left, BasicRef< U > right)
 
template<class U >
requires Concept::SameUnqualified<Type, U>
constexpr BasicVector2D< Type > operator* (const BasicVector2D &left, const BasicVector2D< U > &right)
 
template<class U >
requires Concept::SameUnqualified<Type, U>
constexpr BasicVector2D< Type > operator* (const BasicVector2D &left, BasicRef< U > right)
 
template<class U >
requires Concept::SameUnqualified<Type, U>
constexpr BasicVector2D< Type > operator* (const BasicVector2D &left, const U &scalar)
 
template<class U >
requires Concept::SameUnqualified<Type, U>
constexpr BasicVector2D< Type > operator* (const U &scalar, const BasicVector2D< U > &right)
 
template<class U >
requires Concept::SameUnqualified<Type, U>
constexpr BasicVector2D< Type > operator/ (const BasicVector2D &left, const BasicVector2D< U > &right)
 
template<class U >
requires Concept::SameUnqualified<Type, U>
constexpr BasicVector2D< Type > operator/ (const BasicVector2D &left, BasicRef< U > right)
 
constexpr BasicVector2D< Type > operator/ (const BasicVector2D &left, const Type &scalar)
 
Global Functions
constexpr Type accumulate (const BasicVector2D< Type > &input)
 
template<class U >
requires Concept::SameUnqualified<Type, U>
constexpr Type dot (const BasicVector2D &left, const BasicVector2D< U > &right)
 
template<class U >
requires Concept::SameUnqualified<Type, U>
constexpr Type dot (const BasicVector2D &left, BasicRef< U > right)
 
template<class U >
requires Concept::SameUnqualified<Type, U>
constexpr Type dot_normalized (const BasicVector2D &left, const BasicVector2D< U > &right)
 
template<class U >
requires Concept::SameUnqualified<Type, U>
constexpr Type dot_normalized (const BasicVector2D &left, BasicRef< U > right)
 
constexpr BasicVector2D< Type > normalized (const BasicVector2D &input)
 
template<class U >
requires Concept::SameUnqualified<Type, U>
constexpr Type cross (const BasicVector2D &left, const BasicVector2D< U > &right)
 
template<class U >
requires Concept::SameUnqualified<Type, U>
constexpr Type cross (const BasicVector2D< Type > &left, BasicRef< U > right)
 
constexpr BasicVector2D< Type > abs (const BasicVector2D &input)
 
constexpr BasicVector2D< Type > fract (const BasicVector2D &input)
 
constexpr BasicVector2D< Type > saturate (const BasicVector2D &input, const Type lower_bound, Type upper_bound)
 
template<class U >
requires Concept::SameUnqualified<Type, U>
constexpr BasicVector2D< Type > lerp (const BasicVector2D &input_lower_bound, const BasicVector2D< U > &input_upper_bound, float percentage_zero_to_one)
 
template<class U >
requires Concept::SameUnqualified<Type, U>
constexpr BasicVector2D< Type > lerp (const BasicVector2D &input_lower_bound, BasicRef< U > input_upper_bound, float percentage_zero_to_one)
 
template<class U >
requires Concept::SameUnqualified<Type, U>
constexpr BasicVector2D< Type > mix (const BasicVector2D &input_lower_bound, const BasicVector2D< U > &input_upper_bound, float percentage_zero_to_one)
 
template<class U >
requires Concept::SameUnqualified<Type, U>
constexpr BasicVector2D< Type > mix (const BasicVector2D &input_lower_bound, BasicRef< U > input_upper_bound, float percentage_zero_to_one)
 
std::string format (const BasicVector2D &input)
 
Check
template<class U , std::floating_point OT = float>
requires Concept::SameUnqualified<Type, U>
bool check_if_equal (const BasicVector2D &input, const BasicVector2D< U > &near_to, OT tolerance=OT{0.0002})
 
template<class U , std::floating_point OT = float>
requires Concept::SameUnqualified<Type, U>
bool check_if_equal (const BasicVector2D &input, BasicRef< U > near_to, OT tolerance=OT{0.0002})
 
template<class U , std::floating_point OT = float>
requires Concept::SameUnqualified<Type, U>
bool check_if_not_equal (const BasicVector2D &input, const BasicVector2D< U > &near_to, OT tolerance=OT{0.0002})
 
template<class U , std::floating_point OT = float>
requires Concept::SameUnqualified<Type, U>
bool check_if_not_equal (const BasicVector2D &input, BasicRef< U > near_to, OT tolerance=OT{0.0002})
 
Assert
template<class U , std::floating_point OT = float>
requires Concept::SameUnqualified<Type, U>
void CHECK_IF_EQUAL (const BasicVector2D &input, const BasicVector2D< U > &near_to, OT tolerance=OT{0.0002})
 
template<class U , std::floating_point OT = float>
requires Concept::SameUnqualified<Type, U>
void CHECK_IF_EQUAL (const BasicVector2D &input, BasicRef< U > near_to, OT tolerance=OT{0.0002})
 
template<class U , std::floating_point OT = float>
requires Concept::SameUnqualified<Type, U>
void CHECK_IF_NOT_EQUAL (const BasicVector2D &input, const BasicVector2D< U > &near_to, OT tolerance=OT{0.0002})
 
template<class U , std::floating_point OT = float>
requires Concept::SameUnqualified<Type, U>
void CHECK_IF_NOT_EQUAL (const BasicVector2D &input, BasicRef< U > near_to, OT tolerance=OT{0.0002})
 
template<std::floating_point OT = float>
void CHECK_IF_ZERO (const BasicVector2D &input, OT tolerance=OT{0.0002})
 

Related Symbols

(Note that these are not member symbols.)

Type Aliases
using Vector2Df = BasicVector2D< float >
 
using Vector2Dd = BasicVector2D< double >
 
using Vector2D = BasicVector2D< double >
 
using Vector2Dl = BasicVector2D< long double >
 

Detailed Description

template<class Type>
struct Math::BasicVector2D< Type >

A simple 2D vector class

Definition at line 21 of file Vector2D.hpp.


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