Kale
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | Friends | List of all members
Kale::Vector2< T > Class Template Reference

#include <Vector.hpp>

Public Member Functions

 Vector2 ()
 
 Vector2 (T x, T y)
 
 Vector2 (T v[2])
 
void operator= (T n)
 
void operator= (T v[2])
 
void operator+= (Vector2< T > o)
 
void operator-= (Vector2< T > o)
 
void operator*= (Vector2< T > o)
 
void operator/= (Vector2< T > o)
 
void operator+= (T v)
 
void operator-= (T v)
 
void operator*= (T v)
 
void operator/= (T v)
 
Vector2< Toperator- () const
 
Vector2< Toperator+ (Vector2< T > o) const
 
Vector2< Toperator- (Vector2< T > o) const
 
Vector2< Toperator* (Vector2< T > o) const
 
Vector2< Toperator/ (Vector2< T > o) const
 
Vector2< Toperator+ (T v) const
 
Vector2< Toperator- (T v) const
 
Vector2< Toperator* (T v) const
 
Vector2< Toperator/ (T v) const
 
bool operator> (Vector2< T > o) const
 
bool operator< (Vector2< T > o) const
 
bool operator<= (Vector2< T > o) const
 
bool operator>= (Vector2< T > o) const
 
template<typename A = T>
std::enable_if< std::is_integral< A >::value, bool >::type operator== (Vector2< T > o) const
 
template<typename A = T>
std::enable_if< std::is_floating_point< A >::value, bool >::type operator== (Vector2< T > o) const
 
bool operator!= (Vector2< T > o) const
 
T dot (Vector2< T > o) const
 
T cross (Vector2< T > o) const
 
template<typename A = T>
std::enable_if< std::is_floating_point< A >::value, T >::type magnitude () const
 
Vector2< Tclamp (T minX, T maxX, T minY, T maxY) const
 
Vector2< Tclamp (Vector2< T > min, Vector2< T > max) const
 
void clampTo (T minX, T maxX, T minY, T maxY)
 
void clampTo (Vector2< T > min, Vector2< T > max)
 
template<typename A >
Vector2< Acast () const
 
template<typename A = T>
std::enable_if< std::is_floating_point< A >::value, Vector2< T > >::type unit () const
 
template<typename A = T>
std::enable_if< std::is_floating_point< A >::value, float >::type dist (Vector2< T > o) const
 
Vector2< Tperpendicular (Vector2< T > o) const
 
Vector2< Tproject (Vector2< T > o)
 
float signedAngle (Vector2< T > to) const
 
Vector2< TrotateClockwise () const
 
Vector2< TrotateCounterClockwise () const
 
Vector2< Tnormalized () const
 
Vector2< Txy () const
 
Vector2< Tyx () const
 

Static Public Member Functions

static Vector2< Tone ()
 
static Vector2< Tzero ()
 
static Vector2< Tright ()
 
static Vector2< Tup ()
 
static Vector2< Tmax ()
 
static Vector2< Tmin ()
 
static Vector2< Trandom (T min, T max)
 
static Vector2< Trandom (T minX, T maxX, T minY, T maxY)
 

Public Attributes

T x
 
T y
 

Friends

Vector2< Toperator+ (float n, Vector2< T > v)
 
Vector2< Toperator- (float n, Vector2< T > v)
 
Vector2< Toperator* (float n, Vector2< T > v)
 
Vector2< Toperator/ (float n, Vector2< T > v)
 

Detailed Description

template<typename T>
class Kale::Vector2< T >

Represents a vector in a 2 dimensional space

Definition at line 41 of file Vector.hpp.

Constructor & Destructor Documentation

◆ Vector2() [1/3]

template<typename T >
Kale::Vector2< T >::Vector2 ( )
inline

Definition at line 45 of file Vector.hpp.

◆ Vector2() [2/3]

template<typename T >
Kale::Vector2< T >::Vector2 ( T x,
T y )
inline

Definition at line 46 of file Vector.hpp.

◆ Vector2() [3/3]

template<typename T >
Kale::Vector2< T >::Vector2 ( T v[2])
inline

Definition at line 47 of file Vector.hpp.

Member Function Documentation

◆ cast()

template<typename T >
template<typename A >
Vector2< A > Kale::Vector2< T >::cast ( ) const
inline

Definition at line 144 of file Vector.hpp.

◆ clamp() [1/2]

template<typename T >
Vector2< T > Kale::Vector2< T >::clamp ( T minX,
T maxX,
T minY,
T maxY ) const
inline

Definition at line 127 of file Vector.hpp.

◆ clamp() [2/2]

template<typename T >
Vector2< T > Kale::Vector2< T >::clamp ( Vector2< T > min,
Vector2< T > max ) const
inline

Definition at line 130 of file Vector.hpp.

◆ clampTo() [1/2]

template<typename T >
void Kale::Vector2< T >::clampTo ( T minX,
T maxX,
T minY,
T maxY )
inline

Definition at line 134 of file Vector.hpp.

◆ clampTo() [2/2]

template<typename T >
void Kale::Vector2< T >::clampTo ( Vector2< T > min,
Vector2< T > max )
inline

Definition at line 138 of file Vector.hpp.

◆ cross()

template<typename T >
T Kale::Vector2< T >::cross ( Vector2< T > o) const
inline

Definition at line 122 of file Vector.hpp.

◆ dist()

template<typename T >
template<typename A = T>
std::enable_if< std::is_floating_point< A >::value, float >::type Kale::Vector2< T >::dist ( Vector2< T > o) const
inline

Definition at line 151 of file Vector.hpp.

◆ dot()

template<typename T >
T Kale::Vector2< T >::dot ( Vector2< T > o) const
inline

Definition at line 121 of file Vector.hpp.

◆ magnitude()

template<typename T >
template<typename A = T>
std::enable_if< std::is_floating_point< A >::value, T >::type Kale::Vector2< T >::magnitude ( ) const
inline

Definition at line 123 of file Vector.hpp.

◆ max()

template<typename T >
static Vector2< T > Kale::Vector2< T >::max ( )
inlinestatic

Definition at line 175 of file Vector.hpp.

◆ min()

template<typename T >
static Vector2< T > Kale::Vector2< T >::min ( )
inlinestatic

Definition at line 176 of file Vector.hpp.

◆ normalized()

template<typename T >
Vector2< T > Kale::Vector2< T >::normalized ( ) const
inline

Definition at line 166 of file Vector.hpp.

◆ one()

template<typename T >
static Vector2< T > Kale::Vector2< T >::one ( )
inlinestatic

Definition at line 171 of file Vector.hpp.

◆ operator!=()

template<typename T >
bool Kale::Vector2< T >::operator!= ( Vector2< T > o) const
inline

Definition at line 119 of file Vector.hpp.

◆ operator*() [1/2]

template<typename T >
Vector2< T > Kale::Vector2< T >::operator* ( T v) const
inline

Definition at line 101 of file Vector.hpp.

◆ operator*() [2/2]

template<typename T >
Vector2< T > Kale::Vector2< T >::operator* ( Vector2< T > o) const
inline

Definition at line 96 of file Vector.hpp.

◆ operator*=() [1/2]

template<typename T >
void Kale::Vector2< T >::operator*= ( T v)
inline

Definition at line 83 of file Vector.hpp.

◆ operator*=() [2/2]

template<typename T >
void Kale::Vector2< T >::operator*= ( Vector2< T > o)
inline

Definition at line 66 of file Vector.hpp.

◆ operator+() [1/2]

template<typename T >
Vector2< T > Kale::Vector2< T >::operator+ ( T v) const
inline

Definition at line 99 of file Vector.hpp.

◆ operator+() [2/2]

template<typename T >
Vector2< T > Kale::Vector2< T >::operator+ ( Vector2< T > o) const
inline

Definition at line 94 of file Vector.hpp.

◆ operator+=() [1/2]

template<typename T >
void Kale::Vector2< T >::operator+= ( T v)
inline

Definition at line 75 of file Vector.hpp.

◆ operator+=() [2/2]

template<typename T >
void Kale::Vector2< T >::operator+= ( Vector2< T > o)
inline

Definition at line 58 of file Vector.hpp.

◆ operator-() [1/3]

template<typename T >
Vector2< T > Kale::Vector2< T >::operator- ( ) const
inline

Definition at line 92 of file Vector.hpp.

◆ operator-() [2/3]

template<typename T >
Vector2< T > Kale::Vector2< T >::operator- ( T v) const
inline

Definition at line 100 of file Vector.hpp.

◆ operator-() [3/3]

template<typename T >
Vector2< T > Kale::Vector2< T >::operator- ( Vector2< T > o) const
inline

Definition at line 95 of file Vector.hpp.

◆ operator-=() [1/2]

template<typename T >
void Kale::Vector2< T >::operator-= ( T v)
inline

Definition at line 79 of file Vector.hpp.

◆ operator-=() [2/2]

template<typename T >
void Kale::Vector2< T >::operator-= ( Vector2< T > o)
inline

Definition at line 62 of file Vector.hpp.

◆ operator/() [1/2]

template<typename T >
Vector2< T > Kale::Vector2< T >::operator/ ( T v) const
inline

Definition at line 102 of file Vector.hpp.

◆ operator/() [2/2]

template<typename T >
Vector2< T > Kale::Vector2< T >::operator/ ( Vector2< T > o) const
inline

Definition at line 97 of file Vector.hpp.

◆ operator/=() [1/2]

template<typename T >
void Kale::Vector2< T >::operator/= ( T v)
inline

Definition at line 87 of file Vector.hpp.

◆ operator/=() [2/2]

template<typename T >
void Kale::Vector2< T >::operator/= ( Vector2< T > o)
inline

Definition at line 70 of file Vector.hpp.

◆ operator<()

template<typename T >
bool Kale::Vector2< T >::operator< ( Vector2< T > o) const
inline

Definition at line 110 of file Vector.hpp.

◆ operator<=()

template<typename T >
bool Kale::Vector2< T >::operator<= ( Vector2< T > o) const
inline

Definition at line 111 of file Vector.hpp.

◆ operator=() [1/2]

template<typename T >
void Kale::Vector2< T >::operator= ( T n)
inline

Definition at line 49 of file Vector.hpp.

◆ operator=() [2/2]

template<typename T >
void Kale::Vector2< T >::operator= ( T v[2])
inline

Definition at line 53 of file Vector.hpp.

◆ operator==() [1/2]

template<typename T >
template<typename A = T>
std::enable_if< std::is_integral< A >::value, bool >::type Kale::Vector2< T >::operator== ( Vector2< T > o) const
inline

Definition at line 113 of file Vector.hpp.

◆ operator==() [2/2]

template<typename T >
template<typename A = T>
std::enable_if< std::is_floating_point< A >::value, bool >::type Kale::Vector2< T >::operator== ( Vector2< T > o) const
inline

Definition at line 116 of file Vector.hpp.

◆ operator>()

template<typename T >
bool Kale::Vector2< T >::operator> ( Vector2< T > o) const
inline

Definition at line 109 of file Vector.hpp.

◆ operator>=()

template<typename T >
bool Kale::Vector2< T >::operator>= ( Vector2< T > o) const
inline

Definition at line 112 of file Vector.hpp.

◆ perpendicular()

template<typename T >
Vector2< T > Kale::Vector2< T >::perpendicular ( Vector2< T > o) const
inline

Definition at line 155 of file Vector.hpp.

◆ project()

template<typename T >
Vector2< T > Kale::Vector2< T >::project ( Vector2< T > o)
inline

Definition at line 158 of file Vector.hpp.

◆ random() [1/2]

template<typename T >
static Vector2< T > Kale::Vector2< T >::random ( T min,
T max )
inlinestatic

Definition at line 178 of file Vector.hpp.

◆ random() [2/2]

template<typename T >
static Vector2< T > Kale::Vector2< T >::random ( T minX,
T maxX,
T minY,
T maxY )
inlinestatic

Definition at line 179 of file Vector.hpp.

◆ right()

template<typename T >
static Vector2< T > Kale::Vector2< T >::right ( )
inlinestatic

Definition at line 173 of file Vector.hpp.

◆ rotateClockwise()

template<typename T >
Vector2< T > Kale::Vector2< T >::rotateClockwise ( ) const
inline

Definition at line 164 of file Vector.hpp.

◆ rotateCounterClockwise()

template<typename T >
Vector2< T > Kale::Vector2< T >::rotateCounterClockwise ( ) const
inline

Definition at line 165 of file Vector.hpp.

◆ signedAngle()

template<typename T >
float Kale::Vector2< T >::signedAngle ( Vector2< T > to) const
inline

Definition at line 163 of file Vector.hpp.

◆ unit()

template<typename T >
template<typename A = T>
std::enable_if< std::is_floating_point< A >::value, Vector2< T > >::type Kale::Vector2< T >::unit ( ) const
inline

Definition at line 148 of file Vector.hpp.

◆ up()

template<typename T >
static Vector2< T > Kale::Vector2< T >::up ( )
inlinestatic

Definition at line 174 of file Vector.hpp.

◆ xy()

template<typename T >
Vector2< T > Kale::Vector2< T >::xy ( ) const
inline

Definition at line 168 of file Vector.hpp.

◆ yx()

template<typename T >
Vector2< T > Kale::Vector2< T >::yx ( ) const
inline

Definition at line 169 of file Vector.hpp.

◆ zero()

template<typename T >
static Vector2< T > Kale::Vector2< T >::zero ( )
inlinestatic

Definition at line 172 of file Vector.hpp.

Friends And Related Symbol Documentation

◆ operator*

template<typename T >
Vector2< T > operator* ( float n,
Vector2< T > v )
friend

Definition at line 106 of file Vector.hpp.

◆ operator+

template<typename T >
Vector2< T > operator+ ( float n,
Vector2< T > v )
friend

Definition at line 104 of file Vector.hpp.

◆ operator-

template<typename T >
Vector2< T > operator- ( float n,
Vector2< T > v )
friend

Definition at line 105 of file Vector.hpp.

◆ operator/

template<typename T >
Vector2< T > operator/ ( float n,
Vector2< T > v )
friend

Definition at line 107 of file Vector.hpp.

Member Data Documentation

◆ x

template<typename T >
T Kale::Vector2< T >::x

Definition at line 43 of file Vector.hpp.

◆ y

template<typename T >
T Kale::Vector2< T >::y

Definition at line 43 of file Vector.hpp.


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